Skip to content

fix(power): arm deep-sleep hold so per-pin gpio_hold_en actually holds - #10438

Closed
DatanoiseTV wants to merge 3 commits into
meshtastic:developfrom
DatanoiseTV:fix/power-deep-sleep-hold
Closed

fix(power): arm deep-sleep hold so per-pin gpio_hold_en actually holds#10438
DatanoiseTV wants to merge 3 commits into
meshtastic:developfrom
DatanoiseTV:fix/power-deep-sleep-hold

Conversation

@DatanoiseTV

Copy link
Copy Markdown
Contributor

doDeepSleep called gpio_hold_en for BUTTON_PIN and LORA_CS, but the
ESP-IDF API contract is that gpio_hold_en alone only covers light
sleep — deep sleep additionally requires gpio_deep_sleep_hold_en
once before esp_deep_sleep_start to arm the holds across the deep-
sleep boundary. Without it the pins float in DSLP, which on some
boards leaks current through LORA_CS and on others triggers
spurious wake from a noisy button line.

Split out from #10425 — single-concern PR.

Build verification

pio run -e t-deck-tft succeeds, no new warnings.

Attestations

  • I have tested that my proposed changes behave as described — review/static-analysis only, not on-air.
  • On-hardware testing requested from community: build-verified t-deck-tft only.

doDeepSleep called gpio_hold_en for BUTTON_PIN and LORA_CS, but the
ESP-IDF API contract is that gpio_hold_en alone only covers light
sleep — deep sleep additionally requires gpio_deep_sleep_hold_en
once before esp_deep_sleep_start to arm the holds across the deep-
sleep boundary. Without it the pins float in DSLP, which on some
boards leaks current through LORA_CS and on others triggers
spurious wake from a noisy button line.
@github-actions github-actions Bot added needs-review Needs human review bugfix Pull request that fixes bugs labels May 9, 2026
@thebentern
thebentern requested a review from Copilot May 9, 2026 18:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes ESP32 deep-sleep GPIO retention by explicitly arming the global deep-sleep hold mechanism so existing per-pin gpio_hold_en() calls (e.g., BUTTON_PIN, LORA_CS) actually persist across the deep-sleep boundary. This prevents pins from floating during deep sleep, which can cause excess current draw and/or spurious activity on some boards.

Changes:

  • Enable ESP32 deep-sleep GPIO holds in doDeepSleep() via gpio_deep_sleep_hold_en() immediately before entering deep sleep.

@thebentern
thebentern requested review from caveman99 and jp-bennett May 9, 2026 21:45
@github-actions github-actions Bot added the Stale Issues that will be closed if not triaged. label Jun 24, 2026
@github-actions github-actions Bot closed this Jul 1, 2026
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 Stale Issues that will be closed if not triaged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants