During yesterday’s issue with devices not connecting because of the carrier maintenance that was occuring: I had low power devices that would get stuck on Cellular.off();
when it couldn’t make a connection to the carrier network. The light would just blink white. This prevented the device from getting to the hibernate code. This is an issue because these are battery powered devices and they need to conserve battery capacity. I would like the code to attempt a connection, if it fails, turn off modem, and go back to sleep. It would then try again later. Any ideas on how to handle this situation if it happens again?
System mode is semi-automatic and system threading is disabled.
Snippet of code:
Particle.connect();
waitFor(Particle.connected, 2 * 60000); //wait for connection to establish. 2 minutes.
if (Particle.connected()) {
// Main Code runs here
}
//Disconnect from Particle and turn off modem
Particle.disconnect();
Cellular.off();
delay(5s); //Give the modem time to turn off
//Goto sleep
sleep_config.mode(SystemSleepMode::HIBERNATE)
.gpio(WKP, RISING);
System.sleep(sleep_config);