Skip to content

Conversation

liamcottle
Copy link
Member

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 the onConnected 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:

  • ThinkNode M1
  • Heltec T114
  • RAK4631 WisMesh Pocket

The PR only makes the change on nrf52, as the esp32 SerialBLEInterface appears to mark devices as connected in the onMtuChanged 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.

@liamcottle
Copy link
Member Author

Fixes #411

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant