[solved] Before flash event? (LCD status)

Would anyone know how I could update an LCD display to read something like “Updating…” on detection of an imminent (web based) flash?
Any event I hook into?

You can check for the OTA_FLASH_UPDATE flag but the default firmware will let OTA take precedence the moment it is triggered and your user code will no longer run.

This might involve customising the firmware. :slight_smile:

Ok, that’s too bad for now, would be nice to have a global event handler in which you’d get all sorts of events like connect/disconnect/flash etc and possibly return some value to abort (flashing) in certain situations…

Thanks for the answer Kenneth.

I just found that I can just check the SPARK_FLASH_UPDATE flag and now when an OTA update is triggered my LCD routine simply displays that an update is pending. Not sure what would happen when not using OTA, but for now this will do just fine! thanks

(edit: the user loop is halted, but i’m checking the flag in an interrupt driven timer which is where I update the LCD from)

1 Like

I filed a issue 279 to address exactly this use of allowing the user code be notified when the system “does things”. This question comes up quite often so though it should be addressed. We didn’t reach consensus yet though.

Great, thanks mdma, would be a valuable addition for user feedback, but much more serious situations as well where pumps or whatever MUST be stopped etc.

1 Like