Merge branch 'main' of https://github.com/joBr99/nspanel-lovelace-ui (add nextion2text)

This commit is contained in:
joBr99
2022-05-21 14:48:42 +00:00
committed by github-actions[bot]
parent 6067e5db7c
commit ec37cbced3
10 changed files with 131 additions and 1139 deletions

View File

@@ -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-05-21 14:37:10.876301404 +0000
+++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-21 14:37:11.312302066 +0000
--- HMI/n2t-out/Program.s.txt 2022-05-21 14:48:41.110663520 +0000
+++ HMI/US/portrait/n2t-out/Program.s.txt 2022-05-21 14:48:41.554666346 +0000
@@ -11,6 +11,6 @@
// dim value
int dimValue=40
@@ -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-05-21 14:37:10.880301410 +0000
+++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-21 14:37:11.316302072 +0000
--- HMI/n2t-out/cardEntities.txt 2022-05-21 14:48:41.114663546 +0000
+++ HMI/US/portrait/n2t-out/cardEntities.txt 2022-05-21 14:48:41.554666346 +0000
@@ -62,6 +62,16 @@
vis bText4,0
vis hSlider4,0
@@ -449,8 +449,8 @@ diff -bur HMI/n2t-out/cardEntities.txt HMI/US/portrait/n2t-out/cardEntities.txt
if(tInstruction.txt=="pageType")
{
diff -bur HMI/n2t-out/cardQR.txt HMI/US/portrait/n2t-out/cardQR.txt
--- HMI/n2t-out/cardQR.txt 2022-05-21 14:37:10.880301410 +0000
+++ HMI/US/portrait/n2t-out/cardQR.txt 2022-05-21 14:37:11.316302072 +0000
--- HMI/n2t-out/cardQR.txt 2022-05-21 14:48:41.110663520 +0000
+++ HMI/US/portrait/n2t-out/cardQR.txt 2022-05-21 14:48:41.554666346 +0000
@@ -137,7 +137,7 @@
Disable release event after dragging: 0
Send Component ID : disabled
@@ -470,8 +470,8 @@ diff -bur HMI/n2t-out/cardQR.txt HMI/US/portrait/n2t-out/cardQR.txt
Button bNext
diff -bur HMI/n2t-out/pageStartup.txt HMI/US/portrait/n2t-out/pageStartup.txt
--- HMI/n2t-out/pageStartup.txt 2022-05-21 14:37:10.880301410 +0000
+++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-21 14:37:11.312302066 +0000
--- HMI/n2t-out/pageStartup.txt 2022-05-21 14:48:41.110663520 +0000
+++ HMI/US/portrait/n2t-out/pageStartup.txt 2022-05-21 14:48:41.554666346 +0000
@@ -142,7 +142,7 @@
Disable release event after dragging: 0
Send Component ID : disabled
@@ -490,318 +490,3 @@ 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
@@ -330,10 +330,6 @@
{
page cardAlarm
}
- if(tId.txt=="cardQR")
- {
- page cardQR
- }
}
// end of user code
udelete payloadLength-1
diff -bur HMI/n2t-out/popupLight.txt HMI/US/portrait/n2t-out/popupLight.txt
--- HMI/n2t-out/popupLight.txt 2022-05-21 14:37:10.880301410 +0000
+++ HMI/US/portrait/n2t-out/popupLight.txt 2022-05-21 14:37:11.312302066 +0000
@@ -12,43 +12,244 @@
Events
Preinitialize Event
- //get entitiy name
- tEntity.txt=pageIcons.tTmp1.txt
- //get entity id
- entn.txt=pageIcons.tTmp2.txt
- vis p0,0
- vis tSend,0
- vis tTmp,0
- vis tInstruction,0
- vis tId,0
- //page open event
- // event,pageOpenDetail,typeOfPage,tEntityName
- // craft command
- tSend.txt="event,pageOpenDetail,popupLight,"+entn.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
- //disable brightness by default
+ // 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=="entityUpdateDetail")
+ {
+ // change icon
+ spstr strCommand.txt,tIcon1.txt,"~",1
+ vis tIcon1,1
+ // change icon color
+ spstr strCommand.txt,tTmp.txt,"~",2
+ covx tTmp.txt,sys0,0,0
+ tIcon1.pco=sys0
+ // get Button State
+ spstr strCommand.txt,tTmp.txt,"~",3
+ covx tTmp.txt,sys0,0,0
+ btOnOff1.val=sys0
+ // get Brightness value
+ spstr strCommand.txt,tTmp.txt,"~",4
+ if(tTmp.txt=="disable")
+ {
vis t1,0
vis t2,0
vis hBrightness,0
- //disable color temp by default
- vis t4,0
- vis t3,0
+ }else
+ {
+ vis t1,1
+ vis t2,1
+ vis hBrightness,1
+ covx tTmp.txt,sys0,0,0
+ if(tmCooldown.en==0)
+ {
+ hBrightness.val=sys0
+ }
+ }
+ // get ColorTemp value
+ spstr strCommand.txt,tTmp.txt,"~",5
+ if(tTmp.txt=="disable")
+ {
vis hTempSlider,0
- //disable color wheel components by default
- vis bColor,0
+ vis t3,0
+ vis t4,0
+ mode_temp.val=0
+ // mode == 1 is temp controls currently shown
+ if(mode.val==1)
+ {
+ // switch mode
+ click bColor,1
+ click bColor,0
+ }
+ }else if(tTmp.txt=="unknown") // temp supported, but not in color mode
+ {
+ mode_temp.val=1
+ // mode == 1 is temp controls currently shown
+ if(mode.val==1)
+ {
+ // switch mode
+ click bColor,1
+ click bColor,0
+ }
+ }else
+ {
+ mode_temp.val=1
+ vis hTempSlider,1
+ vis t3,1
+ vis t4,1
+ if(tmCooldown.en==0)
+ {
+ covx tTmp.txt,sys0,0,0
+ hTempSlider.val=sys0
+ }
+ // mode == 0 is rgb controls currently shown
+ if(mode.val==0)
+ {
+ // switch mode
+ click bColor,1
+ click bColor,0
+ }
+ }
+ // get Color value
+ spstr strCommand.txt,tTmp.txt,"~",6
+ // disable -> isn't supported
+ if(tTmp.txt=="disable")
+ {
vis t0,0
+ vis bColor,0
vis pColorWheel,0
- //vis t0,0
+ }else
+ {
+ vis t0,1
+ //only enable bColor button if color temp is also supported
+ if(mode_temp.val==1)
+ {
+ vis bColor,1
+ }
+ if(mode.val==0)
+ {
+ vis pColorWheel,1
+ }
+ }
+ // set t0 Color (Localization)
+ spstr strCommand.txt,t0.txt,"~",7
+ // set t4 Temperature (Localization)
+ spstr strCommand.txt,t4.txt,"~",8
+ // set t1 Brightness (Localization)
+ spstr strCommand.txt,t1.txt,"~",9
+ }
+ if(tInstruction.txt=="time")
+ {
+ // get set time to global variable
+ spstr strCommand.txt,pageIcons.vaTime.txt,"~",1
+ }
+ if(tInstruction.txt=="date")
+ {
+ // get set date to global variable
+ spstr strCommand.txt,pageIcons.vaDate.txt,"~",1
+ }
+ if(tInstruction.txt=="dimmode")
+ {
+ // get value
+ spstr strCommand.txt,tTmp.txt,"~",1
+ covx tTmp.txt,dimValue,0,0
+ }
+ if(tInstruction.txt=="timeout")
+ {
+ //set timeout to global var
+ spstr strCommand.txt,tTmp.txt,"~",1
+ covx tTmp.txt,sleepTimeout,0,0
+ }
+ if(tInstruction.txt=="pageType")
+ {
+ //command format pageType,specialPageName
+ //write name of speical page to tId
+ spstr strCommand.txt,tId.txt,"~",1
+ //save second arg if there's one
+ spstr strCommand.txt,tTmp.txt,"~",2
+ //save third arg if there's one
+ spstr strCommand.txt,pageIcons.tTmp2.txt,"~",3
+ //we are going to exit this page with this command, so we have to clear the buffer, so we are not getting into a stupid loop ...
+ udelete payloadLength-1
+ bufferPos=0
+ if(tId.txt=="pageStartup")
+ {
+ page pageStartup
+ }
+ if(tId.txt=="screensaver")
+ {
+ page screensaver
+ }
+ if(tId.txt=="cardEntities")
+ {
+ page cardEntities
+ }
+ if(tId.txt=="cardGrid")
+ {
+ page cardGrid
+ }
+ if(tId.txt=="popupLight")
+ {
+ pageIcons.tTmp1.txt=tTmp.txt
+ page popupLight
+ }
+ if(tId.txt=="popupShutter")
+ {
+ pageIcons.tTmp1.txt=tTmp.txt
+ page popupShutter
+ }
+ if(tId.txt=="popupNotify")
+ {
+ page popupNotify
+ }
+ if(tId.txt=="cardThermo")
+ {
+ page cardThermo
+ }
+ if(tId.txt=="cardMedia")
+ {
+ page cardMedia
+ }
+ if(tId.txt=="cardAlarm")
+ {
+ page cardAlarm
+ }
+ if(tId.txt=="cardQR")
+ {
+ page cardQR
+ }
+ }
+ // end of user code
+ udelete payloadLength-1
+ bufferPos=0
+ }
+ }
+ }
+ }
+ // next character
+ bufferPos++
+ }
+ }
Variable (string) strCommand
Attributes
@@ -618,10 +819,6 @@
{
page cardAlarm
}
- if(tId.txt=="cardQR")
- {
- page cardQR
- }
}
// end of user code
udelete payloadLength-1
diff -bur HMI/n2t-out/screensaver.txt HMI/US/portrait/n2t-out/screensaver.txt
--- HMI/n2t-out/screensaver.txt 2022-05-21 14:37:10.880301410 +0000
+++ HMI/US/portrait/n2t-out/screensaver.txt 2022-05-21 14:37:11.316302072 +0000
@@ -607,10 +607,6 @@
{
page cardAlarm
}
- if(tId.txt=="cardQR")
- {
- page cardQR
- }
}
// end of user code
udelete payloadLength-1