Hi -
I need some (more) help please The idea is to completely turn off the GSM radio (and most other peripherals on the PCB when the device is going into ULP mode to preserve battery life, hence two separate regulators on the PCB.
The process then is to start up, check everything and publish, then shut down everything but the uC and external RTC (Abracon) by turning off the second regulator. All of this seems to be working, but when starting back up, my question is ho to tell the uC to âwaitâ until the device is connected before publishing an event. I am testing with this simple fuel gauge reading, but it works once, shuts dow, starts back up but does not publish. I think I can see why, just not sure how to fix it If I add a longer delay, giving the modem time to connect, before the Particle.publish() command it works, but does not seem like the best way to do things.
void Fuel_Gauge() {
digitalWrite (D4, HIGH); // Peripherals Regulator EN pin
delay(500);
if (Cellular.ready() == true) {
Particle.publish("Capacity: " + String(gauge.getCapacity()) + "mAh", PRIVATE);
delay(500);
Particle.publish("VCELL: " + String(gauge.getVoltage()) + "mV", PRIVATE);
delay(500);
Particle.disconnect(CloudDisconnectOptions().graceful(true).timeout(5s)); // Newly added, found this in the reference docusments and seemed like a good idea to add??
Cellular.disconnect();
Cellular.disconnect();
delay(1000);
digitalWrite (D4, LOW);
} else {}
// Particle.publish("DONE - waiting 60sec", PRIVATE);
delay(120000);
}
I know I should use timers instead of delays, but will get to that still⌠baby steps
Regards, Friedl.