Best method to shut down cellular before going to sleep

I’m using an e-series with OS 3.0.0 and semi-automatic with threading enabled.

I use the below function to disconnect from cellular priop going into sleep (hibernate).

I’ve had a few clients devices getting bicked on this process and am wondering if there’s a more reliable way of shutting down the cellular network. In this cases the last cellular signal strenth was around 15%.

void cellularShutDownProcess() {
  if (Cellular.isOn()) {
    if (Particle.connected()) {
      waitFor(notConnected, 15000);

    if (Cellular.ready() || Cellular.connecting()) {
    }; //option 1
    waitFor(Cellular.isOff, 60000);

I’d suggest letting DeviceOS handle shutting down the modem.

Sleep has been revamped completely for DeviceOS LTS.

1 Like

so just call the sleep function and dont do anything with disconnecting is the best approach?

SystemSleepConfiguration config;



  SystemSleepResult result = System.sleep(config);

Yes, exactly. DeviceOS will ensure the modem turns off.
The code should work - keeping in mind Gen3 does not support a timer for Hibernate

Take a look at the App notes on sleep - it’s a little more involved, but covers just about everything.


This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.