My device firmware config is the following:
- SYSTEM_MODE(AUTOMATIC);
- SYSTEM_THREAD(ENABLED);
- 3rd Party SIM with keepAlive set in connection event
- Using MQTT for data logging
- The result of Cellular.RSSI(); is translated to a color on an external RGB LED, where black indicates RSSI > 0 (an error or disconnection condition from the modem)
I consistently get the following series of states on my device after a few hours of proper operation:
Normal Operational State
- Electron RGB LED = breathing cyan
- Particle.connected() = true
- MQTT client.isConnected() = true
- ext Cell LED = Green (good connection)
Connection Lost, Particle “connected”
- Electron RGB LED = breathing cyan
- Particle.connected() = true
- MQTT client.isConnected() = false
- ext Cell LED = Black (Cellular.RSSI() returned > 0 )
-----note - no cloud_status_disconnected event thrown between these, at least not that Serial could catch in time
Connection Lost, Particle “connecting”
- Electron RGB LED = blinking cyan
- Particle.connected() = true
- MQTT client.isConnected() = false
- ext Cell LED = Black (Cellular.RSSI() returned > 0 )
Particle cloud disconnected for 7 minutes, triggering timeout condition in a watchdog thread that resets device, after which it works as normal for a while
My take
I find it strange that it’s possible for Particle.connected() to return true when Cellular.RSSI() would return a value indicating disconnection. Cellular.ready() appears to be returning true most of the time the above behavior is occurring.
My signal strength is good where I’m testing - the device should never disconnect due to signal unavailability.
Any thoughts on what could cause this? I will try and monitor with more reporting on the various network change events to see if I can learn anything more.
edit:
there doesn’t appear to be an event for network_status_disconnected - is there any way to detect the loss of cellular connection?
Also, as a make work, I can use that RSSI value to explicitly disconnect from the Particle Cloud if it hits a value indicating bad connection, and maybe also cycle the modem. Since I’m using automatic mode, if I disconnect from the particle cloud and reconnect, but the connect fails, will the system firmware keep managing the reconnection after that like normal or do I need to just manage the whole connectivity?