It’s like server.sleepfor() - the script will start from the top at wake time, however if you use imp.deepsleepfor() then your code will be running without any wifi connection. If you have the default connection policy set, then the first thing that tries to talk to the server will bring the connection up.
Nothing is preserved apart from the nv table as you have been in 4uA sleep mode.
Where is the best documentation to describe this? I have seen the wifi state diagram but it is a little hard to interpret. Are there other flowcharts that would explain the deep sleep sequence?
Looks like one would use hardware.wakereason() to branch code on cold boot versus waking from sleep. Is that correct?
let me take a moment to thank you for this and all of the other new documentation that has been coming online recently. It is much needed and it is also really well done. I have used some of these new references to great advantage.
For this question about deep sleep, it looks like it will take a pretty big effort to understand this all and do it correctly. What would really help a lot is a flowchart - or several of them laying out different examples. All that text can be read and digested but there is a lot to it.
One possibly simple question. A lot has been written about telling the server the device is going to disconnect and be ‘expected online’ at some time in the future. In my design the waking will be done by a rising edge on the wake pin. I am uncertain what to do with the server for that situation. The server should expect the device online in anything from 30 seconds in the future to many days in the future. Will this work?