Skip to content

Detach power interrupts for sleep#10230

Merged
jp-bennett merged 5 commits intodevelopfrom
power-detach
Apr 22, 2026
Merged

Detach power interrupts for sleep#10230
jp-bennett merged 5 commits intodevelopfrom
power-detach

Conversation

@jp-bennett
Copy link
Copy Markdown
Collaborator

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.

@jp-bennett jp-bennett added the bugfix Pull request that fixes bugs label Apr 21, 2026
@github-actions github-actions Bot added the needs-review Needs human review label Apr 21, 2026
@thebentern thebentern requested a review from Copilot April 21, 2026 20:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 Power to 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.

Comment thread src/power.h
Comment thread src/Power.cpp Outdated
Comment thread src/Power.cpp Outdated
Comment thread src/Power.cpp
Comment thread src/sleep.cpp
@jp-bennett jp-bennett merged commit 28e705d into develop Apr 22, 2026
78 checks passed
@jp-bennett jp-bennett deleted the power-detach branch April 22, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Pull request that fixes bugs needs-review Needs human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants