mirror of
https://github.com/joBr99/nspanel-lovelace-ui.git
synced 2025-12-21 15:04:24 +01:00
add ping command to test page (add nextion2text)
This commit is contained in:
committed by
github-actions[bot]
parent
d4d518a02f
commit
21f2876f53
@@ -1,6 +1,6 @@
|
||||
diff -bur HMI/n2t-out/Program.s.txt HMI/US/landscape/n2t-out/Program.s.txt
|
||||
--- HMI/n2t-out/Program.s.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
+++ HMI/US/landscape/n2t-out/Program.s.txt 2022-08-07 21:12:09.588765588 +0000
|
||||
--- HMI/n2t-out/Program.s.txt 2022-08-17 14:27:16.783231605 +0000
|
||||
+++ HMI/US/landscape/n2t-out/Program.s.txt 2022-08-17 14:27:17.727241750 +0000
|
||||
@@ -14,6 +14,3 @@
|
||||
//color vars
|
||||
int defaultFontColor=65535
|
||||
@@ -9,8 +9,8 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/landscape/n2t-out/Program.s.txt
|
||||
- lcd_dev fffb 0002 0000 0020
|
||||
- page pageStartup
|
||||
diff -bur HMI/n2t-out/pageStartup.txt HMI/US/landscape/n2t-out/pageStartup.txt
|
||||
--- HMI/n2t-out/pageStartup.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
+++ HMI/US/landscape/n2t-out/pageStartup.txt 2022-08-07 21:12:09.592765628 +0000
|
||||
--- HMI/n2t-out/pageStartup.txt 2022-08-17 14:27:16.787231648 +0000
|
||||
+++ HMI/US/landscape/n2t-out/pageStartup.txt 2022-08-17 14:27:17.727241750 +0000
|
||||
@@ -177,7 +177,7 @@
|
||||
recmod=1
|
||||
bauds=115200
|
||||
@@ -20,3 +20,124 @@ diff -bur HMI/n2t-out/pageStartup.txt HMI/US/landscape/n2t-out/pageStartup.txt
|
||||
//send calc crc
|
||||
btlen tSend.txt,sys0
|
||||
crcrest 1,0xffff // reset CRC
|
||||
diff -bur HMI/n2t-out/pageTest.txt HMI/US/landscape/n2t-out/pageTest.txt
|
||||
--- HMI/n2t-out/pageTest.txt 2022-08-17 14:27:16.783231605 +0000
|
||||
+++ HMI/US/landscape/n2t-out/pageTest.txt 2022-08-17 14:27:17.727241750 +0000
|
||||
@@ -14,34 +14,6 @@
|
||||
Preinitialize Event
|
||||
vis p0,0
|
||||
|
||||
-Variable (string) tInstruction
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Text :
|
||||
- Max. Text Size: 30
|
||||
-
|
||||
-Variable (string) strCommand
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Text :
|
||||
- Max. Text Size: 20
|
||||
-
|
||||
-Variable (string) tSend
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Text :
|
||||
- Max. Text Size: 40
|
||||
-
|
||||
-Text tBench
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Dragging : 0
|
||||
- Disable release event after dragging: 0
|
||||
- Send Component ID : disabled
|
||||
- Associated Keyboard : none
|
||||
- Text :
|
||||
- Max. Text Size : 20
|
||||
-
|
||||
Picture p0
|
||||
Attributes
|
||||
Scope : local
|
||||
@@ -218,82 +190,3 @@
|
||||
Touch Press Event
|
||||
page cardQR
|
||||
|
||||
-Timer tmSerial
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Period (ms): 50
|
||||
- Enabled : yes
|
||||
-
|
||||
- Events
|
||||
- Timer Event
|
||||
- // data available
|
||||
- if(usize>1)
|
||||
- {
|
||||
- bufferPos=0
|
||||
- while(bufferPos<usize)
|
||||
- {
|
||||
- // check for 0x55 0xBB - Command Init Secuence
|
||||
- if(u[bufferPos]==187&&u[bufferPos-1]==85)
|
||||
- {
|
||||
- //remove garbage at the start of the buffer if there's any to free buffer for command
|
||||
- if(u[bufferPos]!=1)
|
||||
- {
|
||||
- udelete bufferPos-1
|
||||
- }
|
||||
- //instruction is now aligned with buffer, because we deleted garbage before instrcution
|
||||
- //get length after init sequence (check if there are more than to bytes in buffer)
|
||||
- if(3<usize)
|
||||
- {
|
||||
- // check if serial buffer has reached the announced length
|
||||
- ucopy payloadLength,2,2,0
|
||||
- // we are only checking payload length so we have to skip first 3 bytes (init+payload length) (-1 because of < instead of <=)
|
||||
- payloadLength+=3
|
||||
- // payload length does also not contain crc, so we are adding another 2 bytes for crc
|
||||
- payloadLength+=2
|
||||
- if(payloadLength<usize)
|
||||
- {
|
||||
- // calculate crc
|
||||
- crcrest 1,0xFFFF
|
||||
- // u[2] contains payload legth at 3rd pos in buffer, we are calculating crc from 3rd pos with number of bytes from payload length
|
||||
- //crcputu 3,u[2]
|
||||
- // u[2] cotnains payload length, we are calculating a crc over the whole message, so we have to add 3 to the length from u[2]
|
||||
- crcputu 0,payloadLength-1
|
||||
- // get recived crc to be able to compare it
|
||||
- ucopy recvCrc,payloadLength-1,2,0
|
||||
- // compare crc with recived value
|
||||
- if(crcval==recvCrc)
|
||||
- {
|
||||
- // crc is okay
|
||||
- // here is the location where acual code should be
|
||||
- // write command to variable strCommand
|
||||
- ucopy strCommand.txt,4,payloadLength-5,0
|
||||
- // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||
- spstr strCommand.txt,tInstruction.txt,"~",0
|
||||
- if(tInstruction.txt=="ping")
|
||||
- {
|
||||
- spstr strCommand.txt,tBench.txt,"~",0
|
||||
- tSend.txt="pong,"+tBench.txt
|
||||
- //send calc crc
|
||||
- btlen tSend.txt,sys0
|
||||
- crcrest 1,0xffff // reset CRC
|
||||
- crcputh 55 bb
|
||||
- crcputs sys0,2
|
||||
- crcputs tSend.txt,0
|
||||
- //send cmd
|
||||
- printh 55 bb
|
||||
- prints sys0,2
|
||||
- prints tSend.txt,0
|
||||
- prints crcval,2
|
||||
- }
|
||||
- // end of user code
|
||||
- udelete payloadLength-1
|
||||
- bufferPos=0
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- // next character
|
||||
- bufferPos++
|
||||
- }
|
||||
- }
|
||||
-
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
diff -bur HMI/n2t-out/Program.s.txt HMI/US/portrait/n2t-out/Program.s.txt
|
||||
--- HMI/n2t-out/Program.s.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
+++ HMI/US/portrait/n2t-out/Program.s.txt 2022-08-07 21:12:08.996759619 +0000
|
||||
--- HMI/n2t-out/Program.s.txt 2022-08-17 14:27:16.783231605 +0000
|
||||
+++ HMI/US/portrait/n2t-out/Program.s.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
@@ -14,6 +14,6 @@
|
||||
//color vars
|
||||
int defaultFontColor=65535
|
||||
@@ -11,8 +11,8 @@ diff -bur HMI/n2t-out/Program.s.txt HMI/US/portrait/n2t-out/Program.s.txt
|
||||
+ //lcd_dev fffb 0002 0000 0020
|
||||
page pageStartup
|
||||
diff -bur HMI/n2t-out/cardEntities.txt HMI/US/portrait/n2t-out/cardEntities.txt
|
||||
--- HMI/n2t-out/cardEntities.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
+++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-08-07 21:12:08.996759619 +0000
|
||||
--- HMI/n2t-out/cardEntities.txt 2022-08-17 14:27:16.787231648 +0000
|
||||
+++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
@@ -65,6 +65,16 @@
|
||||
vis nNum4,0
|
||||
vis bPrev,0
|
||||
@@ -458,8 +458,8 @@ diff -bur HMI/n2t-out/cardEntities.txt HMI/US/portrait/n2t-out/cardEntities.txt
|
||||
if(tInstruction.txt=="pageType")
|
||||
{
|
||||
diff -bur HMI/n2t-out/pageStartup.txt HMI/US/portrait/n2t-out/pageStartup.txt
|
||||
--- HMI/n2t-out/pageStartup.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
+++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-08-07 21:12:08.996759619 +0000
|
||||
--- HMI/n2t-out/pageStartup.txt 2022-08-17 14:27:16.787231648 +0000
|
||||
+++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
@@ -142,7 +142,7 @@
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
@@ -478,3 +478,124 @@ diff -bur HMI/n2t-out/pageStartup.txt HMI/US/portrait/n2t-out/pageStartup.txt
|
||||
//send calc crc
|
||||
btlen tSend.txt,sys0
|
||||
crcrest 1,0xffff // reset CRC
|
||||
diff -bur HMI/n2t-out/pageTest.txt HMI/US/portrait/n2t-out/pageTest.txt
|
||||
--- HMI/n2t-out/pageTest.txt 2022-08-17 14:27:16.783231605 +0000
|
||||
+++ HMI/US/portrait/n2t-out/pageTest.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
@@ -14,34 +14,6 @@
|
||||
Preinitialize Event
|
||||
vis p0,0
|
||||
|
||||
-Variable (string) tInstruction
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Text :
|
||||
- Max. Text Size: 30
|
||||
-
|
||||
-Variable (string) strCommand
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Text :
|
||||
- Max. Text Size: 20
|
||||
-
|
||||
-Variable (string) tSend
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Text :
|
||||
- Max. Text Size: 40
|
||||
-
|
||||
-Text tBench
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Dragging : 0
|
||||
- Disable release event after dragging: 0
|
||||
- Send Component ID : disabled
|
||||
- Associated Keyboard : none
|
||||
- Text :
|
||||
- Max. Text Size : 20
|
||||
-
|
||||
Picture p0
|
||||
Attributes
|
||||
Scope : local
|
||||
@@ -218,82 +190,3 @@
|
||||
Touch Press Event
|
||||
page cardQR
|
||||
|
||||
-Timer tmSerial
|
||||
- Attributes
|
||||
- Scope : local
|
||||
- Period (ms): 50
|
||||
- Enabled : yes
|
||||
-
|
||||
- Events
|
||||
- Timer Event
|
||||
- // data available
|
||||
- if(usize>1)
|
||||
- {
|
||||
- bufferPos=0
|
||||
- while(bufferPos<usize)
|
||||
- {
|
||||
- // check for 0x55 0xBB - Command Init Secuence
|
||||
- if(u[bufferPos]==187&&u[bufferPos-1]==85)
|
||||
- {
|
||||
- //remove garbage at the start of the buffer if there's any to free buffer for command
|
||||
- if(u[bufferPos]!=1)
|
||||
- {
|
||||
- udelete bufferPos-1
|
||||
- }
|
||||
- //instruction is now aligned with buffer, because we deleted garbage before instrcution
|
||||
- //get length after init sequence (check if there are more than to bytes in buffer)
|
||||
- if(3<usize)
|
||||
- {
|
||||
- // check if serial buffer has reached the announced length
|
||||
- ucopy payloadLength,2,2,0
|
||||
- // we are only checking payload length so we have to skip first 3 bytes (init+payload length) (-1 because of < instead of <=)
|
||||
- payloadLength+=3
|
||||
- // payload length does also not contain crc, so we are adding another 2 bytes for crc
|
||||
- payloadLength+=2
|
||||
- if(payloadLength<usize)
|
||||
- {
|
||||
- // calculate crc
|
||||
- crcrest 1,0xFFFF
|
||||
- // u[2] contains payload legth at 3rd pos in buffer, we are calculating crc from 3rd pos with number of bytes from payload length
|
||||
- //crcputu 3,u[2]
|
||||
- // u[2] cotnains payload length, we are calculating a crc over the whole message, so we have to add 3 to the length from u[2]
|
||||
- crcputu 0,payloadLength-1
|
||||
- // get recived crc to be able to compare it
|
||||
- ucopy recvCrc,payloadLength-1,2,0
|
||||
- // compare crc with recived value
|
||||
- if(crcval==recvCrc)
|
||||
- {
|
||||
- // crc is okay
|
||||
- // here is the location where acual code should be
|
||||
- // write command to variable strCommand
|
||||
- ucopy strCommand.txt,4,payloadLength-5,0
|
||||
- // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||
- spstr strCommand.txt,tInstruction.txt,"~",0
|
||||
- if(tInstruction.txt=="ping")
|
||||
- {
|
||||
- spstr strCommand.txt,tBench.txt,"~",0
|
||||
- tSend.txt="pong,"+tBench.txt
|
||||
- //send calc crc
|
||||
- btlen tSend.txt,sys0
|
||||
- crcrest 1,0xffff // reset CRC
|
||||
- crcputh 55 bb
|
||||
- crcputs sys0,2
|
||||
- crcputs tSend.txt,0
|
||||
- //send cmd
|
||||
- printh 55 bb
|
||||
- prints sys0,2
|
||||
- prints tSend.txt,0
|
||||
- prints crcval,2
|
||||
- }
|
||||
- // end of user code
|
||||
- udelete payloadLength-1
|
||||
- bufferPos=0
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- }
|
||||
- // next character
|
||||
- bufferPos++
|
||||
- }
|
||||
- }
|
||||
-
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
+++ HMI/US/portrait/diff-eu-version.txt 2022-08-07 21:12:09.012759781 +0000
|
||||
+--- HMI/n2t-out/Program.s.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-08-07 21:12:08.996759619 +0000
|
||||
+++ HMI/US/portrait/diff-eu-version.txt 2022-08-17 14:27:17.259236721 +0000
|
||||
+--- HMI/n2t-out/Program.s.txt 2022-08-17 14:27:16.783231605 +0000
|
||||
++++ HMI/US/portrait/n2t-out/Program.s.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
+@@ -14,6 +14,6 @@
|
||||
+ //color vars
|
||||
+ int defaultFontColor=65535
|
||||
+ int defaultBcoColor=6371
|
||||
+--- HMI/n2t-out/cardEntities.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-08-07 21:12:08.996759619 +0000
|
||||
+--- HMI/n2t-out/cardEntities.txt 2022-08-17 14:27:16.787231648 +0000
|
||||
++++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
+@@ -65,6 +65,16 @@
|
||||
+ vis bPrev,0
|
||||
+ vis bNext,0
|
||||
@@ -33,5 +33,126 @@
|
||||
++ spstr strCommand.txt,tTmp.txt,"~",32
|
||||
++ covx tTmp.txt,sys0,0,0
|
||||
++ btOnOff5.val=sys0
|
||||
+--- HMI/n2t-out/pageStartup.txt 2022-08-07 21:12:08.440754014 +0000
|
||||
++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-08-07 21:12:08.996759619 +0000
|
||||
+--- HMI/n2t-out/pageStartup.txt 2022-08-17 14:27:16.787231648 +0000
|
||||
++++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
+diff -bur HMI/n2t-out/pageTest.txt HMI/US/portrait/n2t-out/pageTest.txt
|
||||
+--- HMI/n2t-out/pageTest.txt 2022-08-17 14:27:16.783231605 +0000
|
||||
++++ HMI/US/portrait/n2t-out/pageTest.txt 2022-08-17 14:27:17.243236549 +0000
|
||||
+@@ -14,34 +14,6 @@
|
||||
+ Preinitialize Event
|
||||
+ vis p0,0
|
||||
+
|
||||
+-Variable (string) tInstruction
|
||||
+- Attributes
|
||||
+- Scope : local
|
||||
+- Text :
|
||||
+- Max. Text Size: 30
|
||||
+-
|
||||
+-Variable (string) strCommand
|
||||
+- Attributes
|
||||
+- Scope : local
|
||||
+- Text :
|
||||
+- Max. Text Size: 20
|
||||
+-
|
||||
+-Variable (string) tSend
|
||||
+- Attributes
|
||||
+- Scope : local
|
||||
+- Text :
|
||||
+- Max. Text Size: 40
|
||||
+-
|
||||
+-Text tBench
|
||||
+- Attributes
|
||||
+- Scope : local
|
||||
+- Dragging : 0
|
||||
+- Disable release event after dragging: 0
|
||||
+- Send Component ID : disabled
|
||||
+- Associated Keyboard : none
|
||||
+- Text :
|
||||
+- Max. Text Size : 20
|
||||
+-
|
||||
+ Picture p0
|
||||
+ Attributes
|
||||
+ Scope : local
|
||||
+@@ -218,82 +190,3 @@
|
||||
+ Touch Press Event
|
||||
+ page cardQR
|
||||
+
|
||||
+-Timer tmSerial
|
||||
+- Attributes
|
||||
+- Scope : local
|
||||
+- Period (ms): 50
|
||||
+- Enabled : yes
|
||||
+-
|
||||
+- Events
|
||||
+- Timer Event
|
||||
+- // data available
|
||||
+- if(usize>1)
|
||||
+- {
|
||||
+- bufferPos=0
|
||||
+- while(bufferPos<usize)
|
||||
+- {
|
||||
+- // check for 0x55 0xBB - Command Init Secuence
|
||||
+- if(u[bufferPos]==187&&u[bufferPos-1]==85)
|
||||
+- {
|
||||
+- //remove garbage at the start of the buffer if there's any to free buffer for command
|
||||
+- if(u[bufferPos]!=1)
|
||||
+- {
|
||||
+- udelete bufferPos-1
|
||||
+- }
|
||||
+- //instruction is now aligned with buffer, because we deleted garbage before instrcution
|
||||
+- //get length after init sequence (check if there are more than to bytes in buffer)
|
||||
+- if(3<usize)
|
||||
+- {
|
||||
+- // check if serial buffer has reached the announced length
|
||||
+- ucopy payloadLength,2,2,0
|
||||
+- // we are only checking payload length so we have to skip first 3 bytes (init+payload length) (-1 because of < instead of <=)
|
||||
+- payloadLength+=3
|
||||
+- // payload length does also not contain crc, so we are adding another 2 bytes for crc
|
||||
+- payloadLength+=2
|
||||
+- if(payloadLength<usize)
|
||||
+- {
|
||||
+- // calculate crc
|
||||
+- crcrest 1,0xFFFF
|
||||
+- // u[2] contains payload legth at 3rd pos in buffer, we are calculating crc from 3rd pos with number of bytes from payload length
|
||||
+- //crcputu 3,u[2]
|
||||
+- // u[2] cotnains payload length, we are calculating a crc over the whole message, so we have to add 3 to the length from u[2]
|
||||
+- crcputu 0,payloadLength-1
|
||||
+- // get recived crc to be able to compare it
|
||||
+- ucopy recvCrc,payloadLength-1,2,0
|
||||
+- // compare crc with recived value
|
||||
+- if(crcval==recvCrc)
|
||||
+- {
|
||||
+- // crc is okay
|
||||
+- // here is the location where acual code should be
|
||||
+- // write command to variable strCommand
|
||||
+- ucopy strCommand.txt,4,payloadLength-5,0
|
||||
+- // write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||
+- spstr strCommand.txt,tInstruction.txt,"~",0
|
||||
+- if(tInstruction.txt=="ping")
|
||||
+- {
|
||||
+- spstr strCommand.txt,tBench.txt,"~",0
|
||||
+- tSend.txt="pong,"+tBench.txt
|
||||
+- //send calc crc
|
||||
+- btlen tSend.txt,sys0
|
||||
+- crcrest 1,0xffff // reset CRC
|
||||
+- crcputh 55 bb
|
||||
+- crcputs sys0,2
|
||||
+- crcputs tSend.txt,0
|
||||
+- //send cmd
|
||||
+- printh 55 bb
|
||||
+- prints sys0,2
|
||||
+- prints tSend.txt,0
|
||||
+- prints crcval,2
|
||||
+- }
|
||||
+- // end of user code
|
||||
+- udelete payloadLength-1
|
||||
+- bufferPos=0
|
||||
+- }
|
||||
+- }
|
||||
+- }
|
||||
+- }
|
||||
+- // next character
|
||||
+- bufferPos++
|
||||
+- }
|
||||
+- }
|
||||
+-
|
||||
|
||||
@@ -6,6 +6,10 @@ pageIcons
|
||||
6 Component(s)
|
||||
0 Line(s) of event code
|
||||
0 Unique line(s) of event code
|
||||
pageTest
|
||||
19 Component(s)
|
||||
62 Line(s) of event code
|
||||
60 Unique line(s) of event code
|
||||
popupShutter
|
||||
25 Component(s)
|
||||
388 Line(s) of event code
|
||||
@@ -34,10 +38,6 @@ cardGrid
|
||||
42 Component(s)
|
||||
462 Line(s) of event code
|
||||
271 Unique line(s) of event code
|
||||
pageTest
|
||||
14 Component(s)
|
||||
14 Line(s) of event code
|
||||
14 Unique line(s) of event code
|
||||
cardQR
|
||||
32 Component(s)
|
||||
403 Line(s) of event code
|
||||
@@ -61,6 +61,6 @@ cardEntities
|
||||
|
||||
Total
|
||||
14 Page(s)
|
||||
432 Component(s)
|
||||
5143 Line(s) of event code
|
||||
1353 Unique line(s) of event code
|
||||
437 Component(s)
|
||||
5191 Line(s) of event code
|
||||
1365 Unique line(s) of event code
|
||||
|
||||
@@ -22,6 +22,57 @@ Page pageTest
|
||||
Preinitialize Event
|
||||
vis p0,0
|
||||
|
||||
Variable (string) tInstruction
|
||||
Attributes
|
||||
ID : 16
|
||||
Scope : local
|
||||
Text :
|
||||
Max. Text Size: 30
|
||||
|
||||
Variable (string) strCommand
|
||||
Attributes
|
||||
ID : 17
|
||||
Scope : local
|
||||
Text :
|
||||
Max. Text Size: 20
|
||||
|
||||
Variable (string) tSend
|
||||
Attributes
|
||||
ID : 18
|
||||
Scope : local
|
||||
Text :
|
||||
Max. Text Size: 40
|
||||
|
||||
Text tBench
|
||||
Attributes
|
||||
ID : 15
|
||||
Scope : local
|
||||
Dragging : 0
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 288
|
||||
y coordinate : 90
|
||||
Width : 152
|
||||
Height : 30
|
||||
Effect : load
|
||||
Effect Priority : 0
|
||||
Effect Time : 300
|
||||
Fill : solid color
|
||||
Style : flat
|
||||
Associated Keyboard : none
|
||||
Font ID : 0
|
||||
Back. Color : 65535
|
||||
Font Color : 0
|
||||
Horizontal Alignment : center
|
||||
Vertical Alignment : center
|
||||
Input Type : character
|
||||
Text :
|
||||
Max. Text Size : 20
|
||||
Word wrap : disabled
|
||||
Horizontal Spacing : 0
|
||||
Vertical Spacing : 0
|
||||
|
||||
Picture p0
|
||||
Attributes
|
||||
ID : 1
|
||||
@@ -47,8 +98,8 @@ Button b0
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 5
|
||||
y coordinate : 12
|
||||
x coordinate : 0
|
||||
y coordinate : 0
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -119,8 +170,8 @@ Button b6
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 5
|
||||
y coordinate : 64
|
||||
x coordinate : 0
|
||||
y coordinate : 49
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -155,8 +206,8 @@ Button b4
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 7
|
||||
y coordinate : 120
|
||||
x coordinate : 0
|
||||
y coordinate : 96
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -191,8 +242,8 @@ Button b5
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 111
|
||||
y coordinate : 12
|
||||
x coordinate : 100
|
||||
y coordinate : 0
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -227,8 +278,8 @@ Button b7
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 113
|
||||
y coordinate : 72
|
||||
x coordinate : 100
|
||||
y coordinate : 49
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -300,8 +351,8 @@ Button b9
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 6
|
||||
y coordinate : 175
|
||||
x coordinate : 0
|
||||
y coordinate : 146
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -336,8 +387,8 @@ Button b10
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 115
|
||||
y coordinate : 128
|
||||
x coordinate : 100
|
||||
y coordinate : 98
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -372,8 +423,8 @@ Button b11
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 117
|
||||
y coordinate : 184
|
||||
x coordinate : 100
|
||||
y coordinate : 145
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -445,7 +496,7 @@ Button b2
|
||||
Send Component ID : disabled
|
||||
Opacity : 127
|
||||
x coordinate : 0
|
||||
y coordinate : 244
|
||||
y coordinate : 195
|
||||
Width : 100
|
||||
Height : 50
|
||||
Effect : load
|
||||
@@ -472,3 +523,83 @@ Button b2
|
||||
Touch Press Event
|
||||
page cardQR
|
||||
|
||||
Timer tmSerial
|
||||
Attributes
|
||||
ID : 14
|
||||
Scope : local
|
||||
Period (ms): 50
|
||||
Enabled : yes
|
||||
|
||||
Events
|
||||
Timer Event
|
||||
// data available
|
||||
if(usize>1)
|
||||
{
|
||||
bufferPos=0
|
||||
while(bufferPos<usize)
|
||||
{
|
||||
// check for 0x55 0xBB - Command Init Secuence
|
||||
if(u[bufferPos]==187&&u[bufferPos-1]==85)
|
||||
{
|
||||
//remove garbage at the start of the buffer if there's any to free buffer for command
|
||||
if(u[bufferPos]!=1)
|
||||
{
|
||||
udelete bufferPos-1
|
||||
}
|
||||
//instruction is now aligned with buffer, because we deleted garbage before instrcution
|
||||
//get length after init sequence (check if there are more than to bytes in buffer)
|
||||
if(3<usize)
|
||||
{
|
||||
// check if serial buffer has reached the announced length
|
||||
ucopy payloadLength,2,2,0
|
||||
// we are only checking payload length so we have to skip first 3 bytes (init+payload length) (-1 because of < instead of <=)
|
||||
payloadLength+=3
|
||||
// payload length does also not contain crc, so we are adding another 2 bytes for crc
|
||||
payloadLength+=2
|
||||
if(payloadLength<usize)
|
||||
{
|
||||
// calculate crc
|
||||
crcrest 1,0xFFFF
|
||||
// u[2] contains payload legth at 3rd pos in buffer, we are calculating crc from 3rd pos with number of bytes from payload length
|
||||
//crcputu 3,u[2]
|
||||
// u[2] cotnains payload length, we are calculating a crc over the whole message, so we have to add 3 to the length from u[2]
|
||||
crcputu 0,payloadLength-1
|
||||
// get recived crc to be able to compare it
|
||||
ucopy recvCrc,payloadLength-1,2,0
|
||||
// compare crc with recived value
|
||||
if(crcval==recvCrc)
|
||||
{
|
||||
// crc is okay
|
||||
// here is the location where acual code should be
|
||||
// write command to variable strCommand
|
||||
ucopy strCommand.txt,4,payloadLength-5,0
|
||||
// write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||
spstr strCommand.txt,tInstruction.txt,"~",0
|
||||
if(tInstruction.txt=="ping")
|
||||
{
|
||||
spstr strCommand.txt,tBench.txt,"~",0
|
||||
tSend.txt="pong,"+tBench.txt
|
||||
//send calc crc
|
||||
btlen tSend.txt,sys0
|
||||
crcrest 1,0xffff // reset CRC
|
||||
crcputh 55 bb
|
||||
crcputs sys0,2
|
||||
crcputs tSend.txt,0
|
||||
//send cmd
|
||||
printh 55 bb
|
||||
prints sys0,2
|
||||
prints tSend.txt,0
|
||||
prints crcval,2
|
||||
}
|
||||
// end of user code
|
||||
udelete payloadLength-1
|
||||
bufferPos=0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// next character
|
||||
bufferPos++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,34 @@ Page pageTest
|
||||
Preinitialize Event
|
||||
vis p0,0
|
||||
|
||||
Variable (string) tInstruction
|
||||
Attributes
|
||||
Scope : local
|
||||
Text :
|
||||
Max. Text Size: 30
|
||||
|
||||
Variable (string) strCommand
|
||||
Attributes
|
||||
Scope : local
|
||||
Text :
|
||||
Max. Text Size: 20
|
||||
|
||||
Variable (string) tSend
|
||||
Attributes
|
||||
Scope : local
|
||||
Text :
|
||||
Max. Text Size: 40
|
||||
|
||||
Text tBench
|
||||
Attributes
|
||||
Scope : local
|
||||
Dragging : 0
|
||||
Disable release event after dragging: 0
|
||||
Send Component ID : disabled
|
||||
Associated Keyboard : none
|
||||
Text :
|
||||
Max. Text Size : 20
|
||||
|
||||
Picture p0
|
||||
Attributes
|
||||
Scope : local
|
||||
@@ -190,3 +218,82 @@ Button b2
|
||||
Touch Press Event
|
||||
page cardQR
|
||||
|
||||
Timer tmSerial
|
||||
Attributes
|
||||
Scope : local
|
||||
Period (ms): 50
|
||||
Enabled : yes
|
||||
|
||||
Events
|
||||
Timer Event
|
||||
// data available
|
||||
if(usize>1)
|
||||
{
|
||||
bufferPos=0
|
||||
while(bufferPos<usize)
|
||||
{
|
||||
// check for 0x55 0xBB - Command Init Secuence
|
||||
if(u[bufferPos]==187&&u[bufferPos-1]==85)
|
||||
{
|
||||
//remove garbage at the start of the buffer if there's any to free buffer for command
|
||||
if(u[bufferPos]!=1)
|
||||
{
|
||||
udelete bufferPos-1
|
||||
}
|
||||
//instruction is now aligned with buffer, because we deleted garbage before instrcution
|
||||
//get length after init sequence (check if there are more than to bytes in buffer)
|
||||
if(3<usize)
|
||||
{
|
||||
// check if serial buffer has reached the announced length
|
||||
ucopy payloadLength,2,2,0
|
||||
// we are only checking payload length so we have to skip first 3 bytes (init+payload length) (-1 because of < instead of <=)
|
||||
payloadLength+=3
|
||||
// payload length does also not contain crc, so we are adding another 2 bytes for crc
|
||||
payloadLength+=2
|
||||
if(payloadLength<usize)
|
||||
{
|
||||
// calculate crc
|
||||
crcrest 1,0xFFFF
|
||||
// u[2] contains payload legth at 3rd pos in buffer, we are calculating crc from 3rd pos with number of bytes from payload length
|
||||
//crcputu 3,u[2]
|
||||
// u[2] cotnains payload length, we are calculating a crc over the whole message, so we have to add 3 to the length from u[2]
|
||||
crcputu 0,payloadLength-1
|
||||
// get recived crc to be able to compare it
|
||||
ucopy recvCrc,payloadLength-1,2,0
|
||||
// compare crc with recived value
|
||||
if(crcval==recvCrc)
|
||||
{
|
||||
// crc is okay
|
||||
// here is the location where acual code should be
|
||||
// write command to variable strCommand
|
||||
ucopy strCommand.txt,4,payloadLength-5,0
|
||||
// write instruction to tInstuction (debug output, but used as variable here, ui elements will be disabled by default)
|
||||
spstr strCommand.txt,tInstruction.txt,"~",0
|
||||
if(tInstruction.txt=="ping")
|
||||
{
|
||||
spstr strCommand.txt,tBench.txt,"~",0
|
||||
tSend.txt="pong,"+tBench.txt
|
||||
//send calc crc
|
||||
btlen tSend.txt,sys0
|
||||
crcrest 1,0xffff // reset CRC
|
||||
crcputh 55 bb
|
||||
crcputs sys0,2
|
||||
crcputs tSend.txt,0
|
||||
//send cmd
|
||||
printh 55 bb
|
||||
prints sys0,2
|
||||
prints tSend.txt,0
|
||||
prints crcval,2
|
||||
}
|
||||
// end of user code
|
||||
udelete payloadLength-1
|
||||
bufferPos=0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// next character
|
||||
bufferPos++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user