@RWB & @Vitesze ,
There are a couple of threads on product firmware update OTA that might help out:
My device by default stays online far too short (about 5 seconds, just sufficient to publish data) to download any OTA-updates. So instead, every Friday I want it to check if there’s a pending OTA update (through a Product). I don’t want it to always wait for a full 30 seconds (which seems to be the time it takes for my devices to download OTA updates) because this halts code, increases the energy usage and I may not even have new firmware every Friday. So instead, I let it wait for 5 seconds, s…
Ok, I figured it out thanks to another member. Too tired to dig up the thread to give credit sorry!
Anyway, within my void_setup, I added the following code:
uint32_t ms = millis();
while(millis()-ms < 5000) Particle.process();
if (System.updatesPending())
{
ms = millis();
while(millis()-ms < 60000) Particle.process();
}
Basically, wait 5 seconds to check if there’s an OTA update pending. If TRUE, then wait 60 seconds to let it take place. Without those delays, your firmware will like…
Basically, you do need to keep the device from going to sleep until the update is done.
The other issue is you may not want updates from interrupting your critical functions, if you happen to have anything that is critical.
1 Like