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