Button sting
Posted: Tue Apr 19, 2016 1:15 pm
This bug stings like a wasp! - and took ages to pin down cos it causes continued crashing and reboots (cicciocb's gpio00 button to prevent autorunning has been worn out!).
To cut a long story short, I suspect there's a problem when trying to use more than 10 BUTTONs.
I've included the script I was working on (Alpha 13) which shows the problem in case it doesn't ring any bells, and there's an explanation of things embedded in the script.
I'm not looking for any problem get-arounds B.T.W. cos that's not the point of sending the script (and it's already been hacked to destruction from chasing down the pest anyway) - it's purely to demonstrate the problem.
I've pinned it down to being a >10 button problem by commenting out any one of the scripts earlier buttons, and then the original 'problem' button no longer causes a crash. And it is button specific, because commenting out a Textbox doesn't make any difference to the button crashing... but it's worth mentioning that if the cause IS because of using more than 10 buttons which aren't being handled properly, then perhaps the same >10 problem may exist for some of the other web components as well.
To cut a long story short, I suspect there's a problem when trying to use more than 10 BUTTONs.
I've included the script I was working on (Alpha 13) which shows the problem in case it doesn't ring any bells, and there's an explanation of things embedded in the script.
I'm not looking for any problem get-arounds B.T.W. cos that's not the point of sending the script (and it's already been hacked to destruction from chasing down the pest anyway) - it's purely to demonstrate the problem.
I've pinned it down to being a >10 button problem by commenting out any one of the scripts earlier buttons, and then the original 'problem' button no longer causes a crash. And it is button specific, because commenting out a Textbox doesn't make any difference to the button crashing... but it's worth mentioning that if the cause IS because of using more than 10 buttons which aren't being handled properly, then perhaps the same >10 problem may exist for some of the other web components as well.
Code: Select all
memclear
'let getstat = 66
let getvol = 67
'let geteq = 68
let getloop = 69
'let getver = 70
'let getsd = 71
let getfl = 73
let getdir = 83
let getind = 75
let getsecs = 80
let getlen = 81
let getname = 82
let vstart = 126 'Serial command start byte
let vlen = 2
let vend = 239 'Serial command end byte
let vplay = 13
let vreset = 12
let vpause = 14
let vnext = 1
let vprev = 2
let vup = 4 'not used
let vdown = 5 'not used
let vset = 6
let vol = 15
let vdirfile = hextoint("12")
let vdir = 1
let vfile = 1
let vloopmode = hextoint("11")
let vloop = 0
' 0/1/2/3/4 for All/Folder/One/Ram/One_Stop
let vdchange = hextoint("0F")
let vdnext = hextoint("01")
let vdprev = hextoint("00")
gosub [reset]
button "<" [prev]
button "Play" [play]
button "Pause" [pause]
button ">" [next]
html "<BR>"
html "<BR>"
textbox "vfile"
textbox "vdir"
button "Jump" [track]
html "<BR>"
html "<BR>"
'html hextoint("11")
html "<BR>"
html "<BR>"
slider "vol" 0 30
button "Set Volume" [setvol]
html "<BR>"
html "<BR>"
textbox "vloop"
button "Loop mode" [vlmode]
html " 0/1/2/3/4 for All/Folder/One/Ram/One_Stop"
html "<BR>"
html "<BR>"
button "Next Folder" [dnext]
button "Prev Folder" [dprev]
html "<BR>"
html "<BR>"
' ************************
' EITHER of these 2 buttons are ok by themselves, but uncommenting BOTH always causes a crash !!!
' Crash-recovery is a matter of commenting-out a button again, and waiting for esp reconnection after one of the
' reboots, then do a Save. If the save is speaking to deaf ears, just wait for reconnection again, then Save quicker!
'button "Get name" [getn]
button "Get volume" [getv]
' ************************
end ' *** This END is to prove that the problem isn't being caused but something after the buttons ***
html "<BR>"
html "<BR>"
[loop]
'serialbranch [serialin]
wait
[getn]
'serialprintln chr(vstart) & chr(2) & chr(getname) & chr(vend)
goto [loop]
[getv]
'serialprintln chr(vstart) & chr(2) & chr(getvol) & chr(vend)
goto [loop]
[serialin]
html "received:"
return
[dnext]
serialprintln chr(vstart) & chr(3) & chr(vdchange) & chr(vdnext) & chr(vend)
goto [loop]
[dprev]
serialprintln chr(vstart) & chr(3) & chr(vdchange) & chr(vdprev) & chr(vend)
goto [loop]
[vlmode]
serialprintln chr(vstart) & chr(4) & chr(vloopmode) & chr(vdir) & chr(vloop) & chr(vend)
goto [loop]
[track]
serialprintln chr(vstart) & chr(4) & chr(vdirfile) & chr(vdir) & chr(vfile) & chr(vend)
goto [loop]
[setvol]
serialprintln chr(vstart) & chr(3) & chr(vset) & chr(vol) & chr(vend)
goto [loop]
[play]
serialprintln chr(vstart) & chr(vlen) & chr(vplay) & chr(vend)
goto [loop]
[pause]
serialprintln chr(vstart) & chr(vlen) & chr(vpause) & chr(vend)
goto [loop]
[next]
serialprintln chr(vstart) & chr(vlen) & chr(vnext) & chr(vend)
goto [loop]
[prev]
serialprintln chr(vstart) & chr(vlen) & chr(vprev) & chr(vend)
goto [loop]
[volup]
serialprintln chr(vstart) & chr(vlen) & chr(vup) & chr(vend)
goto [loop]
[voldown]
serialprintln chr(vstart) & chr(vlen) & chr(vdown) & chr(vend)
goto [loop]
[reset]
serialprintln chr(vstart) & chr(vlen) & chr(vreset) & chr(vend)
return