Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LiquidCrystal_I2C not compatible with ESP core ver. 2.6.0+ ? #3

Open
cniedzi opened this issue Dec 25, 2021 · 7 comments
Open

LiquidCrystal_I2C not compatible with ESP core ver. 2.6.0+ ? #3

cniedzi opened this issue Dec 25, 2021 · 7 comments

Comments

@cniedzi
Copy link

cniedzi commented Dec 25, 2021

Hi,

I successfuly use your LiquidCrystal_I2C library with Wemos D1 mini Pro with ESP core 2.5.0.
With any ESP core version starting from 2.6.0 or higher, the 16x2 display shows nothing :(

@cniedzi cniedzi changed the title LiquidCrystal_I2C not compatible with ESP core ver. 2.6.0+ LiquidCrystal_I2C not compatible with ESP core ver. 2.6.0+ ? Dec 25, 2021
@mcspr
Copy link

mcspr commented Dec 25, 2021

re esp8266/Arduino#8422
My understanding is that you have not tried Cores 3.0.0+, since the lib can't be built at all b/c we added -Werror=return-type and size_t write() is incorrectly omitting the return.

Compiling .pio/build/d1_mini/libbe2/LiquidCrystal_I2C/LiquidCrystal_I2C.cpp.o
lib/LiquidCrystal_I2C/LiquidCrystal_I2C.cpp: In member function 'virtual size_t LiquidCrystal_I2C::write(uint8_t)':
lib/LiquidCrystal_I2C/LiquidCrystal_I2C.cpp:244:1: error: no return statement in function returning non-void [-Werror=return-type]
  244 | }
      | ^
