I recently replaced a Boron with a Photon (after implementing a WiFi extender from a building a few hundred feet away). I added an external antenna to the Photon to achieve (successfully) maximum signal level. My application ran perfectly for many hours (see attached screenshot)
but then went off line. The cyan LED is now on steady, i.e. no “breathing”. Removing and restoring power, i.e. re-booting, results in about 3 “breaths” and then the LED goes back to steady.
The official Photon documentation says “In most cases, solid colors are the side effect of a bug. If code crashes or infinitely loops with interrupts disabled, it’s possible that the LED animation will stop. The color of the LED is the color it last was before failure. So for example, it could be solid cyan if it was previously breathing cyan, or solid red if it was trying to output an SOS pattern.”
Can anyone offer and explanation or solution? If it is a bug in my firmware, why would it take several hours to manifest itself? In case it is, indeed, a problem with my code, here it is:
#include <NCD2Relay.h>
NCD2Relay controller;
String data = String(10);
static unsigned long lastPumpUpdate = millis();
int previousStatus;
int status;
unsigned long publishInterval = 300000;
unsigned long lastPublish = millis();
unsigned long lastReset = millis();
bool linkUp = true;
STARTUP(WiFi.selectAntenna(ANT_EXTERNAL));
void setup()
{
controller.setAddress(0,0,0);
int status = controller.readInputStatus(3); // Read input terminal 2
previousStatus = status;
Particle.publish("IO", String(status), 60, PRIVATE);
lastPublish = millis();
lastReset = millis();
lastPumpUpdate = millis();
linkUp = true;
}
void loop()
{
if ( millis() > lastReset + 3600000 ){ // Reinitialize the MCP23008 chip on the NCD relay board every hour
controller.setAddress(0,0,0); // Reinitialize the MCP23008 chip on the NCD relay board
lastReset = millis(); // Reset last initialization time to current program time
}
if ( millis() > lastPublish + publishInterval ){ // Send float switch status every 5 minutes
int status = controller.readInputStatus(3); // Read input terminal 3
previousStatus = status;
Particle.publish("IO", String(status), 60, PRIVATE);
lastPublish = millis();
}
}
If I need to modify/embellish the code, how do I get it onto the Photon if it’s off-line? Reset to factory defaults and start all over again?
On an unrelated matter: I notice that all three of my Photons (when on-line) occasionally populate the event log with entries as shown in another screenshot. They appear to just be status updates rather than reports of some problem. Is there a way to suppress these reports from the event log?
Thanks in advance for any advice.