Wake up on power re-applied?

I haven't tested this, but I'm pretty sure this should work.

When running, monitor the power good flag so you know when the switch is turned off. Disable the BATFET which disconnects the battery from the Electron, causing the Electron to turn off since there's no mains power.

When you wake up, it's because you have mains power. Run the code to reenable the BATFET, reconnecting the battery.

You should use SYSTEM_MODE(SEMI_AUTOMATIC) so you don't connect to cellular before the battery is connected.

This code shows how to enable and disable the BATFET:

3 Likes