cc1plus: some warnings being treated as errors
diff --git a/LiquidCrystal_I2C.cpp b/LiquidCrystal_I2C.cpp
index 7be5887..206b4a6 100644
--- a/LiquidCrystal_I2C.cpp
+++ b/LiquidCrystal_I2C.cpp
@@ -241,6 +241,7 @@ inline void LiquidCrystal_I2C::command(uint8_t value) {

 inline size_t LiquidCrystal_I2C::write(uint8_t value) {
        send(value, Rs);
+       return 1;
 }

@cniedzi
Copy link
Author

cniedzi commented Dec 25, 2021

I've just tried 3.0.2 and the below code has been succesfully compiled and loaded into Wemos D1 mini Pro. LCD doesn't display any text. When I remove lcd.createChar(1,pl_S);, the LCD shows only one char "T".

#include <LiquidCrystal_I2C.h>

uint8_t pl_S[8] PROGMEM = {
  0b00010,
  0b01111,
  0b10100,
  0b10000,
  0b01110,
  0b00001,
  0b11110,
  0b00000
};

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup() {
    lcd.begin(4,5); 
    lcd.backlight();
    lcd.createChar(1,pl_S);
    lcd.home();  
    lcd.print("TEST");
} 

void loop() {} 
Executable segment sizes:
ICACHE : 32768           - flash instruction cache 
IROM   : 235860          - code in flash         (default or ICACHE_FLASH_ATTR) 
IRAM   : 26909   / 32768 - code in IRAM          (IRAM_ATTR, ISRs...) 
DATA   : 1504  )         - initialized variables (global, static) in RAM/HEAP 
RODATA : 896   ) / 81920 - constants             (global, static) in RAM/HEAP 
BSS    : 26008 )         - zeroed variables      (global, static) in RAM/HEAP 
Sketch uses 265169 bytes (25%) of program storage space. Maximum is 1044464 bytes.
Global variables use 28408 bytes (34%) of dynamic memory, leaving 53512 bytes for local variables. Maximum is 81920 bytes.
C:\Users\Czarek\AppData\Local\Arduino15\packages\esp8266\tools\python3\3.7.2-post1/python3 -I C:\Users\Czarek\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/upload.py --chip esp8266 --port COM3 --baud 921600 --before default_reset --after hard_reset write_flash 0x0 C:\Users\Czarek\AppData\Local\Temp\arduino_build_55955/XXX.ino.bin 
esptool.py v3.0
Serial port COM3
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 30:83:98:b2:d5:fc
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Auto-detected Flash size: 16MB
Compressed 269328 bytes to 197754...
Writing at 0x00000000... (7 %)
Writing at 0x00004000... (15 %)
Writing at 0x00008000... (23 %)
Writing at 0x0000c000... (30 %)
Writing at 0x00010000... (38 %)
Writing at 0x00014000... (46 %)
Writing at 0x00018000... (53 %)
Writing at 0x0001c000... (61 %)
Writing at 0x00020000... (69 %)
Writing at 0x00024000... (76 %)
Writing at 0x00028000... (84 %)
Writing at 0x0002c000... (92 %)
Writing at 0x00030000... (100 %)
Wrote 269328 bytes (197754 compressed) at 0x00000000 in 4.8 seconds (effective 450.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

@cniedzi
Copy link
Author

cniedzi commented Dec 25, 2021

I use this library (copy&paste from the header of LiquidCrystal_I2C.h)

/**************************************************************************
LIQUIDCRYSTAL_I2C FOR ESP8266 OR ARDUINO
***************************************************************************
AUTHOR: LUCAS MAZIERO - Electrical Engineer
EMAIL: lucas.mazie.ro@hotmail.com
CITY: Santa Maria - Rio Grande do Sul - Brasil
***************************************************************************
Version: 1.1
Date:  30/06/2017
Modified: 02/07/2017
***************************************************************************
CODE BASE: https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library
***************************************************************************
CHANGELOG:
* 30/06/2017 (1.0v):
    -> add degug #if defined(ESP8266)
    -> Add new function "begin(uint8_t sda, uint8_t scl)"
    -> Add new function "init()"
* 02/07/2017 (1.1v):
    -> Add new function "getBacklight()" get status of backlight 

***************************************************************************
Copyright(2017) by: Lucas Maziero.
**************************************************************************/

@cniedzi
Copy link
Author

cniedzi commented Dec 25, 2021

This is output log from ESP core 2.5.0 (everything works fine).

Sketch uses 265384 bytes (25%) of program storage space. Maximum is 1044464 bytes.
Global variables use 27360 bytes (33%) of dynamic memory, leaving 54560 bytes for local variables. Maximum is 81920 bytes.
C:\Users\Czarek\AppData\Local\Arduino15\packages\esp8266\tools\esptool\2.5.0-3-20ed2b9/esptool.exe -vv -cd nodemcu -cb 921600 -cp COM3 -ca 0x00000 -cf C:\Users\Czarek\AppData\Local\Temp\arduino_build_55955/XXX.ino.bin 
esptool v0.4.13-1-gf80ae31 - (c) 2014 Ch. Klippel <ck@atelier-klippel.de>
	setting board to nodemcu
	setting baudrate from 115200 to 921600
	setting port from COM1 to COM3
	setting address from 0x00000000 to 0x00000000
	espcomm_upload_file
	espcomm_upload_mem
	setting serial port timeouts to 1000 ms
opening bootloader
resetting board
trying to connect
	flush start
	setting serial port timeouts to 1 ms
	setting serial port timeouts to 1000 ms
	flush complete
	espcomm_send_command: sending command header
	espcomm_send_command: sending command payload
	read 0, requested 1
trying to connect
	flush start
	setting serial port timeouts to 1 ms
	setting serial port timeouts to 1000 ms
	flush complete
	espcomm_send_command: sending command header
	espcomm_send_command: sending command payload
	espcomm_send_command: receiving 2 bytes of data
	espcomm_send_command: receiving 2 bytes of data
	espcomm_send_command: receiving 2 bytes of data
	espcomm_send_command: receiving 2 bytes of data
	espcomm_send_command: receiving 2 bytes of data
	espcomm_send_command: receiving 2 bytes of data
	espcomm_send_command: receiving 2 bytes of data
	espcomm_send_command: receiving 2 bytes of data
Uploading 269536 bytes from C:\Users\Czarek\AppData\Local\Temp\arduino_build_55955/XXX.ino.bin to flash at 0x00000000
	erasing flash
	size: 041ce0 address: 000000
	first_sector_index: 0
	total_sector_count: 66
	head_sector_count: 16
	adjusted_sector_count: 50
	erase_size: 032000
	espcomm_send_command: sending command header
	espcomm_send_command: sending command payload
	setting serial port timeouts to 15000 ms
	setting serial port timeouts to 1000 ms
	espcomm_send_command: receiving 2 bytes of data
	writing flash
................................................................................ [ 30% ]
................................................................................ [ 60% ]
................................................................................ [ 90% ]
........................                                                         [ 100% ]
starting app without reboot
	espcomm_send_command: sending command header
	espcomm_send_command: sending command payload
	espcomm_send_command: receiving 2 bytes of data
closing bootloader
	flush start
	setting serial port timeouts to 1 ms
	setting serial port timeouts to 1000 ms
	flush complete

@cniedzi
Copy link
Author

cniedzi commented Dec 25, 2021

To summarize - it does work with ESP core 2.5.0; it doesn't work with 2.5.1+ (maybe something related to wire.h was changed in 2.5.1...)
Maybe @lucasmaziero can take a look on this issue.

@mcspr
Copy link

mcspr commented Dec 25, 2021

Does it work without the PROGMEM for the char array?

- uint8_t pl_S[8] PROGMEM = {
+ uint8_t pl_S[8] = {

@cniedzi
Copy link
Author

cniedzi commented Dec 25, 2021

Does it work without the PROGMEM for the char array?

- uint8_t pl_S[8] PROGMEM = {
+ uint8_t pl_S[8] = {

Nope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants