feat: add Stop() to power down Wi-Fi driver - #63
Open
hnw wants to merge 1 commit into
Open
Conversation
hnw
force-pushed
the
wifi-stop-powersave
branch
from
August 17, 2026 12:48
ae1ead9 to
87b9929
Compare
Expose esp_wifi_stop() as espradio.Stop() to save power when the network is occasionally used. On an M5Stack Fire, stopping the radio drops system current by ~50 mA. API Note: Stop() does not undo Enable(). Init-time state (ISR registration, scheduler ticker) remains. The caller must re-establish association and DHCP after a subsequent Start(). Implementation details: - Stop() blocks until the blob posts the WIFI_EVENT_STA_STOP event or a 15-second timeout expires, mirroring the Connect() behavior.
hnw
force-pushed
the
wifi-stop-powersave
branch
from
August 17, 2026 14:54
87b9929 to
ca75f53
Compare
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.
Summary
Adds
espradio.Stop()to stop the Wi-Fi interface (callsesp_wifi_stop()).Enable(). Init-time state (ISR registration, scheduler ticker, etc.) remains. The caller must re-establish association and DHCP after a subsequentStart().Motivation
To save power for applications that only need the network occasionally.
On an M5Stack Fire (ESP32), adding
Stop()between sync cycles dropped system current by ~50 mA (0.21 A -> 0.16 A).Implementation details
esp_wifi_stopis already in the vendored headers.Stop()blocks until theWIFI_EVENT_STA_STOPevent is received (with a 15-second timeout), mirroring the synchronization pattern used inConnect().Testing & Notes
Connect-> DHCP -> DNS -> NTP ->Stop->Start.wifi: nan is nullis emitted by ESP-IDF during stop. This is harmless.nmonly).