I’ve implemented @zoltan-fedor’s fix here, which works well for the scenarios where the sim gets unplugged or the antenna comes off or the device gets kicked off the network during some maintenance.
However, it did not work for when an Electron of mine ran out of data. In this scenario the device ran out of data, then went into the flashing blue mode. I increased the data, but the device never reconnected, even though I could see it was cycling in and out of deep sleep mode.
Are there certain scenarios where the modem has to be power cycled beyond a deep sleep? I’m trying to decide if I need an external watchdog that can remove power from the electron for a period of time.
Also, is there a system event for this scenario? Right now I am using “setup_update”, but I am wondering if being rejected by the cell tower has a different firmware event.
I’ve never tested it with running out of data, and blinking blue is not what I would have expected to happen, but this code sample has a pile of techniques for dealing with breaking out blinking blue, resetting the modem, and other things that can be helpful for robustness:
I figured you get blinking cyan. You still should be able to reach the cellular network (blinking green) but you wouldn’t be able to get to the cloud (breathing cyan) since IP data would be blocked. But that’s just a guess, I don’t actually know what happens.
Edit: Now that I think about it, maybe the entire SIM gets deactivated when you hit the limit, so you would be stuck at blinking green. And there’s a thing at least in 0.4.8 where if you get stuck in blinking green it sometimes goes into blinking blue. So maybe that’s what’s happening.
@joky, yes, I am using both the application watchdog and an event handler to put my device into SLEEP_MODE_DEEP when there is a connectivity issue. This works well for situations like sim card gets unplugged, antenna is removed, etc. It doesn’t seem to work when the data limit is exceeded.
@rickkas7, I have yet to try your firmware, but my firmware implements most of what yours does for smart reboot, with the exception of AT+CFUN=16. Do you know why this command would be more beneficial than a SLEEP_MODE_DEEP reboot?
Really, what I am trying to decide is whether the Electron is capable of recovering itself from all of the cellular data connectivity issue edge cases. It seems to do OK for most of them, but I keep finding additional issues, like this one. I think in the end I will have to add an external power cycle watchdog to my device in order to protect against unknown edge cases.
@rickkas7, Is there anything in your code that does more than SLEEP_MODE_DEEP to reboot the modem? Looks like you are calling Cellular.off(), but does this do anything more than what SLEEP_MODE_DEEP does?
No, it’s not necessary to turn cellular off; that’s done automatically with SLEEP_MODE_DEEP as long as you’re not also using SLEEP_NETWORK_STANDBY. SLEEP_MODE_DEEP should be sufficient, I think.