From 828a27b1b6524d46f192938f3a7a90c38c042e2b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 2 Jan 2026 22:53:42 -1000 Subject: [PATCH] reduce some code size --- esphome/components/wifi/wifi_component.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index 634691a6d81..35b521cc28d 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -1968,11 +1968,6 @@ void WiFiComponent::check_roaming_(uint32_t now) { if (!this->post_connect_roaming_) return; - // Guard: not for hidden networks (may not appear in scan) - const WiFiAP *selected = this->get_selected_sta_(); - if (selected == nullptr || selected->get_hidden()) - return; - // Guard: attempt limit if (this->roaming_attempts_ >= ROAMING_MAX_ATTEMPTS) return; @@ -1990,6 +1985,11 @@ void WiFiComponent::check_roaming_(uint32_t now) { if (current_rssi == WIFI_RSSI_DISCONNECTED) return; + // Guard: not for hidden networks (may not appear in scan) + const WiFiAP *selected = this->get_selected_sta_(); + if (selected == nullptr || selected->get_hidden()) + return; + this->roaming_last_check_ = now; ESP_LOGD(TAG, "Roaming: scanning for better AP (current RSSI %d dBm)", current_rssi); this->roaming_scan_active_ = true;