breaking change in message format, to support longer messages

This commit is contained in:
joBr99
2022-03-12 16:19:30 +01:00
parent a3cf4a4c1a
commit e5d913de70
18 changed files with 5753 additions and 4 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# don't add nextion2text
HMI/Nextion2Text.py

View File

@@ -14,7 +14,7 @@ See the following picture to get an Idea for the messages send and recived from
# Custom Protocol # Custom Protocol
``` ```
55 BB [payload length] [payload] [crc] [crc] 55 BB [payload length] [payload length] [payload] [crc] [crc]
``` ```
Payload length contains the number of bytes of the payload. Payload length contains the number of bytes of the payload.
@@ -27,7 +27,7 @@ Instead the commands are plain text commands with parameters.
## Example for valid Message ## Example for valid Message
This message has to be generated for the Message "1337" (1337 is not a valid command, this is just an example) This message has to be generated for the Message "1337" (1337 is not a valid command, this is just an example)
``` ```
55 BB 04 31 33 33 37 5F 5B 55 BB 04 00 31 33 33 37 5F 5B
``` ```
## Messages to Nextion Display ## Messages to Nextion Display
@@ -95,9 +95,9 @@ entityUpd,1,switch,switch.entityName,4,Switch1,0
### popupLight Page ### popupLight Page
entityUpdateDetail,*buttonState*,*sliderBrightnessPos*,*sliderColorTempPos* entityUpdateDetail,*buttonState*,*sliderBrightnessPos*,*sliderColorTempPos*,*colorMode*
entityUpdateDetail,1,100,78 entityUpdateDetail,1,100,78,enable
entityUpdateDetail,1,100,disable entityUpdateDetail,1,100,disable
@@ -107,6 +107,10 @@ entityUpdateDetail,*ignored*,*sliderPos*
entityUpdateDetail,1,77 entityUpdateDetail,1,77
### popupNotify Page
entityUpdateDetail,*tHeading*,*b1*,*b2*,*tText*
### cardThermo Page ### cardThermo Page
entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp* entityUpd,*internalNameEntiy*,*heading*,*currentTemp*,*destTemp*,*status*,*minTemp*,*maxTemp*,*stepTemp*
@@ -151,12 +155,20 @@ event,buttonPress,D,nameEntity,internalNameEntity,1,brightnessSlider,50
event,buttonPress,D,nameEntity,internalNameEntity,1,colorTempSlider,50 event,buttonPress,D,nameEntity,internalNameEntity,1,colorTempSlider,50
event,buttonPress,D,nameEntity,internalNameEntity,1,colorWheel,x|y
### popupShutter Page ### popupShutter Page
event,pageOpenDetail,popupShutter,internalNameEntity event,pageOpenDetail,popupShutter,internalNameEntity
event,buttonPress,D,nameEntity,internalNameEntity,1,positionSlider,50 event,buttonPress,D,nameEntity,internalNameEntity,1,positionSlider,50
### popupNotify Page
event,buttonPress,D,D,D,1,notifyAction,yes
event,buttonPress,D,D,D,1,notifyAction,no
### cardThermo Page ### cardThermo Page
event,pageOpen,0 event,pageOpen,0
@@ -173,6 +185,8 @@ event,buttonPress,1,tHeading,internalNameEntity,1,media-next
event,buttonPress,1,tHeading,internalNameEntity,1,volumeSlider,75 event,buttonPress,1,tHeading,internalNameEntity,1,volumeSlider,75
# Icons IDs # Icons IDs
ID | Icon ID | Icon

28
HMI/n2t-out/Program.s.txt Normal file
View File

@@ -0,0 +1,28 @@
Program.s
//The following code is only run once when power on, and is generally used for global variable definition and power on initialization data
int sys0=0,sys1=0,sys2=0 //At present, the definition of global variable only supports 4-byte signed integer (int), and other types of global quantity declaration are not supported. If you want to use string type, you can use variable control in the page to implement
int bufferPos=0
int recvCrc=0
int payloadLength=0
int par0=0,par1=0
// landsspace orientation x has 480px and y has 320px xy limits todo: adjust xy values to something that fit's resulution
//Maximum values in directional change for Swipes beeing detected as swipe (diagonal swipes are invalid) (for one axis at a time)
int xLimit=125,yLimit=125
int ixLimit=-125,iyLimit=-125
//Minimum values for swipes, directional changes below theese values are ignored, because they could be unintended swipes
int xLimitMin=80,yLimitMin=80
int ixLimitMin=-80,iyLimitMin=-80
// Swipe Result Vars
int ycR=0,xcR=0
// Start End Swipe Touch Locations
int yc1=0,xc1=0,yc2=0,xc2=0
// sleep timeout in s
int sleepTimeout=20
int sleepValue=0
// dim value
int dimValue=40
// current page
int nPage=0
// fix touch offset
lcd_dev fffb 0002 0000 0020
page pageStartup

1659
HMI/n2t-out/cardEntities.txt Normal file

File diff suppressed because it is too large Load Diff

538
HMI/n2t-out/cardMedia.txt Normal file
View File

