The touch event is used only for the sleeping engine (it will be used for dimming later) and it was transferring all the json info with page name, component, entity, etc. This was replaced by a simple random integer with no meaning other than "the screen was touched, reset the timer".
410 lines
11 KiB
Plaintext
410 lines
11 KiB
Plaintext
Page fan
|
|
Attributes
|
|
ID : 0
|
|
Scope : local
|
|
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
|
|
dim=brightness
|
|
if(api==0)
|
|
{
|
|
page home
|
|
}else
|
|
{
|
|
fansetting.txt="{\"page\": \"fan\", \"component\": \"currentpage\", \"value\": \"pagechange\", \"entity\": \""+entity.txt+"\"}"
|
|
printh 92
|
|
prints "nspanelevent",0
|
|
printh 00
|
|
prints fansetting.txt,0
|
|
printh 00
|
|
printh FF FF FF
|
|
}
|
|
|
|
Touch Press Event
|
|
printh 91
|
|
prints "touchevent",0
|
|
printh 00
|
|
prints rand,0
|
|
printh FF FF FF
|
|
|
|
Touch Release Event
|
|
printh 91
|
|
prints "touchevent",0
|
|
printh 00
|
|
prints rand,0
|
|
printh FF FF FF
|
|
|
|
Variable (string) fansetting
|
|
Attributes
|
|
ID : 7
|
|
Scope : local
|
|
Text :
|
|
Max. Text Size: 255
|
|
|
|
Variable (string) back_page
|
|
Attributes
|
|
ID : 8
|
|
Scope : local
|
|
Text : home
|
|
Max. Text Size: 15
|
|
|
|
Variable (string) va0
|
|
Attributes
|
|
ID : 9
|
|
Scope : local
|
|
Text :
|
|
Max. Text Size: 10
|
|
|
|
Variable (string) entity
|
|
Attributes
|
|
ID : 16
|
|
Scope : global
|
|
Text :
|
|
Max. Text Size: 100
|
|
|
|
Text fan_value
|
|
Attributes
|
|
ID : 1
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID : disabled
|
|
Associated Keyboard: none
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Text page_label
|
|
Attributes
|
|
ID : 2
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID : disabled
|
|
Associated Keyboard: none
|
|
Text :
|
|
Max. Text Size : 25
|
|
|
|
Text icon_state
|
|
Attributes
|
|
ID : 6
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID : disabled
|
|
Associated Keyboard: none
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Slider fanslider
|
|
Attributes
|
|
ID : 3
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
Position : 0
|
|
Upper range limit: 4
|
|
Lower range limit: 0
|
|
|
|
Events
|
|
Touch Release Event
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
timer0.en=1
|
|
printh 91
|
|
prints "touchevent",0
|
|
printh 00
|
|
prints rand,0
|
|
printh FF FF FF
|
|
|
|
Button button_up
|
|
Attributes
|
|
ID : 10
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
fanslider.val++
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
}
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=1
|
|
|
|
Button button_on
|
|
Attributes
|
|
ID : 11
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
fanslider.val=fanslider.maxval/2
|
|
sys0=fanslider.maxval*5
|
|
sys0%=10
|
|
if(sys0>=5)
|
|
{
|
|
fanslider.val++
|
|
}
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=1
|
|
|
|
Button button_down
|
|
Attributes
|
|
ID : 12
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
fanslider.val--
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
}
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=1
|
|
|
|
Button button_off
|
|
Attributes
|
|
ID : 13
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 10
|
|
|
|
Events
|
|
Touch Press Event
|
|
fanslider.val=fanslider.minval
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
fansetting.txt="{\"page\": \"fan\", \"key\": \"stop\", \"value\": "+va0.txt+", \"entity\": \""+entity.txt+"\"}"
|
|
printh 92
|
|
prints "localevent",0
|
|
printh 00
|
|
prints fansetting.txt,0
|
|
printh 00
|
|
printh FF FF FF
|
|
if(fanslider.val>fanslider.minval)
|
|
{
|
|
button_off.pco=59164
|
|
button_down.pco=59164
|
|
}else
|
|
{
|
|
button_off.pco=10597
|
|
button_down.pco=10597
|
|
}
|
|
if(fanslider.val<fanslider.maxval)
|
|
{
|
|
button_up.pco=59164
|
|
}else
|
|
{
|
|
button_up.pco=10597
|
|
}
|
|
|
|
Touch Release Event
|
|
timer0.en=0
|
|
|
|
Button button_back
|
|
Attributes
|
|
ID : 15
|
|
Scope : local
|
|
Dragging : 0
|
|
Send Component ID: disabled
|
|
State : unpressed
|
|
Text :
|
|
Max. Text Size : 3
|
|
|
|
Events
|
|
Touch Press Event
|
|
if(back_page.txt=="buttonpage01")
|
|
{
|
|
page buttonpage01
|
|
}else if(back_page.txt=="buttonpage02")
|
|
{
|
|
page buttonpage02
|
|
}else if(back_page.txt=="buttonpage03")
|
|
{
|
|
page buttonpage03
|
|
}else if(back_page.txt=="buttonpage04")
|
|
{
|
|
page buttonpage04
|
|
}else
|
|
{
|
|
page home
|
|
}
|
|
|
|
Timer swipestore
|
|
Attributes
|
|
ID : 5
|
|
Scope : local
|
|
Period (ms): 50
|
|
Enabled : no
|
|
|
|
Events
|
|
Timer Event
|
|
swipex=tch0
|
|
swipey=tch1
|
|
|
|
Timer timer0
|
|
Attributes
|
|
ID : 14
|
|
Scope : local
|
|
Period (ms): 1000
|
|
Enabled : no
|
|
|
|
Events
|
|
Timer Event
|
|
timer0.en=0
|
|
sys0=100*fanslider.val/fanslider.maxval
|
|
covx sys0,va0.txt,0,0
|
|
fan_value.txt=va0.txt+"%"
|
|
fansetting.txt="{\"page\": \"fan\", \"key\": \"percentage\", \"value\": "+va0.txt+", \"entity\": \""+entity.txt+"\"}"
|
|
printh 92
|
|
prints "localevent",0
|
|
printh 00
|
|
prints fansetting.txt,0
|
|
printh 00
|
|
printh FF FF FF
|
|
|
|
TouchCap swipe
|
|
Attributes
|
|
ID : 4
|
|
Scope: local
|
|
Value: 0
|
|
|
|
Events
|
|
Touch Press Event
|
|
swipestore.en=1 // Start swipestore timer
|
|
|
|
Touch Release Event
|
|
swipestore.en=0
|
|
// Touch has ended, x
|
|
if(tch0==0)
|
|
{
|
|
swipec=swipex-tch2
|
|
// From Left to Right
|
|
if(swipec>swipedx)
|
|
{
|
|
//page
|
|
}
|
|
// Right to Left
|
|
swipec2=0-swipedx
|
|
if(swipec<swipec2)
|
|
{
|
|
//page
|
|
}
|
|
}
|
|
// Touch has ended, y
|
|
if(tch1==0)
|
|
{
|
|
swipec=swipey-tch3
|
|
// From Up to Down
|
|
if(swipec>100)
|
|
{
|
|
//page
|
|
}
|
|
// Down to Up
|
|
swipec2=0-swipedy
|
|
if(swipec<-100)
|
|
{
|
|
//page
|
|
}
|
|
}
|
|
|