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

Display - OLED SSD1306/SH1106 Framed Bug: Can't send strings with spaces using http request #2863

Closed
11 of 14 tasks
tonhuisman opened this issue Jan 25, 2020 · 4 comments
Closed
11 of 14 tasks
Labels
Type: Not a bug Issues that later appeared not to be a bug (e.g. user error)

Comments

@tonhuisman
Copy link
Contributor

tonhuisman commented Jan 25, 2020

Checklist

  • The title of this issue is "to the point" and descriptive.
  • This issue describes what is happening.
  • This issue describes what components are affected (e.g. name of plugin/controller)
  • This issue describes how to reproduce it.
  • This issue describes when it was introduced (when known) and what version is now showing the problem.

I have...

  • searched the issue tracker or the forum for a similar issue. (include links when applicable)
  • entered a system description using "Copy info to clipboard" on the sysinfo page. (when possible)
  • entered the full filename of the used version (e.g. ESP_Easy_mega-20181001_test_ESP8266_4096_VCC.bin )
  • given a list of active plugins or controllers when applicable.
  • filled out all applicable fields below.

Steps already tried...

  • Tried a clean install (empty .bin files are included in the ZIP)
  • Tested previous/other build (mention which one already tested)
  • Tested on other node to make sure hardware isn't defective.
  • Verified if the problem is limited to a single plugin/controller

If you self compile, please state this and PLEASE try to ONLY REPORT ISSUES WITH OFFICIAL BUILDS!

Currently latest build: ESP_Easy_mega-20191208_test_beta_ESP8266_4M1M

Summarize of the problem/feature request

On EspEasy ESP_Easy_mega-20191208_test_beta_ESP8266_4M1M installed on a Wemos D1 mini clone I have a 128x64px OLED display
Using a bash script I try to send text to a line of the display using curl with an url like this:
url=http://${ESPADDR2}/control?cmd=OLEDFRAMEDCMD,1,update%3a%25SP%25${now}
But the only text displaying is the "update:" part, anything after the first space is ignored (I also tried to send %20 for a space, but to no avail, so I tried the systemvariable %SP%)

The bug appears to be in the P036 code, in PLUGIN_WRITE section:

            // content functions
            success = true;
            String NewContent = parseStringKeepCase(string, 3);

It only reads 1 word from the url, as there is a yet unsupported parameter (mode) that needs to be parsed sometime in the future.
Proposed solution:

  • Read the rest of the parameters, parse for the last comma, if found remove the part after it from NewContent and put that into the (mode) argument (though unused), if not found, keep the found text as NewContent.
  • Proceed the current processing

Expected behavior

I'd expect, assuming the command format should not change, that anything up until the last comma(or end of string if no comma is found) should be read from the parameters as NewContent

Actual behavior

Only the first word is read (and that word can't be 'display'...)

Steps to reproduce

  1. use a browser or curl to send a command to an espeasy OLed Framed display con taining a text of multiple words
  2. Only the first word sent will show

It's a software bug, so restarting isn't going to help

System configuration

Hardware:

Wemos D1 mini clone

ESP Easy version: ESP_Easy_mega-20191208_test_beta_ESP8266_4M1M

Rules or log data

(Edited to replace some braces)

@TD-er
Copy link
Member

TD-er commented Jan 25, 2020

Have you tested with the hints given here: #2724 ?

For example:
http://192.168.88.234/tools?cmd=oledframedcmd%2C1%2C%22text+example+with+spaces%22

Edit:
Did a quick test here and it does seem to work.
image

I created a command via the command field and then it will call the http command for you, this can help creating the right url escape characters.

@tonhuisman
Copy link
Contributor Author

Ok, adding quotes around the string and a + instead of a space does work from a browser (some more investigation to have curl not massage out the +...). But this does sound quite counter-intuitive, as the P023 OLED plugin does accept standard spaces (either a space or %20 in the url).
And the documentation is somewhat out of sync, as the oledframedcmd command isn't found there (AFAICS).
Someone should write the wiki page for P036 with all this info, maybe I'll volunteer for that...

I still think that adding the proper content-handling to the plugin is the right way to go, though this is a somewhat acceptable workaround.

@tonhuisman
Copy link
Contributor Author

For those interested, the url to pass to curl (on a RPi) turned out to this:
url=http://${ESPADDR2}/control?cmd=OLEDFRAMEDCMD,1,\'update%3a+${now}\'

@TD-er TD-er added the Type: Not a bug Issues that later appeared not to be a bug (e.g. user error) label Feb 4, 2020
@TD-er
Copy link
Member

TD-er commented Feb 4, 2020

As this is not really a bug, but maybe lack of links to documentation, I will close this one.

@TD-er TD-er closed this as completed Feb 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Not a bug Issues that later appeared not to be a bug (e.g. user error)
Projects
None yet
Development

No branches or pull requests

2 participants