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()) {
      Particle.disconnect(CloudDisconnectOptions().graceful(true).timeout(5000));
      waitFor(notConnected, 15000);
    }

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

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

Sleep has been revamped completely for DeviceOS LTS.

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

SystemSleepConfiguration config;

  config.mode(SystemSleepMode::HIBERNATE)

    .duration(sleepTimeSeconds*1000);

  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.
https://docs.particle.io/datasheets/app-notes/an028-stop-sleep-cellular/
https://docs.particle.io/datasheets/app-notes/an029-wake-publish-sleep-cellular/