start reworking navigation paramters (#644)

* modify cardGrid/cardEntities nav

* rework backend nav for new style

* fix some bugs

* update other pages with new nav paramters

* readd readme part
This commit is contained in:
joBr99
2022-12-28 20:00:44 +01:00
committed by GitHub
parent ff792a0bb3
commit f0c5b5b429
16 changed files with 2567 additions and 278 deletions

View File

@@ -6,8 +6,8 @@ head = sharedhead + """
spstr strCommand.txt,tHeading.txt,"~",1
""" + navigation
print(head)
start = 3
for i in range(1,7):
start = 14
for i in range(1,5):
idxstart = start + (i-1)*6
item = f"""
// get Type

View File

@@ -6,7 +6,7 @@ head = sharedhead + """
spstr strCommand.txt,tHeading.txt,"~",1
""" + navigation
print(head)
start = 3
start = 14
for i in range(1,7):
idxstart = start + (i-1)*6
item = f"""

View File

@@ -8,31 +8,31 @@ head = sharedhead + """
print(head)
print("""
//entity name
spstr strCommand.txt,entn.txt,"~",3
spstr strCommand.txt,entn.txt,"~",14
//title
spstr strCommand.txt,tTitle.txt,"~",4
spstr strCommand.txt,tTitle.txt,"~",15
//title farbe
spstr strCommand.txt,tTmp.txt,"~",5
spstr strCommand.txt,tTmp.txt,"~",16
if(tTmp.txt!="")
{
covx tTmp.txt,tTitle.pco,0,0
}
//author
spstr strCommand.txt,tAuthor.txt,"~",6
spstr strCommand.txt,tAuthor.txt,"~",17
//author farbe
spstr strCommand.txt,tTmp.txt,"~",7
spstr strCommand.txt,tTmp.txt,"~",18
if(tTmp.txt!="")
{
covx tTmp.txt,tAuthor.pco,0,0
}
//volume
spstr strCommand.txt,tTmp.txt,"~",8
spstr strCommand.txt,tTmp.txt,"~",19
covx tTmp.txt,sys0,0,0
hVolume.val=sys0
//icon
spstr strCommand.txt,tPlayPause.txt,"~",9
spstr strCommand.txt,tPlayPause.txt,"~",20
// on off button
spstr strCommand.txt,tTmp.txt,"~",10
spstr strCommand.txt,tTmp.txt,"~",21
if(tTmp.txt=="disable")
{
vis t5,0
@@ -42,7 +42,7 @@ print("""
covx tTmp.txt,t5.pco,0,0
}
// shuffel btn
spstr strCommand.txt,tTmp.txt,"~",11
spstr strCommand.txt,tTmp.txt,"~",22
if(tTmp.txt=="disable")
{
vis tShuffle,0
@@ -54,7 +54,7 @@ print("""
""")
start = 12
start = 23
for i in range(1,7):
idxstart = start + (i-1)*6
item = f"""

View File

@@ -5,16 +5,16 @@ head = sharedhead + """
// command format: entityUpd,heading,navigation,colorHome,iconHome[,iconColor,icon,speed,valueUp,valueDown]x6
spstr strCommand.txt,tHeading.txt,"~",1
""" + navigation + """
// icon color home
spstr strCommand.txt,tTmp.txt,"~",3
// icon color home
spstr strCommand.txt,tTmp.txt,"~",14
covx tTmp.txt,t1.pco,0,0
// icon home
spstr strCommand.txt,t1.txt,"~",4
spstr strCommand.txt,t1.txt,"~",15
// text home
spstr strCommand.txt,tHome.txt,"~",5
spstr strCommand.txt,tHome.txt,"~",16
"""
print(head)
start = 6
start = 17
for i in range(0,6):
idxstart = start + (i)*4
item = f"""

View File

@@ -8,23 +8,23 @@ text = sharedhead + """
text += """
//entity name
spstr strCommand.txt,entn.txt,"~",3
spstr strCommand.txt,entn.txt,"~",14
//currentTemp
spstr strCommand.txt,tCurTemp.txt,"~",4
spstr strCommand.txt,tCurTemp.txt,"~",15
//dstTemp
spstr strCommand.txt,tTmp.txt,"~",5
spstr strCommand.txt,tTmp.txt,"~",16
covx tTmp.txt,xTempDest1.val,0,0
xTempDest.val=xTempDest1.val
//status
spstr strCommand.txt,tStatus.txt,"~",6
spstr strCommand.txt,tStatus.txt,"~",17
//minTemp
spstr strCommand.txt,tTmp.txt,"~",7
spstr strCommand.txt,tTmp.txt,"~",18
covx tTmp.txt,xTempMin1.val,0,0
//maxTemp
spstr strCommand.txt,tTmp.txt,"~",8
spstr strCommand.txt,tTmp.txt,"~",19
covx tTmp.txt,xTempMax1.val,0,0
//tempStep
spstr strCommand.txt,tTmp.txt,"~",9
spstr strCommand.txt,tTmp.txt,"~",20
covx tTmp.txt,xTempStep1.val,0,0
// disable all buttons
vis bt0,0
@@ -37,7 +37,7 @@ text += """
vis bt7,0
"""
start = 10
start = 21
for i in range(0,8):
idxstart = start + i*4
text += f"""
@@ -59,17 +59,17 @@ for i in range(0,8):
text += """
//Text tCurTempLbl
spstr strCommand.txt,tCurTempLbl.txt,"~",42
spstr strCommand.txt,tCurTempLbl.txt,"~",53
//Text tStateLbl
spstr strCommand.txt,tStateLbl.txt,"~",43
spstr strCommand.txt,tStateLbl.txt,"~",54
//Text tALbl
spstr strCommand.txt,tALbl.txt,"~",44
spstr strCommand.txt,tALbl.txt,"~",55
//Text tCF
spstr strCommand.txt,tCF.txt,"~",45
spstr strCommand.txt,tCF.txt,"~",56
tCF1.txt=tCF.txt
tCF2.txt=tCF.txt
//Second Temperature
spstr strCommand.txt,tTmp.txt,"~",46
spstr strCommand.txt,tTmp.txt,"~",57
if(tTmp.txt!="")
{
covx tTmp.txt,xTempDest2.val,0,0
@@ -87,7 +87,7 @@ text += """
vis tCF2,1
}
//Show btDetail
spstr strCommand.txt,tTmp.txt,"~",47
spstr strCommand.txt,tTmp.txt,"~",58
if(tTmp.txt!="1")
{
vis btDetail,1

360
HMI/code_gen/pages/out.txt Normal file
View File

@@ -0,0 +1,360 @@
// 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")
{
// command format: entityUpd,heading,navigation,colorHome,iconHome[,iconColor,icon,speed,valueUp,valueDown]x6
spstr strCommand.txt,tHeading.txt,"~",1
// navigation icon left
spstr strCommand.txt,tTmp.txt,"~",2 //type
if(tTmp.txt=="delete"||tTmp.txt=="")
{
vis bPrev,0
}else
{
// get internal name
spstr strCommand.txt,nent1.txt,"~",3
// change icon
spstr strCommand.txt,bPrev.txt,"~",4
// change icon color
spstr strCommand.txt,tTmp.txt,"~",5
covx tTmp.txt,sys0,0,0
bPrev.pco=sys0
vis bPrev,1
}
// navigation icon right
spstr strCommand.txt,tTmp.txt,"~",8 //type
if(tTmp.txt=="delete"||tTmp.txt=="")
{
vis bNext,0
}else
{
// get internal name
spstr strCommand.txt,nent2.txt,"~",9
// change icon
spstr strCommand.txt,bNext.txt,"~",10
// change icon color
spstr strCommand.txt,tTmp.txt,"~",11
covx tTmp.txt,sys0,0,0
bNext.pco=sys0
vis bNext,1
}
// icon color home
spstr strCommand.txt,tTmp.txt,"~",14
covx tTmp.txt,t1.pco,0,0
// icon home
spstr strCommand.txt,t1.txt,"~",15
// text home
spstr strCommand.txt,tHome.txt,"~",16
// iconColor
spstr strCommand.txt,tTmp.txt,"~",17
covx tTmp.txt,t0Icon.pco,0,0
// icon
spstr strCommand.txt,t0Icon.txt,"~",18
// speed
spstr strCommand.txt,tTmp.txt,"~",19
covx tTmp.txt,t0Speed.val,0,0
// lower text
spstr strCommand.txt,t0u.txt,"~",20
if(t0Icon.txt!="")
{
vis t0Icon,1
vis t0u,1
vis h0,1
}else
{
vis t0Icon,0
vis t0u,0
vis h0,0
}
// iconColor
spstr strCommand.txt,tTmp.txt,"~",21
covx tTmp.txt,t1Icon.pco,0,0
// icon
spstr strCommand.txt,t1Icon.txt,"~",22
// speed
spstr strCommand.txt,tTmp.txt,"~",23
covx tTmp.txt,t1Speed.val,0,0
// lower text
spstr strCommand.txt,t1u.txt,"~",24
if(t1Icon.txt!="")
{
vis t1Icon,1
vis t1u,1
vis h1,1
}else
{
vis t1Icon,0
vis t1u,0
vis h1,0
}
// iconColor
spstr strCommand.txt,tTmp.txt,"~",25
covx tTmp.txt,t2Icon.pco,0,0
// icon
spstr strCommand.txt,t2Icon.txt,"~",26
// speed
spstr strCommand.txt,tTmp.txt,"~",27
covx tTmp.txt,t2Speed.val,0,0
// lower text
spstr strCommand.txt,t2u.txt,"~",28
if(t2Icon.txt!="")
{
vis t2Icon,1
vis t2u,1
vis h2,1
}else
{
vis t2Icon,0
vis t2u,0
vis h2,0
}
// iconColor
spstr strCommand.txt,tTmp.txt,"~",29
covx tTmp.txt,t3Icon.pco,0,0
// icon
spstr strCommand.txt,t3Icon.txt,"~",30
// speed
spstr strCommand.txt,tTmp.txt,"~",31
covx tTmp.txt,t3Speed.val,0,0
// lower text
spstr strCommand.txt,t3u.txt,"~",32
if(t3Icon.txt!="")
{
vis t3Icon,1
vis t3u,1
vis h3,1
}else
{
vis t3Icon,0
vis t3u,0
vis h3,0
}
// iconColor
spstr strCommand.txt,tTmp.txt,"~",33
covx tTmp.txt,t4Icon.pco,0,0
// icon
spstr strCommand.txt,t4Icon.txt,"~",34
// speed
spstr strCommand.txt,tTmp.txt,"~",35
covx tTmp.txt,t4Speed.val,0,0
// lower text
spstr strCommand.txt,t4u.txt,"~",36
if(t4Icon.txt!="")
{
vis t4Icon,1
vis t4u,1
vis h4,1
}else
{
vis t4Icon,0
vis t4u,0
vis h4,0
}
// iconColor
spstr strCommand.txt,tTmp.txt,"~",37
covx tTmp.txt,t5Icon.pco,0,0
// icon
spstr strCommand.txt,t5Icon.txt,"~",38
// speed
spstr strCommand.txt,tTmp.txt,"~",39
covx tTmp.txt,t5Speed.val,0,0
// lower text
spstr strCommand.txt,t5u.txt,"~",40
if(t5Icon.txt!="")
{
vis t5Icon,1
vis t5u,1
vis h5,1
}else
{
vis t5Icon,0
vis t5u,0
vis h5,0
}
}
if(tInstruction.txt=="pageType")
{
sleepValue=0
//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
spstr strCommand.txt,pageIcons.tTmp3.txt,"~",4
//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
}
if(tId.txt=="cardPower")
{
page cardPower
}
if(tId.txt=="cardChart")
{
page cardChart
}
}
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
// get value normal
spstr strCommand.txt,tTmp.txt,"~",2
covx tTmp.txt,dimValueNormal,0,0
dim=dimValueNormal
// get background color
spstr strCommand.txt,tTmp.txt,"~",3
if(tTmp.txt!="")
{
covx tTmp.txt,defaultBcoColor,0,0
}
// get font color
spstr strCommand.txt,tTmp.txt,"~",4
if(tTmp.txt!="")
{
covx tTmp.txt,defaultFontColor,0,0
}
}
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++
}
}

