1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-14 13:55:45 +00:00
This commit is contained in:
J. Nick Koston
2025-11-09 10:06:11 -06:00
parent f106e9ac15
commit ec866c20bd

View File

@@ -873,18 +873,13 @@ WiFiRetryPhase WiFiComponent::determine_next_phase_() {
} }
#ifdef USE_WIFI_FAST_CONNECT #ifdef USE_WIFI_FAST_CONNECT
if (!this->fast_connect_exhausted_) { // Fast connect enabled: try next configured AP or fall back to scan
// Can we try next configured AP? if (this->selected_sta_index_ < static_cast<int8_t>(this->sta_.size()) - 1) {
if (this->selected_sta_index_ < static_cast<int8_t>(this->sta_.size()) - 1) { return WiFiRetryPhase::FAST_CONNECT_CYCLING_APS;
return WiFiRetryPhase::FAST_CONNECT_CYCLING_APS;
} else {
// Exhausted fast_connect, need to scan
return WiFiRetryPhase::SCAN_CONNECTING;
}
} }
#endif #endif
// fast_connect disabled or exhausted // No more fast_connect APs (or fast_connect disabled), fall back to scan
return WiFiRetryPhase::SCAN_CONNECTING; return WiFiRetryPhase::SCAN_CONNECTING;
case WiFiRetryPhase::FAST_CONNECT_CYCLING_APS: case WiFiRetryPhase::FAST_CONNECT_CYCLING_APS:
@@ -947,7 +942,12 @@ void WiFiComponent::transition_to_phase_(WiFiRetryPhase new_phase) {
case WiFiRetryPhase::FAST_CONNECT_CYCLING_APS: case WiFiRetryPhase::FAST_CONNECT_CYCLING_APS:
// Move to next configured AP // Move to next configured AP
this->selected_sta_index_++; this->selected_sta_index_++;
#ifdef USE_WIFI_FAST_CONNECT
this->reset_for_next_ap_attempt_(); this->reset_for_next_ap_attempt_();
#else
this->num_retried_ = 0;
this->scan_result_.clear();
#endif
break; break;
case WiFiRetryPhase::SCAN_CONNECTING: case WiFiRetryPhase::SCAN_CONNECTING: