New Firmware for Products gets never flashed

Hi I have product with three devices. As you can see in the following screenshot I released a new firmware version for them.

The problem is that the new version gets never flashed to my devices via air. They devices wake up every hour and successfully connect with the particle cloud -> But they are still on the old firmware even after one day.

Am I doing something wrong here ? Or am I misunderstanding that feature ? :open_mouth:

-> Maybe this is important: I use SYSTEM_MODE(SEMI_AUTOMATIC) and call Particle.connect() every hour to connect to the cloud and send my data

And you’ve never made use of System.disableUpdates()?

You also need to stay connected long enough for an OTA update to kick in, for that you can check System.updatesPending() to add some extra waiting time before disconnecting.

1 Like

thank you for your help @ScruffR
No I never called System.disableUpdates()

Ahh ok I will check that out. How much extra time do you think is needed ? Just some seconds or more than 1min ?

2 Likes

I’d allow for at least 30sec.

1 Like

I am checking now with the following code at the start of my loop() for updates:

  System.enableUpdates();    
  if(System.updatesPending()){
      Particle.publish("DD","updatesPending",PRIVATE);
  } else {
      Particle.publish("DD","NoUpdatesPending",PRIVATE);
  }

But I allways get NoUpdatesPending even if I set a new firmware version in the particle console:

Do you have any idea whats my problem here ?

Maybe @jeiden can chime in there

Maybe this is helpfull here is a scetch of what I am doing:

SYSTEM_MODE(SEMI_AUTOMATIC);

void loop(){
    if(Particle.connected()){
        publishData();
    } else {
        readSensorValues();
        
        if(shouldConnect){
            Particle.connect();
        }

        System.sleep(SLEEP_MODE_DEEP,fiveMinutes);
    }
}

I have tryed to check System.updatesPending() before and after my publishData(); call but it is allways false.

@Gecko, after having a similar request of another member who seemed to get a true from System.updatesPending() only after being connected for more than 9 sec.
Could you try something like this?

  uint32_t ms = millis();

  // do whatever needs doing for normal ops

  // allow at least 10sec for cloud enumeration to complete
  while(millis()-ms < 10000) Particle.process();
  // now we should be able to learn if there is an update waiting
  if (System.updatesPending())
  { // if update is pending hang around for it a minute - will reboot after update
    ms = millis();
    while(millis()-ms < 60000) Particle.process();
    // if hasn't rebooted before one minute was up go to sleep and try next time again
  }
  System.sleep(SLEEP_MODE_DEEP, sleepTime);
1 Like

Thank you @ScruffR for coming back to inform me! I will try it out and update this Thread with my results.

1 Like

I’ve also opened a GitHub issue for this kind of problems

To keep track of it and maybe find a more convenient way of dealing with sleeping devices and pending updates.