ESPEasy ` Sign

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
oaotto
New user
Posts: 9
Joined: 10 Feb 2019, 17:09

ESPEasy ` Sign

#1 Post by oaotto » 23 Dec 2024, 09:46

Why can't I use values ​​di with ``
locked up, you can't do anything anymore. I wanted to show them in a display, but I can't process them with Rules either?
E.g. come in like this: EVENT: Serial#v=`1`
she wanted to output a line on the display: [Serial#v]
But nothing works...


greeting otto

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESPEasy ` Sign

#2 Post by Ath » 23 Dec 2024, 09:58

The back-tick you are referring to has been used to wrap string values with commas and/or spaces for a long time, similar to the single and double quotes. See Parameter parsing

If you want to display a value including the back-ticks, you have to use another pair of quotes around that content:

Code: Select all

on *Serial#v do // Add * to have non-numeric data processed by the rule
  tft,txl,1,"Received value: `%eventvalue%`"
endon
NB: Not limited to the TFT command, works for any display, using the appropriate command. See the docs for details

Edit:
And if you want to have events processed when using the Serial Server plugin, without having a listener connected to the configured port, you should check the "Process events without client" setting
/Ton (PayPal.me)

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

Re: ESPEasy ` Sign

#3 Post by TD-er » 23 Dec 2024, 10:13

Not sure what you would like to achieve.
It seems like you may want to match a specific string?

If the string received is strictly a numerical value, then I think you could get away with it by using this:

Code: Select all

on Serial#v=1 do
  ...
endon
Just make sure when trying to match several similar events, you need to have the most specific one first since the rules parsing stops when a matching rule is found.

Thus "on foo#bar=1 do" before "on foo#bar do" and that one before "on foo do".

oaotto
New user
Posts: 9
Joined: 10 Feb 2019, 17:09

Re: ESPEasy ` Sign

#4 Post by oaotto » 23 Dec 2024, 14:17

I read through the link, unfortunately I didn't see/find the right one
I have it in the (Device: Display - ST77xx TFT)
Line 1:[Serial#1"%eventvalue%"]
tried but without success a word can also arrive (EVENT: Serial#1=`Word`)
Unfortunately I don't understand this very well. Could you help me with this?

Rules works
(on Serial#v=`1` do
...
endon)

Greetings Otto

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESPEasy ` Sign

#5 Post by Ath » 23 Dec 2024, 14:34

The Serial Server plugin does not have any Values, so you can't use the [Serial#v] notation. This data can be non-numeric, so can't be stored like the other values.
Events are the only way to handle data from this plugin.
/Ton (PayPal.me)

oaotto
New user
Posts: 9
Joined: 10 Feb 2019, 17:09

Re: ESPEasy ` Sign

#6 Post by oaotto » 23 Dec 2024, 15:27

How else could texts display numbers that come via the serial interface?

Greetings Otto

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESPEasy ` Sign

#7 Post by Ath » 23 Dec 2024, 16:13

oaotto wrote: 23 Dec 2024, 15:27 How else could texts display numbers that come via the serial interface?
Euhm, as said, via rules. That's one of the strong points of ESPEasy, the (flexible) rules engine :)
/Ton (PayPal.me)

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

Re: ESPEasy ` Sign

#8 Post by TD-er » 23 Dec 2024, 16:25

See for an example post #2 in this topic.
The 'key' is the %eventvalue1% in that rule example.
It contains the value in the event after the "=" sign.

oaotto
New user
Posts: 9
Joined: 10 Feb 2019, 17:09

Re: ESPEasy ` Sign

#9 Post by oaotto » 23 Dec 2024, 17:39

Ok
Numbers and words
but if there is a space between them nothing happens

Code: Select all

On Serial#1=`*` do // Add * to have non-numeric data processed by the rule
    st77xx,clear // Clear area
  st77xx,win,1 // Select window
      st77xx,txtfull,25,115,04,<foreColor=current>,red, <textPrintMode=current>,<minTextWidthPixels=1>, %eventvalue1%// Select window
    st77xx,delwin,1 // Delete Window
    st77xx,win,0 // Return to Window 0
endon
no spaces

Code: Select all

2519795: EVENT: Serial#1=`Word`
2519799: ACT  : st77xx,clear
2519800: Command: st77xx
2519800: st77xx,clear
2519802: Par1: 0 Par2: 0 Par3: 0 Par4: 0 Par5: 0
2519807: AdaGFX: parse result: 'st77xx,clear'
2519808: AdaGFX: command: st77xx argCount: 0:st77xx,clear
2519868: ACT  : st77xx,win,1
2519869: Command: st77xx
2519869: st77xx,win,1
2519871: Par1: 0 Par2: 1 Par3: 0 Par4: 0 Par5: 0
2519875: AdaGFX: parse result: 'st77xx,win,1'
2519877: AdaGFX: command: st77xx argCount: 1:st77xx,win,1
2519880: Command unknown: st77xx,win,1
2519883: ACT  : st77xx,txtfull,25,115,04,,red, ,, Word
2519884: Command: st77xx
2519884: st77xx,txtfull,25,115,04,,red, ,, Word
2519886: Par1: 0 Par2: 25 Par3: 115 Par4: 4 Par5: 0
2519891: AdaGFX: parse result: 'st77xx,txtfull,25,115,04,,red, ,, Word'
2519893: AdaGFX: command: st77xx argCount: 8:st77xx,txtfull,25,115,04,,red, ,2519894: invalidCoordinates: X:25/320 Y:115/240
2519894: invalidCoordinates: X:4/320 Y:0/240
2519894: invalidCoordinates: X:29/320 Y:115/240
2519895: invalidCoordinates: X:25/320 Y:115/240
2519896: printText: clear: _x:25, oTop:-4, _y:119, xTx:25, yTx:115, wTx:96, hTx:32, oBot:4, _res_x/max:320/320, str:Word
2519907: ACT  : st77xx,delwin,1
2519908: Command: st77xx
2519908: st77xx,delwin,1
2519910: Par1: 0 Par2: 1 Par3: 0 Par4: 0 Par5: 0
2519915: AdaGFX: parse result: 'st77xx,delwin,1'
2519917: AdaGFX: command: st77xx argCount: 1:st77xx,delwin,1
2519919: Command unknown: st77xx,delwin,1
2519922: ACT  : st77xx,win,0
2519923: Command: st77xx
2519923: st77xx,win,0
2519925: Par1: 0 Par2: 0 Par3: 0 Par4: 0 Par5: 0
2519929: AdaGFX: parse result: 'st77xx,win,0'
2519931: AdaGFX: command: st77xx argCount: 1:st77xx,win,0
2519939: EVENT: Serial#1=`Word` Processing: 144 ms

2
a space

Code: Select all

2302197: This world
2302203: EVENT: Serial#1=`This world`
2302206: ACT : st77xx,clear
2302207: Command: st77xx
2302208: st77xx,clear
2302210: Par1: 0 Par2: 0 Par3: 0 Par4: 0 Par5: 0
2302214: AdaGFX: parse result: 'st77xx,clear'
2302216: AdaGFX: command: st77xx argCount: 0:st77xx,clear
2302274: ACT : st77xx,win,1
2302275: Command: st77xx
2302275: st77xx,win,1
2302277: Par1: 0 Par2: 1 Par3: 0 Par4: 0 Par5: 0
2302282: AdaGFX: parse result: 'st77xx,win,1'
2302284: AdaGFX: command: st77xx argCount: 1:st77xx,win,1
2302288: Command unknown: st77xx,win,1
2302291: ACT : st77xx,txtfull,25,115,04,,red, ,, This world
2302293: Command: st77xx
2302293: st77xx,txtfull,25,115,04,,red, ,, This world
2302295: Par1: 0 Par2: 25 Par3: 115 Par4: 4 Par5: 0
2302300: AdaGFX: parse result: 'st77xx,txtfull,25,115,04,,red, ,, This w
2302302: AdaGFX: command: st77xx argCount: 9:st77xx,txtfull,25,115,04,,red, ,
2302302: invalidCoordinates: X:25/320 Y:115/240
2302303: invalidCoordinates: X:4/320 Y:0/240
2302303: invalidCoordinates: X:29/320 Y:115/240
2302306: Command unknown: st77xx,txtfull,25,115,04,,red, ,, This world
2302308: ACT : st77xx,delwin,1
2302309: Command: st77xx
2302310: st77xx,delwin,1
2302312: Par1: 0 Par2: 1 Par3: 0 Par4: 0 Par5: 0
2302316: AdaGFX: parse result: 'st77xx,delwin,1'
2302318: AdaGFX: command: st77xx argCount: 1:st77xx,delwin,1
2302320: Command unknown: st77xx,delwin,1
2302323: ACT : st77xx,win,0
2302324: Command: st77xx
2302324: st77xx,win,0
2302326: Par1: 0 Par2: 0 Par3: 0 Par4: 0 Par5: 0
2302331: AdaGFX: parse result: 'st77xx,win,0'
2302332: AdaGFX: command: st77xx argCount: 1:st77xx,win,0
2302340: EVENT: Serial#1=`This world` Processing: 138 ms
How do I have to treat the empty space?

Still got it figured out, that's how it works :D :D

Code: Select all

On Serial#1=`*` do // Add * to have non-numeric data processed by the rule
 
       st77xx,clear // Clear area
  st77xx,win,1 // Select window
      st77xx,txz,10,45,"%eventvalue%"// Select window
    st77xx,delwin,1 // Delete Window
    st77xx,win,0 // Return to Window 0
endon

Greetings Otto

User avatar
Ath
Normal user
Posts: 4330
Joined: 10 Jun 2018, 12:06
Location: NL

Re: ESPEasy ` Sign

#10 Post by Ath » 23 Dec 2024, 19:46

Hm, you're making things very complex, where they should really be easy :?

As you found out, when replacing/expanding a variable, the quotes are removed, so if the content contains spaces and/or commas, you have to re-add quotes around that argument to pass them on.

Why are you using command "st77xx,win,1" for selecting window 1? You have not defined a window, so the default dimensions for that window are 0 by 0 pixels, causing all draw/print commands to fail. That's what the logging is showing.
By default you are on window 0, that's the entire screen, and that can not be redefined nor deleted, only rotated.

You've taken the comment "// Add * to have non-numeric data processed by the rule" somewhat too literal. My example had the asterisk before the word 'Serial', where it is intended to go. Please read the suggestions and examples carefully.
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests