letscontrolit / ESPEasy

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

Add degree character to OLED plugin/Dont show garbage for unknown characters. #804

Closed Budman1758 closed 6 years ago

Budman1758 commented 6 years ago

Steps to reproduce

How can we trigger this problem? Attempt to display a degree symbol on either a Framed or a regular OLED display

Does the problem presist after powering off and on? (just resetting isnt enough sometimes) Yes

Expected behavior

Tell us what should happen? Symbol should show in the display

Actual behavior

Tell us what happens instead? On the Framed display the symbol does not show. On the regular OLED the entire line that should have the symbol is garbage. The symbol shows and saves correctly in the web UI. Using the the method to type the symbol from this link. https://www.google.com/search?q=type+degree+symbol&oq=type+degree+symbol&aqs=chrome..69i57.12952j0j4&sourceid=chrome&ie=UTF-8 20180131_201036 20180131_201135

The degree symbol should be showing just ahead of the "F" after the temp number. Like the title says, don't know if it's supposed to work or not. Also just tried inserting the symbol by copy from the character map app. Same result. GIT version: | mega-20180126

Grovkillen commented 6 years ago

As far as I understand these characters need to be hard coded into the plugin in order to work. My Swedish ÅÄÖåäö is not part of that hexadecimal list either. See here:

https://github.com/letscontrolit/ESPEasy/blob/cae3baf71e5de0872112b366df7cceae8f50be39/src/_P023_OLED.ino#L336

So I suggest you change the topic to "Add degree character to OLED plugin" or something :)

HV-NL commented 6 years ago

I had the same problem, so I tried every possible ASCII character. In this way I found that 0x7F is the character for degrees Celcius

This is the code I use in Domoticz to send a display string to the OLED display, attached to ESPEasy:

-----------------------------------------------------------------------
-- display_statusregel
-----------------------------------------------------------------------
function display_statusregel(regelnr, sLine)
    runcommand = "curl -m 1 'http://192.168.11.165/control?cmd=OLED," .. regelnr .. ",1," .. sLine .. "'"
    os.execute(runcommand)
end -- display_statusregel

    -- stuur de huidige CV temperatuur naar het OLED display op de schoorsteenmantel
    sLine = "CV%20In%20%20:%20" .. sCV_In .. "%20%7FC%20%20"
    display_statusregel(1, sLine)

temperatuur_display

v-a-d-e-r commented 6 years ago

Copy this into the text field (before F or C) to get the degree sign --> ° All without changing the source code. Only searching....

Budman1758 commented 6 years ago

Copy this into the text field (before F or C) to get the degree sign --> °

That does not seem to work for me......

This is the code I use in Domoticz to send a display string to the OLED display, attached to ESPEasy

Not using a controller.

TD-er commented 6 years ago

I could add a replacement check to change for example "{D}" into the character needed for the degree sign on the screen?

Budman1758 commented 6 years ago

Whatever works works for me. This is not a big deal. I know you guys are pretty busy chasing real bugs and more important stuff.

TD-er commented 6 years ago

Well, given the number of issues on the OLED-Framed plugin, I guess it is one of the most frequently used plugins.

And I also would like the degree sign to show on my own devices ;)

psy0rz commented 6 years ago

Also we should fix the bug that shows garbage for unknown characters. (instead show nothing or a questionmark or something)

Grovkillen commented 6 years ago

And add box character (filled and non-filled) to be used as progress bars.

TD-er commented 6 years ago

@Grovkillen that is another thing. The included font does not have bars.

Let's put bars in another issue to show charts.

TD-er commented 6 years ago

It should be fixed when @psy0rz does his magic merging :) Also added lots of other symbols.

Try these (short versions) (Euro does not work yet)

{D} {<<} {>>} {u} 
{E} {Y} {P} {c} 
{^1} {^2} {^3} 
{1_4} {1_2} {3_4}
{+-} {x} {..} 

You can also use the same characters via cut 'n paste from Character map. And HTML versions of these (like &deg; or &micro; ) which are probably easier to use in other ways of communications (JSON/URL/MQTT)

Still have to add command support for the OLED Framed plugin.

Grovkillen commented 6 years ago

To all : the list is found here https://www.letscontrolit.com/wiki/index.php/OLEDDisplay#Special_characters

These character codes can be used not only for the OLED but also other places as well.

Budman1758 commented 6 years ago

Halfway there. Works great in Framed OLED. (degree symbol) Reg OLED still has garbage. mega-20180206

TD-er commented 6 years ago

The regular OLED plugin does use the parseTemplate function: https://github.com/letscontrolit/ESPEasy/blob/eb2dbb5b90da52ffb6aa460cf0eab5f59eef107d/src/_P023_OLED.ino#L187-L203

But it uses an old interface to embedded fonts and these extra symbols are not included in the font.

Hmm... reading back the comments, I read this one: https://github.com/letscontrolit/ESPEasy/issues/804#issuecomment-362207363

It seems the degree symbol is included in the P023 font. Will look into it.