@@ -0,0 +1,538 @@
Page cardMedia
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Events
Preinitialize Event
vis p0,0
vis tSend,0
vis tInstruction,0
vis nPageDisp,0
vis tTmp,0
vis tId,0
//vis nPageDisp,0
//page open event
// event,pageOpen,cardEntities,pageNumber
// craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,pageOpen,"+tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
//display current page from global var
nPageDisp.val=nPage
Variable (string) strCommand
Attributes
ID : 8
Scope : local
Text :
Max. Text Size: 200
Variable (string) entn
Attributes
ID : 19
Scope : local
Text :
Max. Text Size: 50
Number nPageDisp
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Text tSend
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tTmp
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 10
Text tInstruction
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tId
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tHeading
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 40
Text tTitle
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 50
Text tAuthor
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 50
Text t2
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : î’¬
Max. Text Size : 10
Events
Touch Press Event
// event,1,tHeading,tEntityName,1,up
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,media-next"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text tPlayPause
Attributes
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Events
Touch Press Event
// event,1,tHeading,tEntityName,1,up
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,media-pause"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text t0
Attributes
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : î’­
Max. Text Size : 10
Events
Touch Press Event
// event,1,tHeading,tEntityName,1,up
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,media-back"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Text tIcon
Attributes
ID : 18
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 10
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Slider hVolume
Attributes
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Position : 50
Upper range limit : 100
Lower range limit : 0
Events
Touch Release Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,positionSlider,50
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tHeading.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,volumeSlider,"
covx hVolume.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button bNext
Attributes
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
nPage=nPage+1
nPageDisp.val=nPage
//page open event
// event,pageOpen,cardEntities,pageNumber
// craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,pageOpen,"+tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button bPrev
Attributes
ID : 5
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
nPage=nPage-1
nPageDisp.val=nPage
//page open event
// event,pageOpen,cardEntities,pageNumber
// craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,pageOpen,"+tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Timer tmSerial
Attributes
ID : 7
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=="entityUpd")
{
//entity name
spstr strCommand.txt,entn.txt,"|",1
//heading
spstr strCommand.txt,tHeading.txt,"|",2
//icon
spstr strCommand.txt,tTmp.txt,"|",3
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,tIcon.txt,sys0,1
//title
spstr strCommand.txt,tTitle.txt,"|",4
//author
spstr strCommand.txt,tAuthor.txt,"|",5
//volume
spstr strCommand.txt,tTmp.txt,"|",6
covx tTmp.txt,sys0,0,0
hVolume.val=sys0
//icon
spstr strCommand.txt,tTmp.txt,"|",7
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,tPlayPause.txt,sys0,1
}
if(tInstruction.txt=="time")
{
// get set time to global variable
spstr strCommand.txt,screensaver.vaTime.txt,",",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,screensaver.vaDate.txt,"?",1
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,dimValue,0,0
dim=dimValue
}
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
if(tId.txt=="cardMedia")
{
//yay, we are already on the correct page
}else
{
//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 u[2]+3
bufferPos=0
}
if(tId.txt=="cardEntities")
{
page cardEntities
}
if(tId.txt=="cardThermo")
{
page cardThermo
}
if(tId.txt=="pageStartup")
{
page pageStartup
}
}
// end of user code
udelete payloadLength-1
bufferPos=0
}
}
}
}
// next character
bufferPos++
}
if(bufferPos==usize)
{
// copy whole buffer to t1.txt, for debugging
//ucopy t2.txt,0,usize,0
// ucopy n2.val,0,usize,0
// clear whole buffer
//code_c
//bufferPos=0
}
}
Timer tmSleep
Attributes
ID : 20
Scope : local
Period (ms): 1000
Enabled : yes
Events
Timer Event
if(sleepTimeout!=0)
{
sleepValue+=1
if(sleepTimeout<=sleepValue)
{
screensaver.originPage.val=dp
sleepValue=0
page screensaver
}
}
TouchCap tc0
Attributes
ID : 21
Scope: local
Value: 0
Events
Touch Press Event
sleepValue=0

567
HMI/n2t-out/cardThermo.txt Normal file
View File

