Sleep Mode Description
- 
					
					
					
					
 How does sleep work, help doc doesn't explain it? When the device goes to sleep, what memory is retained? Does it continue from where it left off or restarts boot & main. Did I miss the doco for this? 
 
- 
					
					
					
					
 @jcaron said in Sleep Mode Description: @paul-thornton To be precise, it actually starts from the top of boot.py :-) 
 While you're in the docs, I don't think the read_battery_voltage method for the Pysense/Pytrack/etc. is in the docs, you may want to add that as well.Thanks ill get this added today if its missing. 
 
- 
					
					
					
					
 @misterlisty Yes, it acts exactly as on a power on, it executes boot.pythenmain.py.The only way to know whether it's a power on or a wake from sleep (and what the reason for the wake up was) is to call machine.wake_reason.The possible reasons are listed in the constants at the bottom of the page: machine.PWRON_WAKE,machine.PIN_WAKE,machine.RTC_WAKE,machine.ULP_WAKE.
 
- 
					
					
					
					
 From what i read above, it would also restart boot.py? 
 
- 
					
					
					
					
 @paul-thornton To be precise, it actually starts from the top of boot.py :-) While you're in the docs, I don't think the read_battery_voltage method for the Pysense/Pytrack/etc. is in the docs, you may want to add that as well. 
 
- 
					
					
					
					
 The wording on that isnt brilliant. but yes. it restarts from the top of main.py again. ill update the docs to be clearer 
 
- 
					
					
					
					
 @misterlisty If you mean deep sleep, in all cases, all CPU memory and CPU state is lost, and on wake-up it's like the module was just powered on. This is in the docs, though it's perhaps not that clear. For machine.deepsleep:https://docs.pycom.io/firmwareapi/pycom/machine/#machinedeepsleeptimems Stops the CPU and all peripherals, including the networking interfaces (except for LTE). Execution is resumed from the main script, just as with a reset. Note that at the ESP32 level the RTC domain including its memory is kept active, but there's no support for that at the micropython level. In the case of Pysense/Pytrack/Deep Sleep Shield-controlled deep sleep, it's even worse, as power to the ESP32 is cut.