Fix: BLE pin disappearing too quickly on nrf52 devices #776
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.
This PR fixes the issue where the BLE pin displayed on screen disappears very quickly after connecting, even if you haven't typed the pin in yet. The UI shows
< Connected >
and the user has a bad time unless they memorised the pin quick enough before it disappears.I've switched to using the
onSecured
callback, instead of theonConnected
callback, to mark the device as connected. This callback is fired when pairing has been successful, or when an app reconnects when already previously paired.The BLE pin now stays on screen until the user has successfully paired.
This has been tested, and working on the following devices:
The PR only makes the change on nrf52, as the esp32
SerialBLEInterface
appears to mark devices as connected in theonMtuChanged
callback, which seems to only happen after pairing is complete.I do note that the esp32 class is still using the
checkRecvFrame
to update device connection state, and this should really be refactored to use the callbacks as well, however it has been left as is to keep this PR simple.