I’ve just recently started working with SYSTEM_THREAD(ENABLED) so that in the case of a temporary disconnect I can buffer up sensor readings and then publish them later.
It seems to be working well with essentially no other modifications to my code, but last night I discovered that my Photon was in the rapid cyan blink mode (no intermittent red or green, just cyan for as long as I watched it), I tried attaching with serial monitor, and as expected my printf-style debugging user code was blocked so yield no hints.
I guess my question is what are the possible causes of a never-ending rapid cyan blink, my internet connection was otherwise working (and when I eventually reset the photon it connected again properly).
The most common cause of rapid blinking cyan with red or orange blinks is a keys error, but since you don’t have red or orange blinking, it is probably something else.
You can try this program which will print additional information to the USB serial port:
Rick, in your logging, have seen any patterns in when the device disconnects and reconnects to the cloud? I’ve been logging 2 devices to see if they tend to lose connection at the same time. The result was, that they mostly don’t do it at the same time (I think I only saw 2 times where both devices disconnected at the same time). Some days, I see nothing, other days, it will disconnect from the cloud 5 or 6 times, then reconnect, usually within 10 seconds.
The one situation where I’m seeing unending rapid cyan (until reset) is when I have a whole house power outage. When the power comes back, the Photon starts up quickly but the cable modem and router can take a few minutes to come back up. I’m not sure why it sometimes doesn’t reconnect under these conditions; it doesn’t happen all the time (like when I try to test it - only after middle of the night storm outages it seems).
So it sounds like others are having this same kind of thing? I was wondering if was related to enabling threading? That’s really the only thing I’ve changed before noticing this (and I don’t know how to reproduce the issue unfortunately )
I’m still in Automatic mode… I don’t do any deep sleeping or anything… just some Cloud Variables, and calls to Particle.publish() that I handle specially if it returns false.
There are too many possible causes to answer that, but one cause may be when the device is running out of heap space due to heap fragmentation, most commonly caused by excessive use of
So seeing your code might help.
This is helpful Scruff. I was under the impression that the rapid cyan flash was something to do with Threaded mode or doing some Particle.publish while not connected. If it’s some other kind of memory leak or badness in my code I’ll find it out. I just wanted to eliminate the possibility that I was misusing something.
Are there tips on String usage? I do use them a lot (for debugging, formatting data before publish, formatting data for cloud variables…)
char or at least only use a couple of global
String objects with a big enough, pre-reserved buffer to prevent relocation due to growth.
Alright, I have completely de-String-ified my firmware. I hope past ghosts of sprintf with %f don’t haunt me