@@ -0,0 +1,567 @@
Page cardThermo
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Events
Preinitialize Event
vis p0,0
vis tSend,0
vis tInstruction,0
vis tTmp,0
vis tId,0
vis nPageDisp,0
vis xTempMin,0
vis xTempMax,0
vis xTempStep,0
//tEntity.txt=tHeading.txt
//disable buttons that are not implemented
vis t7,0
vis t6,0
vis t5,0
//
//page open event
// event,pageOpen,cardThermo,pageNumber
// craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,pageOpen,"+tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
//display current page from global var
nPageDisp.val=nPage
Variable (string) strCommand
Attributes
ID : 8
Scope : local
Text :
Max. Text Size: 100
Variable (string) entn
Attributes
ID : 26
Scope : local
Text :
Max. Text Size: 50
Number nPageDisp
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
XFloat xTempCurr
Attributes
ID : 18
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 215
XFloat xTempDest
Attributes
ID : 20
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 215
XFloat xTempMin
Attributes
ID : 21
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
XFloat xTempMax
Attributes
ID : 22
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
XFloat xTempStep
Attributes
ID : 23
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Text tSend
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tTmp
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 10
Text tInstruction
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tId
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tHeading
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 40
Text tStatus
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Heizung
Max. Text Size : 10
Text t5
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Text t6
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Text t7
Attributes
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Text t2
Attributes
ID : 19
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Button bNext
Attributes
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
nPage=nPage+1
nPageDisp.val=nPage
//page open event
// event,pageOpen,cardEntities,pageNumber
// craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,pageOpen,"+tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button bPrev
Attributes
ID : 5
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
nPage=nPage-1
nPageDisp.val=nPage
//page open event
// event,pageOpen,cardEntities,pageNumber
// craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,pageOpen,"+tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button bDown
Attributes
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text :
Max. Text Size : 10
Events
Touch Press Event
if(xTempDest.val>xTempMin.val)
{
xTempDest.val=xTempDest.val-xTempStep.val
}
// temp chane event
// event,tempUpd,pageNumber,entityName,temperature
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,tempUpd,"+tTmp.txt+","
tSend.txt+=entn.txt+","
//convert temperature
covx xTempDest.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button bUp
Attributes
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text :
Max. Text Size : 10
Events
Touch Press Event
if(xTempDest.val<xTempMax.val)
{
xTempDest.val=xTempDest.val+xTempStep.val
}
// temp chane event
// event,tempUpd,pageNumber,entityName,temperature
//craft command
tSend.txt="event,tempUpd,"+tTmp.txt+","
tSend.txt+=entn.txt+","
//convert temperature
covx xTempDest.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Timer tmSerial
Attributes
ID : 7
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=="entityUpd")
{
//entity name
spstr strCommand.txt,entn.txt,",",1
//heading
spstr strCommand.txt,tHeading.txt,",",2
//currentTemp
spstr strCommand.txt,tTmp.txt,",",3
covx tTmp.txt,xTempCurr.val,0,0
//dstTemp
spstr strCommand.txt,tTmp.txt,",",4
covx tTmp.txt,xTempDest.val,0,0
//status
spstr strCommand.txt,tStatus.txt,",",5
//minTemp
spstr strCommand.txt,tTmp.txt,",",6
covx tTmp.txt,xTempMin.val,0,0
//maxTemp
spstr strCommand.txt,tTmp.txt,",",7
covx tTmp.txt,xTempMax.val,0,0
//tempStep
spstr strCommand.txt,tTmp.txt,",",8
covx tTmp.txt,xTempStep.val,0,0
}
if(tInstruction.txt=="time")
{
// get set time to global variable
spstr strCommand.txt,screensaver.vaTime.txt,",",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,screensaver.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
if(tId.txt=="cardThermo")
{
//yay, we are already on the correct page
}else
{
//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 u[2]+3
bufferPos=0
}
if(tId.txt=="popupLight")
{
pageIcons.tTmp1.txt=tTmp.txt
page popupLight
}
if(tId.txt=="cardEntities")
{
page cardEntities
}
if(tId.txt=="cardMedia")
{
page cardMedia
}
if(tId.txt=="pageStartup")
{
page pageStartup
}
}
// end of user code
udelete payloadLength-1
bufferPos=0
}
}
}
}
// next character
bufferPos++
}
if(bufferPos==usize)
{
// copy whole buffer to t1.txt, for debugging
//ucopy t2.txt,0,usize,0
// ucopy n2.val,0,usize,0
// clear whole buffer
//code_c
//bufferPos=0
}
}
Timer tmSleep
Attributes
ID : 24
Scope : local
Period (ms): 1000
Enabled : yes
Events
Timer Event
if(sleepTimeout!=0)
{
sleepValue+=1
if(sleepTimeout<=sleepValue)
{
screensaver.originPage.val=dp
sleepValue=0
page screensaver
}
}
TouchCap tc0
Attributes
ID : 25
Scope: local
Value: 0
Events
Touch Press Event
sleepValue=0

13
HMI/n2t-out/page0.txt Normal file
View File

@@ -0,0 +1,13 @@
Page page0
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled

65
HMI/n2t-out/pageIcons.txt Normal file
View File

@@ -0,0 +1,65 @@
Page pageIcons
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Text t0
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : tIcons contains all icons that can be used though serial (icon will be pulled from this textbox, first icon 0 and so on)
Max. Text Size : 400
Text tIcons
Attributes
ID : 3
Scope : global
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 100
Text tTmp1
Attributes
ID : 4
Scope : global
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 50
Text tTmp2
Attributes
ID : 5
Scope : global
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 50
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled

View File

@@ -0,0 +1,220 @@
Page pageSerialTest
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Events
Preinitialize Event
//vis p0,0
//recmod=1
//bauds=115200
Number nCrcRecv
Attributes
ID : 5
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nCrcCalc
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nIt
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nLength
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Text tStatus
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tCmd
Attributes
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 500
Text tBuffer
Attributes
ID : 7
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tDesc
Attributes
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : CRC Recv:\r\nCRC Calc:\r\n\r\nStatus\r\n\r\nCommand
Max. Text Size : 60
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Button b0
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : newtxt
Max. Text Size : 10
Events
Touch Press Event
recmod=0
page pageTest
Button b1
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : ON
Max. Text Size : 10
Events
Touch Press Event
recmod=1
bauds=115200
Timer tmSerial
Attributes
ID : 2
Scope : local
Period (ms): 400
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
}
tStatus.txt="init command detected"
//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
//payloadLength=u[2]
ucopy payloadLength,2,2,0
nLength.val=payloadLength
// 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)
{
tStatus.txt="reached"
// calculate crc
crcrest 1,0xFFFF
// payload length -1 to exclude crc
crcputu 0,payloadLength-1 //u[2]+3
// get recived crc to be able to compare it
ucopy recvCrc,payloadLength-1,2,0
nCrcRecv.val=recvCrc
// compare crc with recived value
if(crcval==recvCrc)
{
tStatus.txt="crc ok"
nIt.val=nIt.val+1
ucopy tCmd.txt,4,payloadLength-5,0
udelete payloadLength-1
bufferPos=0
// here is the location where acual code should be
}
// copy calculated crc and recived crc to nCrcRecv and nCrcCalc, for debugging
nCrcRecv.val=recvCrc
nCrcCalc.val=crcval
//ucopy nCrcCalc.val,u[2]+3,3,0
}
}
}
// next character
bufferPos++
}
if(bufferPos==usize)
{
// copy whole buffer to tCmd.txt, for debugging
//ucopy tBuffer.txt,0,usize,0
// ucopy nIt.val,0,usize,0
// clear whole buffer
//code_c
//bufferPos=0
}
}

