I got an Imp from one your awesome reps at the last YC hardware hackathon (my sister got one too!).
At the hackathon, everything was fantastic.
However, at home, my imp, which I just configured and got showing up in the planner, has the nasty habit of never receiving software updates after the led light turns off.
If I use this fragment: while (true) { imp.sleep(2.5); server.log("alive") }
I can verify the imp is connected to the server.
But when I change anything, say “alive” to “alive!”, nothing happens.
The serverlog stops printing. No “downloading” or anything messages.
I am very confused, as it seems the imp only updates when I remove/reinsert the sd slot, which is rather different from the experience I had a few days back programming my sister’s imp.
I’ve seen issues about the firmware – would this be analogous to such?
You shouldn’t be looping like that - the imp requires you to exit the VM in order for the TCP stack to have a chance; we give the user thread priority to ensure predictable code execution. Your code should do whatever task it needs to, then return (or fall off the end of the main program) - the OS will then call back into your code when necessary to execute event handlers or timers.
The correct way to write that code would be:
function alive() {
imp.wakeup(2.5, alive);
server.log(“alive”);
}
Imp disables ability to update software after several minutes.
This is using the imp.wakeup function.
Using imp.wakeup merely delays the bug from a few seconds to several mins.
Looking at the log:
Monday, February 25, 2013 7:30:12 PM: Downloading new code
Monday, February 25, 2013 7:30:13 PM: alive
…
Monday, February 25, 2013 7:33:53 PM: alive
< User attempts to download new code >