I have been working with Particle for years, so by no means am I newbie, but this one is driving me nuts. If I use any System.sleep() function, when the Electron comes back awake it stays in the flashing green mode and never reconnects. Below is a simple program that counts 5 seconds then goes to sleep for 30 seconds. My application requires 1 minute measurements, then a one hour publish of the data.
What am I missing?
Thanks!
int count = 0;
SYSTEM_MODE(MANUAL);
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.println("Particle Status:");
Serial.println(Particle.connected());
if(!Particle.connected()){
Serial.println("Particle Not Connected!");
Particle.connect();
waitUntil(Particle.connected);
Serial.println("Particle Connected");
// Request hard time sync to negate drift,
// and finish cell processes
Particle.syncTime();
waitUntil(Particle.syncTimeDone);
}
count++;
Serial.println(count);
delay(1000);
if(count>5){
Cellular.disconnect();
Cellular.off();
while(Cellular.ready()) {
Particle.process(); // or delay(1); maybe
}
System.sleep(SLEEP_MODE_DEEP, 30);
}
}