375
HMI/n2t-out/pageStartup.txt Normal file
View File

@@ -0,0 +1,375 @@
Page pageStartup
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Events
Preinitialize Event
vis p0,0
recmod=1
bauds=115200
vis tSend,0
vis tInstruction,0
vis tTmp,0
vis tId,0
vis bSendStartup,0
vis frame_ptr,0
vis spinner_w,0
vis frapic_w,0
vis usual_cnt,0
vis tMsg2,0
vis tMsg3,0
vis tVersion,0
Postinitialize Event
//send messages by clicking button
click bSendStartup,1
Variable (string) strCommand
Attributes
ID : 5
Scope : local
Text :
Max. Text Size: 50
Number frame_ptr
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number spinner_w
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 140
Number frapic_w
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 1960
Number usual_cnt
Attributes
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Text tSend
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tTmp
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 10
Text tInstruction
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tId
Attributes
ID : 7
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tMsg1
Attributes
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Waiting for content ...
Max. Text Size : 40
Text tMsg2
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : This is taking longer than usual,
Max. Text Size : 100
Text tMsg3
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : please check your backend configuration
Max. Text Size : 100
Text tVersion
Attributes
ID : 18
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 2
Max. Text Size : 10
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Button bSendStartup
Attributes
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : startup
Max. Text Size : 10
Events
Touch Press Event
bauds=115200
// startup event
tSend.txt="event,startup,"+tVersion.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Hotspot mSpecial
Attributes
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Events
Touch Press Event
sys2=sys2+1
sys2%=10
//n0.val=sys2
if(sys2==9)
{
page pageTest
}
Timer tmSerial
Attributes
ID : 4
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=="time")
{
// get set time to global variable
spstr strCommand.txt,screensaver.vaTime.txt,",",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,screensaver.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
//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=="cardThermo")
{
page cardThermo
}
if(tId.txt=="popupLight")
{
pageIcons.tTmp1.txt=tTmp.txt
page popupLight
}
if(tId.txt=="cardEntities")
{
page cardEntities
}
if(tId.txt=="pageStartup")
{
page pageStartup
}
}
// end of user code
udelete payloadLength-1
bufferPos=0
}
}
}
}
// next character
bufferPos++
}
if(bufferPos==usize)
{
// copy whole buffer to t1.txt, for debugging
//ucopy t2.txt,0,usize,0
// ucopy n2.val,0,usize,0
// clear whole buffer
//code_c
//bufferPos=0
}
}
Timer tmSpinner
Attributes
ID : 9
Scope : local
Period (ms): 80
Enabled : yes
Events
Timer Event
xpic 154,49,spinner_w.val,140,frame_ptr.val,0,12 // draw the current frame
frame_ptr.val+=spinner_w.val%frapic_w.val // advance the pointer to the next frame in the pic resource and roll over at the end
doevents // finish drawing before next timer event triggers
if(frame_ptr.val==1820)
{
usual_cnt.val+=1
sys0=usual_cnt.val%5
if(sys0==0)
{
// retry sending startup messages by clicking button
click bSendStartup,1
}
}
if(usual_cnt.val==10)
{
vis tMsg2,1
vis tMsg3,1
}

View File

