I made a simple datalogger with one of my photons and at the end of its code it goes into SLEEP_MODE_DEEP, however now I cant update its codeā¦
Even if I press the reset button on the photon, it executes the user code and goes to sleep, even if a build tab is currently trying to send new firmware to it.
First off, whats the procedure to get it back to life, will I have to factory reset? I did the cli update with 0.4 part files, so hopefully a factory reset wont brick it ?
-Or is there a easyier way to load new firmware/reset to tinker firmware ?
Second, is it possible to see on startup why we started? on AVR you can read a register and see if the chip was freshly booted, reset by using reset pin, watchdog, sleep timer expired, etc. maybe the photon has something like it ?
Thanks, safemode allowed me to update the firmware via webinterface, very nice.
Still looking for a good way to detect that reset button was used, so I can prevent the device going to sleep in that case, as a workaround untill the queued firmware distribution works, which IMO is pretty essential.
Iād have to check with some of the bare metal geeks, but for the time being, you could use a user button that you keep pressed during setup() which forces your code into an update branch.
setup()
{
pinMode(userButton, INPUT_PULLUP); // wire a button to GND
delay(100);
if(!digitalRead(userButton)) // if button is pressed
{
while(true) // keep servicing the cloud forever
Spark.process();
}
}
Edit: Checked back at Particle and the answer was: āNo, there is no way to know, after application code has started running again.ā
True, its not really an improvement over safemode though, unless the photon is inside an enclosure.
Also notice that the leds are going on every time it wakes up, so not sure how energy friendly the deep sleep is after all, well see how much life I get out of these AAA.
I am trying to replace some NRF24 with photons to make the setup cleaner, but will need at least 6 months battery life to make sense.
Yea looks interesting, but 3 months away, my test photon ādiedā this morning after about 6 days of running on 3xAAA.
However this is without a booster since I dont have a suitable one atm, so theres still a bit of power left in the batteries, the voltage is just too low for VIN now.
So in the meantime I will probably route a power cable for it, or a bigger battery pack, 1000mah@5V per week seems doable.