Photon Reset vs WiFi Disconnect

Hi! Noob question here since I can’t find an answer from the posts I’ve seen so far. So, is resetting the photon similar to when it disconnects to the network? Resetting the photon means it will run the all the code including the setup(). Will this also happen when the device disconnects in the network? Or when it reconnects, it will go back to loop? Thanks!

Reset (button, pin, or System.reset) as well as SLEEP_MODE_DEEP completely reset the device, running setup() again.

Getting disconnected from Wi-Fi or cloud, and pin+time sleep mode (stop sleep) continue execution and do not reset the whole device.

Note: In the default mode, loop() stops getting called when the cloud is not connected. With SYSTEM_THREAD(ENABLED) or SYSTEM_MODE(SEMI_AUTOMATIC) or MANUAL, your loop() code continues to run when not cloud-connected.

1 Like

Thank you! I also just figured it out right now. Silly oversight. Thanks!

To expand on that, even in default SYSTEM_MODE(AUTOMATIC) without SYSTEM_THREAD(ENABLED) your code will keep running when you deliberately disconnect from the cloud via Particle.disconnect() or any function that implicitly causes it to be called.

1 Like