So the problem in the photons (loss of cloud connection, rapid cyan blink, but generally not on the spark core) keeps intermittently occurring w/ the damn microwave, sometimes for another unknown reason. I came up with this code that seems to get the photons back in action:
#include "application.h"
const uint32_t SOFTDELAY10s = 10000UL;
uint32_t lastTime;
volatile int lostconnectionTimeUnix = 0;
void setup(){
//Your normal setup code here
}//setup
void loop() {
if (!Spark.connected()) { //record when photon lost connection
if(Time.now() > (lostconnectionTimeUnix + 6000)) { //try reconnect if disconnected > 6 secs
Spark.connect();
while(!Spark.connected()) {
Spark.process();
}//while(!Spark.connected())
if(lostconnectionTimeUnix == 0) {lostconnectionTimeUnix = Time.now();}
lastTime = millis();
while(millis() - lastTime < SOFTDELAY10s) {Spark.process();}
}//if(Time.now() > (firstlostconnectionTimeUnix + 60000))
}//if (!Spark.connected())
if (Spark.connected()){
//Your normal loop code here
lostconnectionTimeUnix = 0;
}//if (Spark.connected())
}//loop
I’d like to know if this helps you or if anyone has come up w/ something better!
Edit : changed a line because maybe reconnect after 6 secs is better