Skip to content

Support Wi-Fi during light sleep - #6394

Merged
bugadani merged 8 commits into
esp-rs:mainfrom
bugadani:wifi-light-sleep
Sep 25, 2026
Merged

bugadani merged 8 commits into
esp-rs:mainfrom
bugadani:wifi-light-sleep

Conversation

@bugadani

@bugadani bugadani commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

REGDMA-less variant, so it doesn't achieve the absolute minimum power consumption, but we have to start somewhere before implementing that machinery in a way that it can be part of esp-hal's public API.

Current draw was only tested on the jumpered devkits, C2, C3, S2 and S3 are only functionally tested for now.

Changelog

esp-hal

  • Added: Drivers in other crates can claim a wakeup source with WakeupSource::enable_with_hooks. The entry hook can refuse a light sleep or keep a clock source running (WrappedSleepConfig).
  • Changed: LowPower::sleep_light returns LightSleep. LightSleep::Refused tells that a wakeup source refused the sleep.
  • Changed: ESP32-C6: Light sleep powers down the BBPLL. This decreases the sleep current by approximately 2 mA.
  • Fixed: ESP32-C3/S3: A light sleep that keeps the main crystal on now keeps the bias current and the voltage of the crystal.

esp-rtos

  • Changed: When a wakeup source refuses an automatic light sleep, the idle hook waits for an interrupt.

esp-radio

  • Added: The chip can go into automatic light sleep while the Wi-Fi station uses a power save mode. ESP32 is not supported.
  • Changed: Wi-Fi does not hold a wake lock anymore, except on the ESP32.

@bugadani
bugadani marked this pull request as draft September 24, 2026 19:51
@bugadani
bugadani force-pushed the wifi-light-sleep branch 2 times, most recently from a5c0cf6 to 857c8dd Compare September 24, 2026 20:12
bugadani and others added 8 commits September 25, 2026 09:46
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
A radio driver in another crate can then claim its wakeup source, and refuse the sleeps that are not safe for it.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@bugadani
bugadani marked this pull request as ready for review September 25, 2026 11:07
@bjoernQ

bjoernQ commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Looks good but breaks the ble-advertise-after-sleep reproducer on C6 for me

@bugadani

bugadani commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor Author

That's because the workaround was moved to fa22e21, in #6378. This happened because the PRs' order got swapped.

@bjoernQ bjoernQ 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.

LGTM - we need to double check ble-advertise-after-sleep esp32c6/C6 after #6378

@bugadani
bugadani added this pull request to the merge queue Sep 25, 2026
Merged via the queue into esp-rs:main with commit 9e23177 Sep 25, 2026
35 checks passed
@bugadani
bugadani deleted the wifi-light-sleep branch September 25, 2026 13:58
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