-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
BLE observe fix #216
Merged
Merged
BLE observe fix #216
Conversation
This file contains 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
f888df6
to
4158c77
Compare
This reverts commit 533ace0. We will fix this a different way in a future commit.
The Bluetooth chip on the City and Technic hubs will stop receiving advertisements after a while when observing. It isn't clear why this is happening, but it seems to that there is a bug in the Bluetooth chip firmware that causes it to start filtering out advertisements from an individual advertiser after a while (i.e. it can still be receiving advertisements from one device but stops receiving them from another). Eventually it will stop receiving advertisements from all devices. To work around this, we restart the observation process every 10 seconds. In testing, we were never able to trigger the bug in less than 25 seconds or so. Therefore, 10 seconds should be more than enough to ensure that we never miss an advertisement. Fixes: pybricks/support#1096
This adds a task parameter to pbdrv_bluetooth_stop_observing(). This allows us to partially fix a TODO of waiting for the observation to stop before exiting the MicroPython runtime. Also in the case of the CC2640, pbdrv_bluetooth_stop_observing() can be called from multiple places, so to be safe, we need to make sure each caller has its own task struct to avoid reentrancy issues.
This adds a task parameter to pbdrv_bluetooth_stop_broadcasting(). This allows us to finish the TODO of waiting for the broadcasting to stop before exiting the MicroPython runtime.
70425d6
to
264dfae
Compare
Thanks for this! I'm doing a lot of Bluetooth revisions at the moment, so I'm going to bite the bullet and merge yours as-is and apply my changes on top. |
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.
Fixes: pybricks/support#1096