Interesting to find I am not alone with this issue.
I have been running similar code using Deep Sleep and WiFi off on the photon all week flawlessly until yesterday afternoon, PST, sometime when all I did was change the sleep time, recompiled, and uploaded via WiFi and my code no longer functioned correctly. It behaved very erratically and unpredictably. I went back to the old code and it still didn’t work. Calling Spark Connect is leaving the Photon breathing White most of the time. When it does try to connect it gets stuck in the cloud handshake, flashing cyan rapidly. After 5 or 10 or somtimes 20 minutes of doing this it finally connects only to not go back to sleep again, it turns WiFi off and breathes white completely ignoring the deep sleep command.
I had another photon running the same code from a week ago and running fine. I also re flashed it changing nothing and it too started the same behaviour.
I am using SEMI_AUTOMATIC mode
I am using the Web IDE.
As a side note. Last night all eight of my units suddenly started going offline one after the other flashing red and then trying to reconnect to the cloud, all got stuck during the particle handshake. After about 20 minutes of doing this they all finally reconnected and apparently stayed that way all night. I mention this as this seems somehow related to what is broken either with the cloud or the web IDE or something else.
I have been using the following code for the last 6 months and it seems fairly robust. I save the failures in EEPROM, do a system reset and report where it failed when it finally reconnects. My problem units are all failing during spark connect with cyan flashing rapidly. The blue LED in my code lets me know where in the code it is…
void Go_Online() {
//Wifi Connection Routine
//Connect to Wifi and the cloud. Keep track of any failures and their type and reset the system if connection fails
WiFi.connect();
int i=0;
while (WiFi.ready()==false){
i++;
if (i >= 100) {
EEPROM.write(WCFaddr, 1);
System.reset();
}
digitalWrite(ledblue, HIGH); // turn it on
delay(300); // wait 1 second
digitalWrite(ledblue, LOW); // turn it off
delay(300); // wait another second
}
Spark.connect();
i=0;
while (Spark.connected()==false){
i++;
if (i >= 100) {
EEPROM.write(WCFaddr, 2);
System.reset();
}
digitalWrite(ledblue, HIGH); // turn it on
delay(60); // wait 1 second
digitalWrite(ledblue, LOW); // turn it off
delay(60); // wait another second
}
// End Wifi Connection routine
// Wifi or Cloud connection recovery noticication
// Once connected to the cloud, if there was a previous connection failure report it at this time
if (WCF>0) {
switch(WCF) {
case 1:
Particle.publish("FailureMode", "Reset, failed to connect to Wifi");
break;
case 2:
Particle.publish("FailureMode", "Reset, failed to connect to Spark Cloud");
break;
}
WCF=0;
EEPROM.write(WCFaddr, WCF);
}
// End of recovery notification
}
Sorry for the long post, I hope it is helpful in tracking down the anomaly.
I’ll add this little tidbit here too as it seems to be related. I have a Core that has been running for 3 months continuously checking in every minute with weather and sunlight data. Today it is getting stuck during the particle handshake for several minutes before finally succeeding. Nothing has changed on this device. Seems like a particle cloud issue.