Safe mode on Photon is totally awesome – thank you for that!
However, I’m looking for a way to programmatically put the device into safe mode. I see that there’s System.factoryReset(), but that’s sort of a nuclear approach. I’m hoping for a not-yet-documented System.safeMode() method. Or maybe some magic that I can perform on the RESET pin to kick the system into safe mode.
Hey @evancharlton! There’s currently no API in firmware to force a boot to safe mode, but it’s definitely something we want to support. I’ll look into adding this before the 0.4.5 release.
Something on the reset pin would be awesome, too. For example, the Sparkfun Pro Micro has a feature where if you connect the reset pin to ground, it’ll reset (duh). If you do it again within 750ms, it’ll go into the bootloader for 8 seconds. (You can read more about it here – search for “Reset to Bootloader”)
Something like that would be fantastic for Photon, so that it could be externally reset to safe mode if it’s e.g. immediately crashing in setup().
Is this something that has been implemented? I’m developing on electron device and I’ve come to face on rare occasion bugs in my code that would make the device reset after a few seconds. The problem is of course on my side. However, when it occurs there is no way to remotely recover as there is not enough time between crash to flash OTA. I would like to have a reboot counter stored in flash. And when the device boot up it will check how many restart it has done in a given period and it would force restart in Safe Mode if it pass a given threshold.
Therefore, I very interested to know if the discussion in this thread had result in any implementation of such feature? I’ve not seen it the documentation.