I have a photon that open and closes irrigation using relay.
it all works sometimes for weeks without any issue but then it stuck.
led in on without blink on cyan, and loop is stuck no trace or anything else…
the only thing to do is restart.
I’m using latest firmware and about to give up, please help
to assess the whole code, we’d also need to see the implementation of the timing class
if you are not using SparkIntervalTimer remove them from the project
what version are you targeting? With 0.7.0 you would run into issues with this ApplicationWatchdog wd(300000, System.reset);
change instructions like appLog.info("got OPEN_SET_POINT:" + String(openSetpoint) ); the same way as you’ve already written appLog.info("got sensor val:%.2f" ,sensorValue ) - String objects may (over time) lead to issues
Any "constant" or static colour - if not controlled by user code - indicates a Device OS deadlock of some sort.
Since we can't see the declaration of the class (timing.h) I'm going to assume your timing variables are uint32_t or unsigned long, right? Anyway long intvl should also be unsigned.
BTW, is this intended, that when you only ask isEnded() that the endTime is actually set? Seems somewhat counterintuitive.
Don’t use delay(150); in loop(). Instead replace it with a non-blocking millis() timer set for 150ms. You can then move the wd.checkin() after the delay if you wish.
Your ‘timing’ class is essentially a millis() timer. Personally, I would use a Software Timer set to the desired interval. The timer callback can set a “done” flag that you can read and reset in your code. This will simplify things a lot. This would apply to both IrrigstionTimer and myTimer.
The ubidots library may be blocking. In setup() you wait for Particle.connected but you don’t test if the WiFi is actually connected before calling getAllUbiData().