Firmware not updating for Product devices

Hi Everyone,

I have an Electron which is programmed to run some code (takes about 10 seconds to process) and then go to Deep Sleep for 5 minutes. I would like to have the option of uploading new code to it OTA, and I found that the best way to do this is to create a Product and, to that Product, add firmware through the Product dashboard.

Now, the problem is that, when I try to push the new firmware to the device, it doesn’t actually do it. The Electron goes to sleep, wakes up, but then it doesn’t get the new firmware updated to it. I think perhaps I need a delay or something in there maybe?

Below is a screenshot of the issue. It keeps saying that the device is pending a firmware update which will automatically get pushed to the device when it comes online next. It keeps coming online but the firmware isn’t getting uploaded! What am I doing wrong! Thanks in advance for any pointers!

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 likely stay stuck waiting to get pushed to the device. Hope this helps anyone who faces a similar issue.

Cheers!

2 Likes

Thank you for posting your solution!