Photon breathes green without calling WiFi.connect()

Hello,
In my application, I am using a Photon with version 7.0, SYSTEM_THREAD(ENABLED) and SYSTEM_MODE(MANUAL) (I call Particle.process() regularly in loop()). When credentials are available, I call Particle.connect() and that generally works. When credentials are not available, I call WiFi.off(). To have the user input credentials, I use WiFi.listen(), which is then followed by Particle.connect() when credentials are entered (this works just fine). The big take away is that I never call WiFi.connect().
This month I noticed two Photons were breathing green. They had been like that (disconnected from the cloud) for a few hours. Resetting them fixed the issue. I do not know if it has happened with other Photons that happened to have recovered nor tried to see if self recovery will happen with time once I see a Photon breathing green (but I plan to try it next time if possible). But regardless, should I ever see breathing green if I only call Particle.connect() and never WiFi.connect() (I actually call Particle.connect() when credentials exist and Particle.connected() is false; because it is multi-threaded, I assume Particle.connect() is called regularly until Particle.connected() is true)?
Any input is greatly appreciated.

My guess is that since you’re using MANUAL mode, the cloud is getting disconnected. It could do so because of an internet interruption, or the cloud side could have initiated a disconnect-reconnect sequence.

In SEMI_AUTOMATIC mode, the cloud will reconnect automatically. In MANUAL mode, you need to detect this and reconnect, otherwise you’ll go into breathing green (Wi-Fi up, cloud down).

Hello and thanks for the response! So in loop(), I basically have if (!Particle.connected()) Particle.connect() (it gets called at the frequency with which loop runs, and I don’t believe I have blocking code, plus system thread is enabled).

You should not call Particle.connect() repeatedly as that would interfere with any ongoing connection process due to the fact that Particle.connect() is not blocking when using SYSTEM_MODE(ENABLED) and SYSTEM_MODE(MANUAL).

1 Like

Good point ScruffR, but does the system firmware not have something that accounts for this? I ask because I have had this firmware setup since 2016 and through multiple system firmware versions and it has never been an issue.
Will calling it once keep trying to connect indefinitely? Or is there a way I could tell if it gave up and stopped trying to connect? Unlike WiFi.connecting(), there doesn’t seem to be a Particle.connecting().

Final bump, any other comments? :slightly_smiling_face:

Ping @rickkas7 :smile: