Question: With a Particle Product’s firmware management, can we speed up firmware update messages from the Cloud which seem to take a consistent 9 seconds of Cloud connection before arriving?
Background: I’m playing around the firmware upgrade functionality by creating a product in Particle’s console. My device, to minimize power, only wakes occasionally from sleep and keeps the WiFi powered even less often and only for short blips of time. I’m finding that it never gets the updated firmware.
I wrote another application to test how long it takes before a firmware message from the Cloud arrives. After 4 trials, I found it always gets a message for a new firmware update after being Cloud-connected for 9 seconds. My application loop is below (NOTE: Because I’m using SYSTEM_MODE(MANUAL), I’m controlling processing and wifi/cloud).
Ideas: Alternatively, I can manage updates through my own system but if Particle is going to offer this feature, I might as well use it. To get around this, I can keep my device awake for a minimum of 10 seconds and then check the firmware_update_pending event or System.updatesPending(), both of which do not occur (trigger or return true) unless the Cloud sends the message 9 seconds in.
Testing App:
void loop() {
Serial.print("...loop\n");
Serial.flush();
digitalWrite(D6,LOW);
// manual setup of this
WiFi.on();
if ( WiFi.ready() == false ) {
Serial.print("WiFi not ready so turning on\n");
WiFi.connect();
while(WiFi.ready() == false ) {
Serial.print("... waiting for WiFi\n");
Particle.process();
delay(1000);
}
}
if ( ! Particle.connected() ) {
Serial.print("Particle not connected to Cloud\n");
Particle.connect();
while( Particle.connected() == false ) {
Serial.print("... waiting for Cloud\n");
Particle.process();
delay(1000);
}
}
Serial.print("...process\n");
Particle.process();
Serial.printlnf("...delay %d sec",ds);
delay(ds*1000);
ds+=1;
Serial.print("...process one last time\n");
Particle.process();
Serial.print("...sleep\n");
System.sleep(1);
}