My IMP is stuck in a loop. It’s online, I can push new code and the build number increments and the asterisk disappears but the device keeps looping and not accepting the new code. The IMP is a drive away so I can power cycle it tomorrow evening.
It’s the first time I’ve used a while loop and the very first time I’ve locked myself out of an IMP.
The question: Which bit of my code below is bad enough to lock me out?
//*** I should have put these two lines AFTER the debug section ***
hardware.pin1.configure(DIGITAL_IN, pin1changed);
hardware.pin2.configure(DIGITAL_IN_PULLDOWN, pin2changed);
Either way it’s equivalent to while(1), as “debug” can never get back to being false again. This is a power-cycle job I’m afraid, although at some point we hope to implement a sort of “dead man’s handle” for imps in this situation. (The hard part of that, of course, is working out whether you’ve accidentally written an infinite loop, or deliberately written a loop that takes a long but not infinite time. But after, say, an hour it’d be pretty clear.)
Remember that Squirrel can never interrupt other Squirrel, and can’t interrupt imp.sleep(). Even if you’ve got an event-handler (on a button maybe) that sets “debug” back to false again, that event-handler will not run while the imp is stuck in an infinite while loop.