@@ -0,0 +1,283 @@
Page pageSwipeTest
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Number nXS
Attributes
ID : 7
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nYE
Attributes
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nYS
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nXE
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nYR
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Number nXR
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Text tDesc1
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : X-Start:\r\nX-End:\r\nY-Start:\r\nY-End:
Max. Text Size : 70
Text t2
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Swipe Dir\r\nold:
Max. Text Size : 70
Text tDirection
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 10
Text t0
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Difference\r\n\r\nX\r\nY
Max. Text Size : 60
Text tStatusNew
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 40
Text t3
Attributes
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : new status:\r\nnew direction:
Max. Text Size : 50
Text tDirNew
Attributes
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 40
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Button b8
Attributes
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : back
Max. Text Size : 10
Events
Touch Press Event
page pageTest
Timer tm0
Attributes
ID : 5
Scope : local
Period (ms): 50
Enabled : yes
Events
Timer Event
if(tc0.val!=0)
{
xc2=tch0
yc2=tch1
//debug
nXE.val=xc2
nYE.val=yc2
}
TouchCap tc0
Attributes
ID : 4
Scope: local
Value: 0
Events
Touch Press Event
if(tc0.val==9) // This is the location of the brightness slider
{
xc1=0
yc1=0
}else
{
xc1=tch0
yc1=tch1
//debug
nXS.val=xc1
nYS.val=yc1
tm0.en=1
}
Touch Release Event
tm0.en=0
if(tc0.val==9) // This is the location of the brightness slider
{
}else
{
if(tch0==0)
// When this is zero we can interpret that as the real end of the drag event
{
xcR=xc1-xc2
ycR=yc1-yc2
// //debug
// nXR.val=xcR
// nYR.val=ycR
// if(xcR>125)
// {
// tDirection.txt="left"
// }else if(xcR<-125)
// {
// tDirection.txt="right"
// }else if(ycR>125)
// {
// tDirection.txt="up"
// }else if(ycR<-125)
// {
// tDirection.txt="down"
// }else
// {
// tDirection.txt="invalid"
// }
// new method
// one of the difference values should be low to be a valid direction, in case it has a high value it's not a valid swipe, because it's diagonal
// x difference between -125 and 125 (swipe on y-axis)
if(xcR>ixLimit&&xcR<xLimit)
{
tStatusNew.txt="x low, -> y"
// check if below minimum value (change is negative)
if(ycR<iyLimitMin)
{
tDirNew.txt="down"
}else if(ycR>yLimitMin)
{
tDirNew.txt="up"
}else
{
tDirNew.txt="invalid"
}
// y difference between -125 and 125 (swipe on x-axis)
}else if(ycR>iyLimit&&ycR<yLimit)
{
tStatusNew.txt="y low, -> x"
if(xcR<ixLimitMin)
{
tDirNew.txt="right"
}else if(xcR>xLimitMin)
{
tDirNew.txt="left"
}else
{
tDirNew.txt="invalid"
}
//diagonal swipe invalid
}else
{
tStatusNew.txt="invalid"
tDirNew.txt="diagonal"
}
}
}

176
HMI/n2t-out/pageTest.txt Normal file
View File

@@ -0,0 +1,176 @@
Page pageTest
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Events
Preinitialize Event
vis p0,0
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Button b0
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : entities
Max. Text Size : 10
Events
Touch Press Event
page cardEntities
Button b1
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : serial
Max. Text Size : 10
Events
Touch Press Event
page pageSerialTest
Button b2
Attributes
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : swipe
Max. Text Size : 10
Events
Touch Press Event
page pageSwipeTest
Button b3
Attributes
ID : 5
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : disable recmod
Max. Text Size : 20
Events
Touch Press Event
recmod=0
Button b6
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : shutter
Max. Text Size : 10
Events
Touch Press Event
page popupShutter
Button b4
Attributes
ID : 7
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : light
Max. Text Size : 10
Events
Touch Press Event
page popupLight
Button b5
Attributes
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : thermo
Max. Text Size : 10
Events
Touch Press Event
page cardThermo
Button b7
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : media
Max. Text Size : 10
Events
Touch Press Event
page cardMedia
Button b8
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : screens
Max. Text Size : 10
Events
Touch Press Event
dimValue=50
page screensaver
Button b9
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : notify
Max. Text Size : 10
Events
Touch Press Event
page popupNotify

625
HMI/n2t-out/popupLight.txt Normal file
View File

