A while ago I posted in Projects some software for a 'wake-up light' that uses RGB LEDs. This seemed to have been working fine, but recently had crashed every time it started up, sometimes doing multiple crashes which were difficult to interrupt!
Having done some debugging, the problem seems to be with CSSID. I establish some buttons for controlling the light with lines like this:
button "Morning", [dayon]
btnday = htmlid()
cssid btnday, "background-color: lightgray; left: 130px;"
Later in the program, if the button is clicked, I call the routine:
[dayon]
io(pwo,rr,daylevel)
io(pwo,gg,daylevel)
io(pwo,bb,daylevel)
cssid btnday, "background-color: aqua;"
serialprintln dtg$ & " Day_on: " & daylevel
wait
in order to change the button colour to indicate that the day lights are on. This works. Later, to turn them off, I use:
[alloff]
day_inc_active = 0
inclevel = 0
night_active = 0
io(pwo,rr,0)
io(pwo,gg,0)
io(pwo,bb,0)
cssid btnday, "background-color: lightgray;"
cssid btnnight, "background-color: lightgray;"
serialprintln dtg$ & " All Off"
wait
This seems to work the first time, but subsequent calls cause a crash and memory dump. Once rebooted, I try again and the same thing happens.
If I remove the CSSID calls, the system is rock solid.
Surely I should be able to save the values obtained from HTMLID() in a variable and then use it subsequently for CSSID? It seems to work fine most of the time, but not here!
If anyone wants the full code to try running it to see if you get the same problem, let me know and I'll post it.
Phil