-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alarm.sleep_memory + alarm.wake_alarm #3816
Conversation
GitHub Actions was failing trying to fetch an Ubuntu package. Added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few comments/questions. Thanks!
Pasting helpful discussion from discord with @igrr about using RTC memory: igrr Yesterday at 1:31 PM |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you!
alarm.sleep_memory
, which is a bytearray-like object (similar tomicrocontroller.nvm
) that can store state between deep sleeps. Implemented only on ESP32-S2, in the RTC slow memory.alarm.wake_alarm
both for real and simulated deep sleep. An object has to be created, so creation has to be delayed until the VM is up after restart.alarm.SleepMemory
, the class for the singletonalarm.sleep_memory
, includes subscript and slice access code that was simply copied fromnvm
. There are some other bytearray-like classes that have similar code. It's not a huge amount of code, It would be nice to unify all that into something generic that was passed the appropriatecommon_hal_*
routines, though it's kind of messy to do in C. I am not going to do that now.Test program (tested both plugged in and on battery power):