@@ -0,0 +1,625 @@
Page popupLight
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
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 tItem,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,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
//disable brightness by default
vis t1,0
vis t2,0
vis hBrightness,0
//disable color temp by default
vis t4,0
vis t3,0
vis hTempSlider,0
//disable color wheel components by default
vis bColor,0
vis pColorWheel,0
vis t0,0
Variable (string) strCommand
Attributes
ID : 17
Scope : local
Text :
Max. Text Size: 50
Variable (string) entn
Attributes
ID : 21
Scope : local
Text : newtxt
Max. Text Size: 50
Variable (int32) mode
Attributes
ID : 23
Scope: local
Value: 0
Variable (int32) mode_bright
Attributes
ID : 24
Scope: local
Value: 0
Variable (int32) mode_temp
Attributes
ID : 25
Scope: local
Value: 0
Text tEntity
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : tEntity1
Max. Text Size : 25
Text tIcon1
Attributes
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Text t1
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Brightness
Max. Text Size : 15
Text t2
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Text t3
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 
Max. Text Size : 10
Text t4
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Temperature
Max. Text Size : 15
Text tSend
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tTmp
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 10
Text tInstruction
Attributes
ID : 18
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tItem
Attributes
ID : 19
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text t0
Attributes
ID : 26
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Color
Max. Text Size : 15
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Picture pColorWheel
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Events
Touch Press Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,brightnessSlider,50
//craft command
tSend.txt="event,buttonPress,D,"
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,colorWheel,"
sys0=tch0
sys0=sys0-pColorWheel.x
covx sys0,tTmp.txt,0,0
tSend.txt+=tTmp.txt
tSend.txt+="|"
sys0=tch1
sys0=sys0-pColorWheel.y
covx sys0,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Slider hBrightness
Attributes
ID : 7
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Position : 50
Upper range limit : 100
Lower range limit : 0
Events
Touch Press Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,brightnessSlider,50
//craft command
tSend.txt="event,buttonPress,D,"
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,brightnessSlider,"
covx hBrightness.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Touch Release Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,brightnessSlider,50
//craft command
tSend.txt="event,buttonPress,D,"
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,brightnessSlider,"
covx hBrightness.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Slider hTempSlider
Attributes
ID : 20
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Position : 50
Upper range limit : 100
Lower range limit : 0
Events
Touch Press Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,colorTempSlider,50
//craft command
tSend.txt="event,buttonPress,D,"
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,colorTempSlider,"
covx hTempSlider.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Touch Release Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,colorTempSlider,50
//craft command
tSend.txt="event,buttonPress,D,"
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,colorTempSlider,"
covx hTempSlider.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button b0
Attributes
ID : 5
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : î…•
Max. Text Size : 10
Events
Touch Press Event
page cardEntities
Button bColor
Attributes
ID : 22
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
if(mode.val==0)
{
mode.val=1
vis pColorWheel,1
vis t0,1
//disable brightness
vis t1,0
vis t2,0
vis hBrightness,0
//disable color temp
vis t4,0
vis t3,0
vis hTempSlider,0
}else
{
mode.val=0
vis pColorWheel,0
vis t0,0
if(mode_bright.val==1)
{
//enable brightness
vis t1,1
vis t2,1
vis hBrightness,1
}
if(mode_temp.val==1)
{
//enable color temp
vis t4,1
vis t3,1
vis hTempSlider,1
}
}
Dual-state Button btOnOff1
Attributes
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text :
Max. Text Size : 10
Events
Touch Press Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,OnOff,1
//craft command
tSend.txt="event,buttonPress,D,"
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,OnOff,"
covx btOnOff1.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Timer tmSleep
Attributes
ID : 15
Scope : local
Period (ms): 1000
Enabled : yes
Events
Timer Event
if(sleepTimeout!=0)
{
sleepValue+=1
if(sleepTimeout<=sleepValue)
{
screensaver.originPage.val=dp
sleepValue=0
page cardEntities
}
}
Timer tmSerial
Attributes
ID : 16
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=="entityUpdateDetail")
{
// get Button State
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sys0,0,0
btOnOff1.val=sys0
// get Brightness value
spstr strCommand.txt,tTmp.txt,",",2
if(tTmp.txt=="disable")
{
vis t4,0
vis t3,0
vis hBrightness,0
mode_bright.val=0
}else
{
vis t1,1
vis t2,1
vis hBrightness,1
mode_bright.val=1
hBrightness.val=sys0
}
// get ColorTemp value
spstr strCommand.txt,tTmp.txt,",",3
if(tTmp.txt=="disable")
{
vis t4,0
vis t3,0
vis hTempSlider,0
mode_temp.val=0
}else
{
vis t4,1
vis t3,1
vis hTempSlider,1
mode_temp.val=1
covx tTmp.txt,sys0,0,0
hTempSlider.val=sys0
}
// get ColorWheel value
spstr strCommand.txt,tTmp.txt,",",4
if(tTmp.txt=="enable")
{
vis bColor,1
}
}
if(tInstruction.txt=="time")
{
// get set time to global variable
spstr strCommand.txt,screensaver.vaTime.txt,",",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,screensaver.vaDate.txt,"?",1
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,dimValue,0,0
dim=dimValue
}
if(tInstruction.txt=="timeout")
{
//set timeout to global var
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sleepTimeout,0,0
}
// end of user code
udelete payloadLength-1
bufferPos=0
}
}
}
}
// next character
bufferPos++
}
if(bufferPos==usize)
{
// copy whole buffer to t1.txt, for debugging
//ucopy t2.txt,0,usize,0
// ucopy n2.val,0,usize,0
// clear whole buffer
//code_c
//bufferPos=0
}
}
TouchCap tc0
Attributes
ID : 14
Scope: local
Value: 0
Events
Touch Press Event
sleepValue=0

323
HMI/n2t-out/popupNotify.txt Normal file
View File

@@ -0,0 +1,323 @@
Page popupNotify
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Events
Preinitialize Event
vis p0,0
vis tSend,0
vis tTmp,0
vis tInstruction,0
vis tItem,0
//page open event
// event,pageOpenDetail,typeOfPage,tEntityName
// craft command
tSend.txt="event,pageOpenDetail,notify"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Variable (string) strCommand
Attributes
ID : 8
Scope : local
Text :
Max. Text Size: 500
Text tSend
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tTmp
Attributes
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 10
Text tInstruction
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tItem
Attributes
ID : 10
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tHeading
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 40
Text tText
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 300
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Button b0
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : î…•
Max. Text Size : 10
Events
Touch Press Event
page cardEntities
Button b2
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text :
Max. Text Size : 10
Events
Touch Press Event
//craft command
tSend.txt="event,buttonPress,D,D,D,1,notifyAction,yes"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button b1
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text :
Max. Text Size : 10
Events
Touch Press Event
//craft command
tSend.txt="event,buttonPress,D,D,D,1,notifyAction,no"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Timer tmSleep
Attributes
ID : 6
Scope : local
Period (ms): 1000
Enabled : yes
Events
Timer Event
if(sleepTimeout!=0)
{
sleepValue+=1
if(sleepTimeout<=sleepValue)
{
screensaver.originPage.val=dp
sleepValue=0
page cardEntities
}
}
Timer tmSerial
Attributes
ID : 7
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=="entityUpdateDetail")
{
// get Heading
spstr strCommand.txt,tHeading.txt,",",1
// get b1
spstr strCommand.txt,b1.txt,",",2
// get b2
spstr strCommand.txt,b2.txt,",",3
// get tText
spstr strCommand.txt,tText.txt,",",4
}
if(tInstruction.txt=="time")
{
// get set time to global variable
spstr strCommand.txt,screensaver.vaTime.txt,",",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,screensaver.vaDate.txt,"?",1
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,dimValue,0,0
dim=dimValue
}
if(tInstruction.txt=="timeout")
{
//set timeout to global var
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sleepTimeout,0,0
}
// end of user code
udelete payloadLength-1
bufferPos=0
}
}
}
}
// next character
bufferPos++
}
if(bufferPos==usize)
{
// copy whole buffer to t1.txt, for debugging
//ucopy t2.txt,0,usize,0
// ucopy n2.val,0,usize,0
// clear whole buffer
//code_c
//bufferPos=0
}
}
TouchCap tc0
Attributes
ID : 5
Scope: local
Value: 0
Events
Touch Press Event
sleepValue=0

