LCD plugin proposals

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
sentinel
Normal user
Posts: 55
Joined: 02 Dec 2017, 17:40

LCD plugin proposals

#1 Post by sentinel » 26 Feb 2018, 17:56

Hi,
I have a couple of proposals for the LCD plugin:
1. I noticed that you cannot display the comma character ','. Or text which contains commas (eg. "text,with,commas")
The software, when parsing the command, looks for the last comma and displays the text after it. In file _P012_LCD.ino, we can replace the lines:

Code: Select all

argIndex = string.lastIndexOf(',');
tmpString = string.substring(argIndex + 1);
with the lines:

Code: Select all

tmpString = string.substring(string.indexOf(',') + 1);
for (int i = 1; i <= 2; i++){
  argIndex = tmpString.indexOf(',');
  tmpString = tmpString.substring(argIndex + 1);
}
so that tmpString will contain whatever is after the 3rd comma (given that the command is "lcd,row,col,text").

2. Then, I also noticed that no checks are made if there is no string to display. Should there be an error indication to the user?

3. What if we have a new LCD command, which displays text on the last line (truncating if it doesn't fit), and moves the existing text one line up (or vice versa: pushing text down). Like appending. Would that be something useful?


Regards

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: LCD plugin proposals

#2 Post by TD-er » 26 Feb 2018, 22:05

We could allow for some character escaping.
Perhaps "&#44" or "%2C" ?
The first is the HTML equivalent and the second one the escape syntax used in URLs
N.B. this is currently not implemented, just a suggestion.

sentinel
Normal user
Posts: 55
Joined: 02 Dec 2017, 17:40

Re: LCD plugin proposals

#3 Post by sentinel » 27 Feb 2018, 10:46

So is your proposal to have something like this: "LCD,1,1,text_with%2Ccomma". Isn't it simpler to look for the 3rd instance and display whatever is afterwards? so that the user always writes down the text to display. it's not logical to me to assume that the last comma will always be the third comma.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: LCD plugin proposals

#4 Post by TD-er » 27 Feb 2018, 21:16

sentinel wrote: 27 Feb 2018, 10:46 So is your proposal to have something like this: "LCD,1,1,text_with%2Ccomma". Isn't it simpler to look for the 3rd instance and display whatever is afterwards? so that the user always writes down the text to display. it's not logical to me to assume that the last comma will always be the third comma.
The commands can be sent via various ways, like HTTP, serial terminal and I guess MQTT.
At least HTTP and probably also MQTT do not allow to have a space, so that character should already be escaped.
So why not use it for all special characters then? That way you always have to send the same message, regardless the transport medium.
There are lots of characters that can be displayed, but not sent via all supported channels.

There was even an issue added about the degree symbol today, so I would like to add one single way to support these special characters.

sentinel
Normal user
Posts: 55
Joined: 02 Dec 2017, 17:40

Re: LCD plugin proposals

#5 Post by sentinel » 01 Mar 2018, 18:42

I understand your point. Thanks!

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: LCD plugin proposals

#6 Post by TD-er » 01 Mar 2018, 21:52

sentinel wrote: 01 Mar 2018, 18:42 I understand your point. Thanks!
So, what's your preference for the "," ? Or should I add both?

sentinel
Normal user
Posts: 55
Joined: 02 Dec 2017, 17:40

Re: LCD plugin proposals

#7 Post by sentinel » 03 Mar 2018, 10:55

my preference would be to be able to enter ',' (it's one less character of the form '%xx' to know). Just thinking it's not right to make the assumption in the code that the last comma is always the third comma.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: LCD plugin proposals

#8 Post by TD-er » 03 Mar 2018, 19:04

sentinel wrote: 03 Mar 2018, 10:55 my preference would be to be able to enter ',' (it's one less character of the form '%xx' to know). Just thinking it's not right to make the assumption in the code that the last comma is always the third comma.
I happened to see the related code yesterday.
I guess it should be possible to add " around the text.
There is something silly in there to replace all spaces with ',' and only then start decoding it.

sentinel
Normal user
Posts: 55
Joined: 02 Dec 2017, 17:40

Re: LCD plugin proposals

#9 Post by sentinel » 03 Mar 2018, 22:29

TD-er wrote: 03 Mar 2018, 19:04 I guess it should be possible to add " around the text.
There is something silly in there to replace all spaces with ',' and only then start decoding it.
Yes, " is also a good idea.
You mean in the functions used to retrieve the host, port, uri, right? Just before the HTTP GET is constructed. I also found it strange to replace the spaces with ','

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests