mirror of
https://github.com/esphome/esphome.git
synced 2025-09-04 12:22:20 +01:00
preen
This commit is contained in:
@@ -155,10 +155,8 @@ void ESP32BLETracker::loop() {
|
||||
https://github.com/espressif/esp-idf/issues/6688
|
||||
|
||||
*/
|
||||
bool promote_to_connecting = counts.discovered && !counts.connecting;
|
||||
|
||||
if (this->scanner_state_ == ScannerState::IDLE && !counts.connecting && !counts.disconnecting &&
|
||||
!promote_to_connecting) {
|
||||
if (this->scanner_state_ == ScannerState::IDLE && !counts.connecting && !counts.disconnecting && !counts.discovered) {
|
||||
#ifdef USE_ESP32_BLE_SOFTWARE_COEXISTENCE
|
||||
this->update_coex_preference_(false);
|
||||
#endif
|
||||
@@ -167,12 +165,11 @@ void ESP32BLETracker::loop() {
|
||||
}
|
||||
}
|
||||
// If there is a discovered client and no connecting
|
||||
// clients and no clients using the scanner to search for
|
||||
// devices, then promote the discovered client to ready to connect.
|
||||
// clients, then promote the discovered client to ready to connect.
|
||||
// We check both RUNNING and IDLE states because:
|
||||
// - RUNNING: gap_scan_event_handler initiates stop_scan_() but promotion can happen immediately
|
||||
// - IDLE: Scanner has already stopped (naturally or by gap_scan_event_handler)
|
||||
if (promote_to_connecting &&
|
||||
if (counts.discovered && !counts.connecting &&
|
||||
(this->scanner_state_ == ScannerState::RUNNING || this->scanner_state_ == ScannerState::IDLE)) {
|
||||
this->try_promote_discovered_clients_();
|
||||
}
|
||||
|
Reference in New Issue
Block a user