View File

@@ -0,0 +1,419 @@
Page popupShutter
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
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 tItem,0
//page open event
// event,pageOpenDetail,typeOfPage,tEntityName
// craft command
tSend.txt="event,pageOpenDetail,popupShutter,"+entn.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Variable (string) strCommand
Attributes
ID : 10
Scope : local
Text :
Max. Text Size: 50
Variable (string) entn
Attributes
ID : 18
Scope : local
Text : newtxt
Max. Text Size: 50
Text tEntity
Attributes
ID : 2
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : tEntity1
Max. Text Size : 25
Text tIcon1
Attributes
ID : 3
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : î–°
Max. Text Size : 10
Text tSend
Attributes
ID : 5
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : newtxt
Max. Text Size : 100
Text tTmp
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 10
Text tInstruction
Attributes
ID : 11
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tItem
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text t1
Attributes
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Position
Max. Text Size : 15
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Slider hPosition
Attributes
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Position : 50
Upper range limit : 100
Lower range limit : 0
Events
Touch Release Event
// event,buttonPress,D,nameEntity,internalNameEntity,1,positionSlider,50
//craft command
tSend.txt="event,buttonPress,D,"
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,positionSlider,"
covx hPosition.val,tTmp.txt,0,0
tSend.txt+=tTmp.txt
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button b0
Attributes
ID : 4
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : î…•
Max. Text Size : 10
Events
Touch Press Event
page cardEntities
Button bDown1
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
// event,1,tHeading,tEntityName,1,up
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,down"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button bStop1
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
// event,1,tHeading,tEntityName,1,up
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,stop"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Button bUp1
Attributes
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
State : unpressed
Text : 
Max. Text Size : 10
Events
Touch Press Event
// event,1,tHeading,tEntityName,1,up
//craft command
// convert pageNumber and write to tTmp
covx nPage,tTmp.txt,0,0
tSend.txt="event,buttonPress,"+tTmp.txt+","
tSend.txt+=tEntity.txt+","
tSend.txt+=entn.txt+","
tSend.txt+="1,up"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
Timer tmSleep
Attributes
ID : 8
Scope : local
Period (ms): 1000
Enabled : yes
Events
Timer Event
if(sleepTimeout!=0)
{
sleepValue+=1
if(sleepTimeout<=sleepValue)
{
screensaver.originPage.val=dp
sleepValue=0
page cardEntities
}
}
Timer tmSerial
Attributes
ID : 9
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=="entityUpdateDetail")
{
// get Position value
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sys0,0,0
hPosition.val=sys0
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,dimValue,0,0
dim=dimValue
}
if(tInstruction.txt=="time")
{
// get set time to global variable
spstr strCommand.txt,screensaver.vaTime.txt,",",1
}
if(tInstruction.txt=="date")
{
// get set date to global variable
spstr strCommand.txt,screensaver.vaDate.txt,"?",1
}
if(tInstruction.txt=="timeout")
{
//set timeout to global var
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sleepTimeout,0,0
}
// end of user code
udelete payloadLength-1
bufferPos=0
}
}
}
}
// next character
bufferPos++
}
if(bufferPos==usize)
{
// copy whole buffer to t1.txt, for debugging
//ucopy t2.txt,0,usize,0
// ucopy n2.val,0,usize,0
// clear whole buffer
//code_c
//bufferPos=0
}
}
TouchCap tc0
Attributes
ID : 7
Scope: local
Value: 0
Events
Touch Press Event
sleepValue=0

442
HMI/n2t-out/screensaver.txt Normal file
View File

