Skip to content

fix(HeavyButter): power down radios during sleep and fix broken deep sleep (AV-002/003)#2519

Open
r13xr13 wants to merge 1 commit into
BruceDevices:mainfrom
r13xr13:fix/deep-sleep-heavybutter
Open

fix(HeavyButter): power down radios during sleep and fix broken deep sleep (AV-002/003)#2519
r13xr13 wants to merge 1 commit into
BruceDevices:mainfrom
r13xr13:fix/deep-sleep-heavybutter

Conversation

@r13xr13

@r13xr13 r13xr13 commented Jun 8, 2026

Copy link
Copy Markdown

HeavyButter Security Audit — Fix AV-002 / AV-003

Finding AV-002 (Fake Sleep): When the user presses "Sleep," only the display backlight turns off. All radios (WiFi, BLE, Sub-GHz, NRF24, IR, RFID) stay powered and active. The device remains on the network.

Finding AV-003 (Broken Deep Sleep): DEEPSLEEP_WAKEUP_PIN defaulted to -1 in precompiler_flags.h:264, which disables deep sleep on any board that does not explicitly define it. Most boards do not.

Fixes:

  • include/precompiler_flags.h: Changed default DEEPSLEEP_WAKEUP_PIN from -1 to 0 (BOOT button, available on all ESP32 dev boards)
  • src/core/mykeyboard.cpp (goToDeepSleep()): Added WiFi.mode(WIFI_OFF) + esp_bt_controller_deinit() before entering deep sleep
  • src/core/settings.cpp (setSleepMode()): Same radio power-down before light sleep

Impact: Sleep now actually powers down radios. Deep sleep works on boards without explicit pin config. Device is no longer a persistent network beacon when the user thinks it is off.

Reference: Forensic audit issue #2511HeavyButter (r13xr13)

…sleep

Two issues:
1. Deep Sleep: DEEPSLEEP_WAKEUP_PIN defaulted to -1, disabling deep
   sleep on most boards. Changed default to 0 (BOOT button).
2. Sleep mode was cosmetic only: display turned off, radios stayed
   active. Fixed by calling WiFi.mode(WIFI_OFF) and
   esp_bt_controller_deinit() before entering both sleep modes.

Fixes AV-002 and AV-003 from the forensic audit (issue BruceDevices#2511)
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.

1 participant