1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-07 13:52:20 +01:00

[esp32_ble_tracker] Optimize connection by promoting client immediately after scan stop trigger

This commit is contained in:
J. Nick Koston
2025-08-03 20:57:02 -10:00
parent 36c4430317
commit 8d4f1802fb

View File

@@ -238,10 +238,11 @@ void ESP32BLETracker::loop() {
if (this->scanner_state_ == ScannerState::RUNNING) {
ESP_LOGD(TAG, "Stopping scan to make connection");
this->stop_scan_();
} else if (this->scanner_state_ == ScannerState::IDLE) {
// Don't wait for scan stop complete - promote immediately
// The BLE stack processes commands in order through its queue
}
ESP_LOGD(TAG, "Promoting client to connect");
// We only want to promote one client at a time.
// once the scanner is fully stopped.
#ifdef USE_ESP32_BLE_SOFTWARE_COEXISTENCE
ESP_LOGD(TAG, "Setting coexistence to Bluetooth to make connection.");
if (!this->coex_prefer_ble_) {
@@ -250,7 +251,6 @@ void ESP32BLETracker::loop() {
}
#endif
client->set_state(ClientState::READY_TO_CONNECT);
}
break;
}
}