Jomelo/LCDMenuLib2

Lcd Display Character Corruption

Closed this issue · 2 comments

Hello,

I am having a strange issue with the library.
I have a teensy 4.0 connected to the i2c backpack and a 20x4 lcd
there is a logic level translator (https://www.sparkfun.com/products/12009) inbetween the two devices.

I suspect the library is the issue because there is odd characters displayed on screen when the code starts running, but as soon as the "screen saver" routine runs it displays correctly.

I am using the default example ic2 code (LCDML_i2c_display_20x4).

IMG_20200212_183452
IMG_20200212_183502

after updating to the latest version of arduino ide 1.8.12
and updating teensyduino to 1.51

there are now warning/errors during compile.

But the core issue still persists


                 from C:\Users\Jason\AppData\Local\Temp\arduino_build_121826\pch\Arduino.h:6:

LCDML_display_menu: In function 'void lcdml_menu_display()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/avr/pgmspace.h:109:2: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

 })

  ^

C:\Program Files (x86)\Arduino\hardware\teensy\avr\cores\teensy4/avr/pgmspace.h:60:45: note: in definition of macro 'strcpy_P'

 #define strcpy_P(dest, src) strcpy((dest), (src))

                                             ^

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\src/LCDMenuLib2_macros.h:66:38: note: in expansion of macro 'pgm_read_word'

                 strcpy_P(var, (char*)pgm_read_word(&(g_LCDML_DISP_lang_ ## lang ## _table[id]))); \

                                      ^

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\src/LCDMenuLib2_macros.h:104:9: note: in expansion of macro 'LCDML_getCustomContent'

         LCDML_getCustomContent(lcdml, var, id)

         ^

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\examples\03_displaytypes\lcd\LCDML_i2c_display_20x4\LCDML_display_menu.ino:50:13: note: in expansion of macro 'LCDML_getContent'

             LCDML_getContent(content_text, tmp->getID());

             ^

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\src\LCDMenuLib2.cpp: In member function 'void LCDMenuLib2::loop_menu()':

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\src\LCDMenuLib2.cpp:191:13: warning: unused variable 'stop_while_loop' [-Wunused-variable]

     boolean stop_while_loop = false;

             ^

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\src\LCDMenuLib2.cpp: In member function 'void LCDMenuLib2::MENU_doScroll(uint8_t)':

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\src\LCDMenuLib2.cpp:1045:13: warning: variable 'update' set but not used [-Wunused-but-set-variable]

     boolean update = false; 

             ^

C:\Users\Jason\Documents\Arduino\libraries\LCDMenuLib2\src\LCDMenuLib2.cpp:1046:13: warning: unused variable 'child_cnt' [-Wunused-variable]

     uint8_t child_cnt = MENU_countChilds(curMenu);   

             ^

Opening Teensy Loader...

Sketch uses 30416 bytes (1%) of program storage space. Maximum is 2031616 bytes.
Global variables use 41660 bytes (7%) of dynamic memory, leaving 482628 bytes for local variables. Maximum is 524288 bytes.```

I have found a solution to my problem.

Looking at commit to master since 2.1.2, i saw some changes related to _LCDML_cfg_use_ram
Turning that option on fixed the issue on the teensy 4.0.

I assume the code was just pick the wrong architecture for the teensy.