Skip to content
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

DRAFT: Use automatic light sleep for ESP32 alarm sleep #9559

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

EternityForest
Copy link

Follows up on the conversation in #9463 and in Discord.

Draft PR, should be working but not tested in every possible way, posting for discussion purposes.

What this patch does:

  • On ports without native USB, don't consider the console connected once there have been no new bytes for a while
  • Configure UART wakeup(Note: the initial few bytes will always be lost with the hardware UART in sleep)
  • Enables tickless idle but does not actually use it in normal operation
  • When the user does a sleep until alarms, it allows the ESP-IDF to manage sleep/wake/CPU speed for that period

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the initial PR!

Any idea of what functionality will need to disable this light sleep and can you add the "disable" calls for that? Adding it here will make it easier when we find other things impacted by this change.

@@ -175,7 +180,9 @@ bool serial_connected(void) {
#endif

#if CIRCUITPY_CONSOLE_UART
return true;
if (_console_uart_rx_timestamp && (_console_uart_rx_timestamp + (60 * 1024 * 5) > port_get_raw_ticks(NULL))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please breakout the 60 * 1024 * 5 into a macro that is documented with what it means.

@EternityForest
Copy link
Author

EternityForest commented Aug 27, 2024 via email

@tannewt
Copy link
Member

tannewt commented Aug 28, 2024

I'm not exactly sure what would need to disable it, but I think it should be handled already by the ESP-IDF's wake locks API, the ESP won't sleep if one of those is held

Ah ok. So we rely on the IDF to prevent sleep if we have things going on? Sounds good to me.

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

Successfully merging this pull request may close these issues.

2 participants