Saving P2 program state when the power goes off?
bob_g4bby
Posts: 584
Very often, the state of a P2 based module requires saving at switch-off and restoring at switch on. We have several good libraries for flash or sd card file management now. However, that begs the question - how to save those critical project variables with the least amount of effort? Saving individual variables would seem to be more work than saving one structure of variables. A smartpin can be made to monitor the unregulated power voltage and the capacitor across the regulated supply ensures there's enough time to save and close the file before the P2 stops. Any hints and tips?
Cheers, bob

Comments
Interesting question ….
Maybe save entire hub to nonvolatile every so often and restore if reboot detected ?
That’d be easy but not sure if would be ok