Skip to content
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

Pairing mode starts advertising and shows the tick before pairing info is saved to flash #414

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

microbit-sam
Copy link
Contributor

@microbit-sam microbit-sam commented Jan 3, 2019

#340

In MicroBitBLEManager, bleDisconnectionCallback calls advertise() immediately but defers saving of the pairing info to the idle callback. The delay is only a few milliseconds, but seems to be long enough for a waiting client device to reconnect before the save to flash. I noticed this seemed to cause a problem when pairing with Windows and I understand this may be causing a problem with some Android clients.

securitySetupCompletedCallback sets the flags that trigger the LEDs tick and the disconnect-and-save sequence in the idle callback. If "PAIRING MODE!" has finished scrolling, the delay between tick and save is probably long enough for a user waiting for the tick to reset micro:bit before the pairing info is saved.

The disconnect-and-save idle callback is not created until "PAIRING MODE!" has finished scrolling. If a user or client device does not need to wait for the LEDs histogram or pairing code display, the client device may be informed that pairing has completed 6 seconds or more before the pairing info is saved.

@microbit-sam microbit-sam requested a review from finneyj January 3, 2019 10:21
@microbit-sam
Copy link
Contributor Author

@martinwork tried to tag you as a review but couldn't!

@martinwork
Copy link
Contributor

pairingComplete doesn't look right. I'm sorry - it looks like I have said something very similar "Looks good" before here: #340 (comment).

The tick or cross will show when MICROBIT_BLE_PAIR_COMPLETE is set. So the idea is to delay setting that for the success case until the info is saved in idleTick.

If I am following right, this PR just moves it down a line. I think pairingComplete needs to be like in this comment: #340 (comment)

@microbit-sam
Copy link
Contributor Author

microbit-sam commented Jan 7, 2019

You're right, looks like I didn't actually finish this one off. Thanks Martin

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.

3 participants