Open
Conversation
0f64ac5 to
0473b6b
Compare
prefs is 5 char length :nerd:
Use millisHasNowPassed() (2's complement safe) instead of direct comparison, consistent with the repeater's sleep timing logic. Co-Authored-By: Wessel <weebl@users.noreply.github.com>
When BLE is enabled but no phone has been connected for 60 seconds, enter a 12s sleep / 3s awake cycle to conserve power while remaining discoverable. On wake, BLE advertising is restarted so phones can reconnect. The cycle exits immediately when a connection is detected. Adds hasPendingConnection() to BaseSerialInterface (defaults to isConnected()). The ESP32 BLE override uses getConnectedCount() > 0 to detect mid-bonding connections, preventing sleep during the authentication handshake. Guarded by #ifndef WIFI_SSID — WiFi builds are unaffected.
0473b6b to
4d49849
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.
PR meshcore-dev#1347 adds power saving for companion radios when BLE is manually disabled by the user. But when the phone simply walks away or goes to sleep, BLE stays enabled and advertising, and the radio stays fully awake. This is wasted power in a common scenario.
This adds a second power-saving mode: when BLE is enabled but no phone has been connected for 60 seconds, enter a 12s sleep / 3s awake cycle. On each wake, BLE advertising is restarted (light sleep powers down the BLE radio) so phones can reconnect. The cycle exits immediately when a connection is detected.
Tested on my Heltec v4 companion and it works. Would be good if other people can test.
Build firmware: Build from this branch
Mirror of meshcore-dev#1686