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

Fix BluetoothSerial thinking it's disconnected #7372

Merged
merged 3 commits into from
Dec 19, 2022

Conversation

aridet
Copy link
Contributor

@aridet aridet commented Oct 19, 2022

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

  1. Please provide specific title of the PR describing the change, including the component name (eg. „Update of Documentation link on Readme.md“)
  2. Please provide related links (eg. Issue which will be closed by this Pull Request)
  3. Please update relevant Documentation if applicable
  4. Please check Contributing guide

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)

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
@CLAassistant
Copy link

CLAassistant commented Oct 19, 2022

CLA assistant check
All committers have signed the CLA.

@VojtechBartoska VojtechBartoska added the Area: BT&Wifi BT & Wifi related issues label Oct 21, 2022
@me-no-dev
Copy link
Member

Shouldn't similar thing be necessary for line 286 and 287? They would also alter the bits, regardless if connection is first or second.

@VojtechBartoska VojtechBartoska added the Resolution: Awaiting response Waiting for response of author label Nov 16, 2022
@VojtechBartoska
Copy link
Contributor

First of all, thank you for the PR. Any updates on this @aridet?

@aridet
Copy link
Contributor Author

aridet commented Nov 16, 2022

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.
If we are first or second connection, the result is always the same, there is an active connection, so the flags are correct for me.

Regards.

@VojtechBartoska VojtechBartoska added Status: Awaiting triage Issue is waiting for triage and removed Resolution: Awaiting response Waiting for response of author labels Dec 14, 2022
@P-R-O-C-H-Y
Copy link
Member

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. If we are first or second connection, the result is always the same, there is an active connection, so the flags are correct for me.

Regards.

Make sense, thanks for this PR. Approved 👍

@VojtechBartoska VojtechBartoska added this to the 2.0.6 milestone Dec 19, 2022
@me-no-dev me-no-dev merged commit 1ad5406 into espressif:master Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: BT&Wifi BT & Wifi related issues Status: Awaiting triage Issue is waiting for triage
Projects
Development

Successfully merging this pull request may close these issues.

6 participants