View File

@@ -166,44 +166,39 @@ sharedfoot = """
"""
navigation = """
// navigation icons
spstr strCommand.txt,tId.txt,"~",2
spstr tId.txt,tTmp.txt,"|",0
if(tTmp.txt=="0")
// navigation icon left
spstr strCommand.txt,tTmp.txt,"~",2 //type
if(tTmp.txt=="delete"||tTmp.txt=="")
{
vis bPrev,0
tsw mSwipePrev,0
tsw mSwipeUp,0
}
if(tTmp.txt=="1")
}else
{
// get internal name
spstr strCommand.txt,nent1.txt,"~",3
// change icon
spstr strCommand.txt,bPrev.txt,"~",4
// change icon color
spstr strCommand.txt,tTmp.txt,"~",5
covx tTmp.txt,sys0,0,0
bPrev.pco=sys0
vis bPrev,1
tsw mSwipePrev,1
tsw mSwipeUp,0
bPrev.txt=""
}
if(tTmp.txt=="2")
{
vis bPrev,1
tsw mSwipePrev,0
tsw mSwipeUp,1
bPrev.txt=""
}
spstr tId.txt,tTmp.txt,"|",1
if(tTmp.txt=="0")
// navigation icon right
spstr strCommand.txt,tTmp.txt,"~",8 //type
if(tTmp.txt=="delete"||tTmp.txt=="")
{
vis bNext,0
tsw mSwipeNext,0
}
if(tTmp.txt=="1")
}else
{
// get internal name
spstr strCommand.txt,nent2.txt,"~",9
// change icon
spstr strCommand.txt,bNext.txt,"~",10
// change icon color
spstr strCommand.txt,tTmp.txt,"~",11
covx tTmp.txt,sys0,0,0
bNext.pco=sys0
vis bNext,1
tsw mSwipeNext,1
bNext.txt=""
}
if(tTmp.txt=="2")
{
vis bNext,1
bNext.txt=""
}
"""