Is there a way to apply a remote reset to device using the dashboard?
Not that I know of, but you can add this e.g. via a Particle.function()
that issues a System.reset()
.
… or a Particle.subscribe()
handler, or a watchdog that expects regularly sent events, or …
I tried doing this. It works, but triggering the Particle.function() from the Particle console returns an error (“Bummer! Failed to call Reset”) to the dashboard - I presume because the reset places the device offline and it therefore cannot return its status to Particle. I’m sure there must be a clever way around this?
Hi @fguptill
Set a flag in your Particle function so that it can return its value, then later in loop check the flag (possible delay for some time to allow the return message) and then do the reset.
Brilliant. That will work. Thanks bko.
Below is a starting point. You would call the function by typing “true” in the console
#define DELAY_BEFORE_REBOOT 2000
unsigned int rebootDelayMillis = DELAY_BEFORE_REBOOT;
unsigned long rebootSync = millis();
bool resetFlag = false;
void setup()
{
// Remote Reset Particle Function
Particle.function("reset", cloudResetFunction);
} // End Setup()
void loop() {
// User Code Here
// Remote Reset Function
if ((resetFlag) && (millis() - rebootSync >= rebootDelayMillis)) {
// do things here before reset and then push the button
Particle.publish("Debug", "Remote Reset Initiated", 300, PRIVATE);
System.reset();
}
} // End Loop ()
// Remote Reset Function
int cloudResetFunction(String command) {
resetFlag = true;
rebootSync = millis();
return 0;
}