Support multiple bonded hosts without requiring factory reset#23
Open
Swissola wants to merge 1 commit into
Open
Support multiple bonded hosts without requiring factory reset#23Swissola wants to merge 1 commit into
Swissola wants to merge 1 commit into
Conversation
Track the current peer BD address in onConnect (extended overload). bleRemoveCurrentBond() removes only that peer's LTK from NVS. The "unpair" JSON command now calls this instead of bleClearBonds(), so each host unpairs itself independently. bleClearBonds() is reserved for factory reset only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
onConnect(BLEServer*, esp_ble_gatts_cb_param_t*)overloadbleRemoveCurrentBond()which removes only the currently connected peer LTK from NVSunpairJSON command now callsbleRemoveCurrentBond()instead ofbleClearBonds(), so each host unpairs itself independentlybleClearBonds()is preserved unchanged and still called on factory resetMotivation
The existing
unpaircommand wipes all stored bonds, which means switching between a home PC and work laptop requires a full factory reset and re-pairing both devices. The ESP32 BLE stack supports up to 7 simultaneous bonds — this change makes full use of that by letting each host manage its own bond independently.Behaviour after this change
{"cmd":"unpair"}removes only its own bondbleClearBonds()Test plan
bleConnected()/bleSecure()/blePasskey()behaviour unchanged🤖 Generated with Claude Code