-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
Fix BluetoothSerial thinking it's disconnected #7372
Conversation
Currently, if a second connection occur in Bluetooth, this second connection is automatically disconnected (line 284). This disconnection trigger the ESP_SPP_CLOSE_EVT, which clear the bit SPP_CONNECTED. But the first connection remain active, and this flag shouldn't be cleared. This fix the issue, by clearing the flag only if the last connection is closed
Shouldn't similar thing be necessary for line 286 and 287? They would also alter the bits, regardless if connection is first or second. |
First of all, thank you for the PR. Any updates on this @aridet? |
Hi, I don't think lines 286 and 287 are affected by this as we are in the case ESP_SPP_SRV_OPEN_EVT. It is fired when a connection successfully occur. This disable SPP_DISCONNECTED (xEventGroupClearBits disable the flag) and enable SPP_CONNECTED (xEventGroupSetBits set the flag). This seems correct to me. Regards. |
Make sense, thanks for this PR. Approved 👍 |
Currently, if a second connection occur in Bluetooth, this second connection is automatically disconnected (line 284). This disconnection trigger the ESP_SPP_CLOSE_EVT, which clear the bit SPP_CONNECTED. But the first connection remain active, and this flag shouldn't be cleared.
This fix the issue, by clearing the flag only if the last connection is closed
By completing this PR sufficiently, you help us to review this Pull Request quicker and also help improve the quality of Release Notes
Checklist
This entire section above can be deleted if all items are checked.
Description of Change
Please describe your proposed Pull Request and it's impact.
Tests scenarios
Please describe on what Hardware and Software combinations you have tested this Pull Request and how.
(eg. I have tested my Pull Request on Arduino-esp32 core v2.0.2 with ESP32 and ESP32-S2 Board with this scenario)
Related links
Please provide links to related issue, PRs etc.
(eg. Closes #number of issue)