Error in my code causing Panic reboot loop, can't Flash thru Cloud - remote workarounds?


I’ve made a boo-boo in my code (we’ve all been there) and something is causing a panic loop (my guess is some kind of “segfault” or equivalent – I don’t have physical access to read the SOS code). The point of failure, unfortunately, is encountered on every loop - causing an instant crash when the application code starts to run.

Again, as I don’t (currently) have physical access to the Photon - is there a way for me to remotely inhibit the application code from running via the cloud, so that I can upload fixed code from Build/Dev?

I’ve seen Core crashes due to something in loop(), any way to remotely stop this? but as my code does not have the suggested modification, and I can’t physically LOW a pin - it doesn’t solve this in the short term.

Any suggestions? Or will I just have to factory reset when I have physical access again - or some other kind of reset?

I know that the Photon should enter Safe mode if the application code hangs but not 100% certain. Let’s ping @mdma

There is presently no built-in way to stop the device from launching the application, although this would be a great opt-in addition.

you could for now arrange for your device to delay for say 30 seconds on startup, and subscribe to an event - if the event is received it sets a global variable which stops the application from running. something like this:

bool run = true;

void handleRun(const char* name, const char* data)
   run = false;

void setup()
    Spark.subscribe("skipapp", handleRun);

    if (!run) return;
    // rest of setup

void loop()
    if (!run) return;
   // rest of loop
1 Like