SYSTEM_THREAD(ENABLED) is not blocking on calls to the modem, so the application thread doesn’t wait for the modem to finish before going to the next instruction in user code. Thus the SLEEP_MODE_SOFTPOWEROFF will not work properly with threading enabled currently.
As a work around you can break out the commands separately and add delays after the commands. The delays need to be longer than the commands could possibly take. 10 seconds after Cellular.on is typically enough, but there is an edge case where the modem doesn’t respond to the power pin being toggled and needs to then be reset after 10 seconds of trying to power it up. So in that case it could take more like 15 - 20 seconds max to power on. Here in code I’ve just used 10 seconds though:
SYSTEM_MODE(SEMI_AUTOMATIC);
SYSTEM_THREAD(ENABLED);
void setup() {
}
void loop() {
Cellular.on();
delay(10000);
Cellular.command("AT+CPWROFF\r\n");
delay(2000);
FuelGauge().sleep();
delay(2000);
System.sleep(SLEEP_MODE_DEEP, 15);
}