In my application, after some Particle variables are changed in the cloud, I need to restart my Photon. For this I am using System.reset.
When my code was short and simple, things worked well. But now, when System.reset is executed, the Photon seems to restart but never connects back to the cloud until I either recycle power or press the reset button.
What could be causing that? Is there a more reliable was to restart the Photon?
I also noticed that every time after I flash new code, the Photon keeps flashing green after re-flash success. It does not connect to the network until I either recycle power or press the reset button.
I would appreciate the community’s help.
There is an issue about
WiFi.off() without explicitly calling
Particle.disconnect() beforehand, which may well be connected.
Do you mean before I issue
, I need to execute:
I tried the code below. After executing it, the Photon just starts flashing white and nothing happens.
#if (PLATFORM_ID == 0)
// Core code here
#elif (PLATFORM_ID == 6)
// Photon code here
#elif (PLATFORM_ID == 10)
//Electron code here
No, this should not be necessary. That’s the reason why this is filed as issue, but it’d be worth trying whether or not this helps solve the problem.
But naturally, when you switch disconnect and switch off the WiFi, you will need to switch it back on and reconnect after wake.
Thank you @ScruffR.
Is there a “bullet-proof” way to restart the Photon by simulating a “reset” button press? I realize that an additional processor can be used along with a relay but is there a simpler way?
Once the issues are addressed
System.reset() should be just as bullet-proof as one should want.
BTW, the RESET button doesn’t always cure all problems either, that’s something that will also needs to be addressed in the bootup sequence.
I tried to restart system by setting RST pin to LOW. I used:
But the compiler did not recognize the RST pin. How does one refer to that pin in code?
Thanks in advance,
This won’t work, as RST is not a GPIO pin but a dedicated pin with its sole purpose to reset the µC.