Determine if Photon Re/Starts or wakes up from Deep_Sleep?

Hello there :smile:

is there a way to determine if the Photon powers up/start or wakes up from deep_sleep?

I want to run some specific lines of code but only when the Photon gets powered up (when I plug in the battery). When the Photon wakes up from Deep_Sleep it should not run these lines of code.
Does anyone know how I can archive that?

Thank you in advance!

You could use retained variables or the time of the RTC (if not battery backed) before resync.
Another coming feature (in 0.6.0-rc.1 and later) is to check System.resetReason()

1 Like

Cool, thanks! I guess I’ll use retained variables then…

I wonder if there is a OTA for 0.6rc?

When you flash a app firmware that’s targeting 0.6.0-rc.2 the Safe Mode Healer should update your Photon to the required version.
Just allow for multiple (3-4) reboots, till the device runs your 0.6.0-rc.2 code.

  1. first attempt to flash your app which fails into Safe Mode
  2. update system part1
  3. update system part2
  4. second attempt to flash your app which should end in breathing cyan