Detach power interrupts for sleep#10230
Merged
jp-bennett merged 5 commits intodevelopfrom Apr 22, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR aims to improve ESP32 light-sleep stability (notably on T-Watch S3) by ensuring power-related GPIO interrupts are detached before entering light sleep and reattached afterward, avoiding conflicts with sleep wake GPIO configuration.
Changes:
- Add light-sleep begin/end observers in
Powerto detach/reattach power interrupts on ESP32. - Refactor power interrupt setup into
attachPowerInterrupts()/detachPowerInterrupts(). - On ESP32 GPIO wake from light sleep, force the power subsystem to run ASAP.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/sleep.cpp |
On GPIO wake, logs a simpler message and schedules Power to run immediately after light sleep. |
src/power.h |
Exposes Power as a public OSThread and adds ESP32 light-sleep observer callbacks plus attach/detach interrupt APIs. |
src/Power.cpp |
Implements interrupt attach/detach helpers and registers light-sleep observers to detach/reattach power interrupts. |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Discovered this potential issue while troubleshooting crashes with #9855 . On ESP32 we generally detach GPIO interrupts before sleeping, but for whatever reason we don't do so in power.cpp. This seems to make the T-watch-s3 a bit more stable.