letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.29k stars 2.22k forks source link

LCD P012_LCD Plugin German Umlaute #2081

Closed StefanRied closed 5 years ago

StefanRied commented 5 years ago

Hi,

I've plugged a cheap 1602 LCD Display to the ESPEasy and everything worked except the German Umlaute. ÄÖÜß I found in the source the special handling of the degree unicode and fixed these characters accordingly.

Thanks to the documentation: https://www.sparkfun.com/datasheets/LCD/HD44780.pdf I found the right codes. There are no capital Umlaut characters, but at least the small characters in the font. Here is my suggestion for the end of the P012_LCD Module:

// Perform some specific changes for LCD display // https://www.letscontrolit.com/forum/viewtopic.php?t=2368 String P012_parseTemplate(String &tmpString, byte lineSize) { String result = parseTemplate(tmpString, lineSize); const char degree[3] = {0xc2, 0xb0, 0}; // Unicode degree symbol const char degree_lcd[2] = {0xdf, 0}; // P012_LCD degree symbol result.replace(degree, degree_lcd);

const char umlautAE_uni[3] = {0xc3, 0x84, 0}; // Unicode Umlaute AE const char umlautAE_lcd[2] = {0xe1, 0}; // P012_LCD Umlaute result.replace(umlautAE_uni, umlautAE_lcd);

const char umlaut_ae_uni[3] = {0xc3, 0xa4, 0}; // Unicode Umlaute ae result.replace(umlaut_ae_uni, umlautAE_lcd);

const char umlautOE_uni[3] = {0xc3, 0x96, 0}; // Unicode Umlaute OE const char umlautOE_lcd[2] = {0xef, 0}; // P012_LCD Umlaute result.replace(umlautOE_uni, umlautOE_lcd);

const char umlaut_oe_uni[3] = {0xc3, 0xb6, 0}; // Unicode Umlaute oe result.replace(umlaut_oe_uni, umlautOE_lcd);

const char umlautUE_uni[3] = {0xc3, 0x9c, 0}; // Unicode Umlaute UE const char umlautUE_lcd[2] = {0xf5, 0}; // P012_LCD Umlaute result.replace(umlautUE_uni, umlautUE_lcd);

const char umlaut_ue_uni[3] = {0xc3, 0xbc, 0}; // Unicode Umlaute ue result.replace(umlaut_ue_uni, umlautUE_lcd);

const char umlaut_sz_uni[3] = {0xc3, 0x9f, 0}; // Unicode Umlaute sz const char umlaut_sz_lcd[2] = {0xe2, 0}; // P012_LCD Umlaute result.replace(umlaut_sz_uni, umlaut_sz_lcd);

return result; }

I hope you find this helpful. Thanks to all contributors of ESPEasy. This is a great project.

TD-er commented 5 years ago

Are these supported on all of these displays, or is it a specific subset of fonts which may differ per module?

StefanRied commented 5 years ago

That's why have posted the spec above. Please check the font in the pdf above. There might be displays around where these font positions are occupied with Chinese characters. Mine was very cheap for 3.50 euros but does comply to the spec.

TD-er commented 5 years ago

I created a PR for it: https://github.com/letscontrolit/ESPEasy/pull/2082 I just edited it on Github and added a small optimization to check for the first unicode byte in those sequences (0xc3) Maybe you can also test it before I merge the PR?

StefanRied commented 5 years ago

Thanks for merging the PR. Just wanted to share this picture, how it looks like. https://www.stefan-ried.de/temp/Umlaute.JPG Have fun

TD-er commented 5 years ago

Thanks. Are we missing some other symbols as well? For instance in Dutch we also have the ï ë

StefanRied commented 5 years ago

@TD-er I am sorry to disappoint you. I've just checked page 17 of the spec of the 1602 Display. https://www.sparkfun.com/datasheets/LCD/HD44780.pdf There are no dutch characters in the ROM of this cheap display.

You might habe to spend 10 Euros more and invest into a Nextion. https://www.ebay.de/sch/i.html?_from=R40&_trksid=m570.l1313&_nkw=Nextion+HMI+Intelligent+USART+Serial+TFT+LCD+Module+Display&_sacat=0

StefanRied commented 5 years ago

@TD-er Actually I was wrong and have good news. I've looked into the spec again and searched the web a bit, I found this: https://circuitdigest.com/microcontroller-projects/custom-characters-on-lcd-using-pic16f877a

So, it looks like it is possible to redefine the right side of the character set called Custom Character preset in the display's CGROM.

I believe the most light and professional solution would be to add a simple flag in the ESPEasy Modul to load a custom character set. Then we could look for a character file people could upload to the ESP's EEPROM. By uploading a customer character file, people could display any pixel bitmap without changing or branching the ESPEasy firmware.

Maybe I return to this in January or somebody who really needs additional custom characters likes the idea.

ghtester commented 5 years ago

Maybe just for inspiration regarding to display charsets / routines etc... There's an excellent project of Component Tester which supports many display types so it may be interesting to look at the sources: https://www.mikrocontroller.net/svnbrowser/transistortester/Software/Markus/ (ComponentTester-1.34m.tgz)

Grovkillen commented 5 years ago

I close this one. Open if it's not resolved.