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

MicroBitUARTService::send can get stuck when client disconnects #407

Open
martinwork opened this issue Nov 17, 2018 · 1 comment · May be fixed by #430
Open

MicroBitUARTService::send can get stuck when client disconnects #407

martinwork opened this issue Nov 17, 2018 · 1 comment · May be fixed by #430

Comments

@martinwork
Copy link
Contributor

uart-sample.zip

See attached sample. I have tested it using the Android "Serial Bluetooth Terminal" app. Sometimes when the client disconnects, the sendAccel fiber stops running (the numbers stop) though microbit hasn't crashed because the letters keep going. It may take a few attempts. It happens more easily if the showText fiber is paused by pressing A. It doesn't restart when the client reconnects.

I suspect send() gets stuck waiting for the the event from on_confirmation() which may not arrive if the client disconnects. This seems to be confirmed by adding serial trace before fiber_wake_on_event() and after schedule().

@martinwork
Copy link
Contributor Author

Just to clarify, I originally saw this issue with hex files from MakeCode. The point of the C++ sample was to confirm that the issue was independent of MakeCode, that it was stuck and not crashed etc.

martinwork added a commit to martinwork/microbit-dal that referenced this issue Mar 10, 2019
Using an onDisconnection callback, trigger the same event as on_confirmation to wake up send() if it's sleeping. Fixes lancaster-university#407.
martinwork added a commit to martinwork/microbit-dal that referenced this issue Mar 10, 2019
From MicroBitBLEManager's bleDisconnectionCallback, trigger the same event as MicroBitUARTService's on_confirmation to wake up send() if it's sleeping. Fixes lancaster-university#407.
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 a pull request may close this issue.

1 participant