Powersaving on companion when serial is off (ble/wifi) #1347
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 power saving to the companion radio when BLE/WiFi is disabled by the user. When the serial interface is off (and GPS is not enabled), the device enters ESP32-S3 light sleep for 30-minute intervals, significantly reducing power consumption for battery-powered companion nodes that are left running as pure relays.
Changes
Light sleep in companion radio (
examples/companion_radio/main.cpp)serial_interface.isEnabled()is false and GPS is offWiFi radio actually turns off (
src/helpers/esp32/SerialWifiInterface.cpp/h)disable()now callsWiFi.disconnect(true)andWiFi.mode(WIFI_OFF)to power down the radioenable()reconnects using stored SSID/password credentialsdisable()only set a flag — the WiFi radio stayed powered onButton wakeup with correct polarity (
src/helpers/ESP32Board.h)enterLightSleep()accepts optionalpin_wake_btnparameter (backward-compatible)GPIO_INTR_LOW_LEVEL) for button — correct for active-LOW buttonsANY_HIGH) for LoRa DIO1 only — these can't share a mask since they need opposite trigger levelsPending work detection (
examples/companion_radio/MyMesh.cpp/h)hasPendingWork()checks outbound packet queue to avoid sleeping while packets are queuedNotes
CONFIG_IDF_TARGET_ESP32S3)PIN_USER_BTNgracefully skip button wakeupsleep()still callsenterLightSleep(secs)without button