Skip to content

Commit 1ad5406

Browse files
aridetSuGlider
andauthored
Fix BluetoothSerial thinking it's disconnected (#7372)
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 Co-authored-by: Rodrigo Garcia <[email protected]>
1 parent 72e79f0 commit 1ad5406

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: libraries/BluetoothSerial/src/BluetoothSerial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,8 @@ static void esp_spp_cb(esp_spp_cb_event_t event, esp_spp_cb_param_t *param)
301301
xEventGroupSetBits(_spp_event_group, SPP_DISCONNECTED);
302302
xEventGroupSetBits(_spp_event_group, SPP_CONGESTED);
303303
xEventGroupSetBits(_spp_event_group, SPP_CLOSED);
304+
xEventGroupClearBits(_spp_event_group, SPP_CONNECTED);
304305
}
305-
xEventGroupClearBits(_spp_event_group, SPP_CONNECTED);
306306
} else {
307307
log_e("ESP_SPP_CLOSE_EVT failed!, status:%d", param->close.status);
308308
}

0 commit comments

Comments
 (0)