-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve BLE reliability #269
Improve BLE reliability #269
Conversation
7e74e94
to
def3d7b
Compare
tested an RPi4 with built in Bluetooth today to a 2021 M3 and could not fault it. about 25 commands, no timeouts. This seems heaps better. It also seems faster as well. |
Tested on RPI3+ with built in bluetooth and it is working very good! Thank you for your effort. |
def3d7b
to
6064eb4
Compare
- Increase timeouts for BLE dialer and listener - Retry initial connection on non-fatal errors until context expires - Tweak scanning interval to reflect BLE advertisement parameters Ideas for future improvements: - Retry connection using client MAC address instead of scanning - Optimize scanning interval - Adjust timeouts using caller context
6064eb4
to
cc3bf12
Compare
I wrote this in #253 but since it is closed, I also write it here. Tested the new code with several adapters I have. It works a bit faster for BT 5.0 adapter but it broke the BT4.x support. That is due to using the Extended Adv features that were introduced starting with BT 5.0 and not known for the BT4.2 adapter I have. vehicle-command/pkg/connector/ble/device_linux.go var scanParams = cmd.LESetScanParameters{ Here are the possible values: If it is really needed to use the extended features from BT5.x it can be possible to request the local adapter BT version in the beginning of the handshake so the BLE can use ScanningFilterPolicy: 0 when the BT version is below 5.0. I see go-ble package has the function ReadLocalVersionInformation available. |
Description
Improve BLE connection reliability:
Future improvements (deferred to get the existing improvements merged sooner):
Fixes #253
Type of change
Please select all options that apply to this change:
Checklist:
Confirm you have completed the following steps: