Does the photon know when it is about to be flashed/restarted

Not through a power failure, but does the photon know when it is about to be flashed/restarted?

I have an issue where I have a connected atmega which shares power, but during startup, the pins go a bit haywire on the photon causing chaos on the atmega - so I implemented a quick run once so that the atmega doesn’t respond to the pin flickering until the photon sends a ready signal (on the first power up).

However, if I flash the photon after boot, the atmega does not restart (obviously) and so I wanted the photon to reset the atmega on its own reboot.

Is there a pre-restart warning stage to the photon where it could do this? Or can anyone provide another solution?

Hmm, I am not entirely clear on which particular event you need but a photon starting event is of course setup(). Additionally, if you like to know when an OTA is happening, you can do so by adding a system event:

somewhere in your setup() add:

System.on(firmware_update, onFirmwareUpdate);

And add this method elsewhere:

void onFirmwareUpdate(system_event_t event, int param) {
// your code here

1 Like

You can also use this

There is also a reset event you can subscribe to via System.on()