Imp strange behaviour since "imp os upgraded" message

@DolfTraanberg,

the sleep(100) is actually inside an infinite loop: while(1){} so after the 100 seconds, it will start again to sleep for another 100… endless.

You don’t actually have any wake up in the middle, so I think it just keep sleeping.

I guess (because I didn’t read all the docs, my bad) that the reason of this offline is just a timeout after 10 minutes of inactivity.

If you want to tinker with this code, for example with the opportunity to update the code without every time reset the device, I would suggest you to remove the infinite loop.

Dimitri

Dimitri

thanks.
yes, removing the loop looks like the best solution instead of changing it in wakeup()…

@dolf, @smartmaker as I keep saying, infinite loops are bad.

A while(1) imp.sleep() is most definitely an infinite loop and as Dolf notes, our documentation clearly says that during a sleep, network traffic is not processed - this means the server will mark the imp offline and close the connection.

@smartmaker when your test is done, just fall off the end of your code. There’s no need to put a loop there. The imp will just sit there processing network traffic forever (and, if you had registered any event handlers, calling those as applicable).