Skip to content

supervisor.set_next_code_file should store across deep sleep #5080

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

Open
hierophect opened this issue Jul 30, 2021 · 0 comments
Open

supervisor.set_next_code_file should store across deep sleep #5080

hierophect opened this issue Jul 30, 2021 · 0 comments

Comments

@hierophect
Copy link
Collaborator

hierophect commented Jul 30, 2021

The implementation of #3454 does not currently behave in an intuitive way when used in conjunction with Deep Sleep. In general, a "sub program" called by supervisor.set_next_file should behave in an identical way to a typical code.py program, so that code examples and copied projects can be used without thinking about whether they've been selected from a menu. However, current programs that use Deep Sleep in conjunction with set_next_file cannot store next file information, since deep sleep shuts down the memory. This means that a "sub-program" in a menu context will return to the menu after true deep sleeping, instead of re-entering the program as it would if it were the "primary" program. To make matters worse, if the deep sleep is fake (connected to usb), it will re-enter properly, making this even less consistent.

Solving this problem is more complicated than it looks. It requires that each port port has alarm.SleepMemory implemented, and needs an extra API to assign a particular region of SleepMemory for "system use" where the set_next_file filename can be stored. In addition, steps must be taken in Main to store the filename only when true deep sleep is entered, and to clear it when appropriate.

I've gotten started on this here, but my STM32 implementation is buggy and the other ports remain unfinished. It will also need an all-new implementation of RP2040 SleepMemory, described in #5081.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants