I’ve seen the odd post about program flow.
Attached is an updated a flow/state diagram I did when first encounter the imp.
It might help others new to the platform.
Please note: this is how I think things go! please comment & correct.
I know there is no Main() function but it’s implied.
Also added the forthcoming WIFI power save mode.
That’s actually pretty good. (I might not have bothered drawing “wifi power save” and “shallow sleep” as two distinct states – they’re more like one state that has two alternatives for how power-hungry it is.)
In the future things may get more complex (more gradations of depth of sleep) but for now that’s a very good guide, thankyou!
Peter, Shallow Sleep – power save for me it is a distinct state as there is no coms to the cloud. Perhaps I should call it Shallow Sleep “Programmatically Offline”.
Ah, but you do get comms to the cloud in wifi power save mode. (Just with worse receive latency, as the imp checks less often for incoming packets.) What you’re describing is wifi off mode, which is also coming, but not so soon. That one will indeed be worth its own blob in your picture.
Peter this is top notch and snoozing is a great state for man & machine a like. Would be good to see the wiki and e.imp forum posts reference the states and replacing the likes of shallow sleep.
Ah, shallow sleep (imp.wakeup) isn’t really shown on that diagram: it can occur in any of the ACTIVE states, and doesn’t itself change the state. That made depicting it a bit awkward.