@@ -0,0 +1,442 @@
Page screensaver
Attributes
ID : 0
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Locked : no
Swide up page ID : disabled
Swide down page ID : disabled
Swide left page ID : disabled
Swide right page ID : disabled
Events
Preinitialize Event
recmod=1
bauds=115200
vis originPage,0
vis tInstruction,0
vis tTmp,0
vis p0,0
//load gloabl time string from pageIcons
tTime.txt=vaTime.txt
tDate.txt=vaDate.txt
dim=dimValue
vis tSend,0
//page open event
// craft command
tSend.txt="event,screensaverOpen"
//send calc crc
btlen tSend.txt,sys0
crcrest 1,0xffff // reset CRC
crcputh 55 bb
crcputs sys0,1
crcputs tSend.txt,0
//send cmd
printh 55 bb
prints sys0,2
prints tSend.txt,0
prints crcval,2
// clear weather elements, to keep example content in HMI
tMainIcon.txt=""
tMainText.txt=""
tMRIcon.txt=""
tMR.txt=""
tForecast1.txt=""
tF1Icon.txt=""
tForecast1Val.txt=""
tForecast2.txt=""
tF2Icon.txt=""
tForecast2Val.txt=""
Variable (string) strCommand
Attributes
ID : 5
Scope : local
Text :
Max. Text Size: 100
Variable (string) vaTime
Attributes
ID : 10
Scope : global
Text :
Max. Text Size: 10
Variable (string) vaDate
Attributes
ID : 11
Scope : global
Text :
Max. Text Size: 30
Variable (string) tId
Attributes
ID : 24
Scope : local
Text :
Max. Text Size: 25
Number originPage
Attributes
ID : 3
Scope : global
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Value : 0
Text tInstruction
Attributes
ID : 6
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tTmp
Attributes
ID : 7
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 20
Text tTime
Attributes
ID : 8
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 21:32
Max. Text Size : 10
Text tDate
Attributes
ID : 9
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Tuesday, 08. March 2022
Max. Text Size : 30
Text tSend
Attributes
ID : 12
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text :
Max. Text Size : 25
Text tMainIcon
Attributes
ID : 13
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : î–˜
Max. Text Size : 10
Text tMainText
Attributes
ID : 14
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 2,3 °C
Max. Text Size : 10
Text tMRIcon
Attributes
ID : 15
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : î––
Max. Text Size : 10
Text tMR
Attributes
ID : 16
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 0 mm
Max. Text Size : 10
Text tForecast1
Attributes
ID : 17
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Mi
Max. Text Size : 10
Text tForecast1Val
Attributes
ID : 18
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 9,3 °C
Max. Text Size : 10
Text tF1Icon
Attributes
ID : 19
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : î–˜
Max. Text Size : 10
Text tForecast2
Attributes
ID : 20
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : Do
Max. Text Size : 10
Text tF2Icon
Attributes
ID : 21
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : î–˜
Max. Text Size : 10
Text tForecast2Val
Attributes
ID : 22
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : 11,9 °C
Max. Text Size : 10
Text t10
Attributes
ID : 23
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Associated Keyboard : none
Text : |
Max. Text Size : 10
Picture p0
Attributes
ID : 1
Scope : local
Dragging : 0
Disable release event after dragging: 0
Send Component ID : disabled
Timer tmSerial
Attributes
ID : 4
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=="wake")
{
dim=100
page originPage.val
}
if(tInstruction.txt=="dimmode")
{
// get value
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,dimValue,0,0
dim=dimValue
}
if(tInstruction.txt=="time")
{
//get set time to global variable
spstr strCommand.txt,vaTime.txt,",",1
tTime.txt=vaTime.txt
}
if(tInstruction.txt=="date")
{
//get set date to global variable
spstr strCommand.txt,vaDate.txt,"?",1
tDate.txt=vaDate.txt
}
if(tInstruction.txt=="timeout")
{
//set timeout to global var
spstr strCommand.txt,tTmp.txt,",",1
covx tTmp.txt,sleepTimeout,0,0
}
if(tInstruction.txt=="weatherUpdate")
{
//tMainIcon
spstr strCommand.txt,tTmp.txt,"?",1
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,tMainIcon.txt,sys0,1
//tMainText
spstr strCommand.txt,tMainText.txt,"?",2
//tMRIcon
spstr strCommand.txt,tTmp.txt,"?",3
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,tMRIcon.txt,sys0,1
//tMR
spstr strCommand.txt,tMR.txt,"?",4
//tForecast1
spstr strCommand.txt,tForecast1.txt,"?",5
//tF1Icon
spstr strCommand.txt,tTmp.txt,"?",6
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,tF1Icon.txt,sys0,1
//tForecast1Val
spstr strCommand.txt,tForecast1Val.txt,"?",7
//tForecast2
spstr strCommand.txt,tForecast2.txt,"?",8
//tF2Icon
spstr strCommand.txt,tTmp.txt,"?",9
covx tTmp.txt,sys0,0,0
substr pageIcons.tIcons.txt,tF2Icon.txt,sys0,1
//tForecast2Val
spstr strCommand.txt,tForecast2Val.txt,"?",10
}
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
//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 u[2]+3
bufferPos=0
if(tId.txt=="popupLight")
{
pageIcons.tTmp1.txt=tTmp.txt
page popupLight
}
if(tId.txt=="pageStartup")
{
page pageStartup
}
if(tId.txt=="cardThermo")
{
page cardThermo
}
if(tId.txt=="cardMedia")
{
page cardMedia
}
if(tId.txt=="pageStartup")
{
page pageStartup
}
}
// end of user code
udelete payloadLength-1
bufferPos=0
}
}
}
}
// next character
bufferPos++
}
}
TouchCap tc0
Attributes
ID : 2
Scope: local
Value: 0
Events
Touch Press Event
dim=100
page originPage.val

Binary file not shown.

Binary file not shown.