From c366a91f970c729e628e5406ad19b73cba4c77ff Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 22 Aug 2026 00:22:10 -0500 Subject: [PATCH] [wifi] Keep init_sta and add_sta out of line --- esphome/components/wifi/wifi_component.cpp | 2 ++ esphome/components/wifi/wifi_component.h | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/esphome/components/wifi/wifi_component.cpp b/esphome/components/wifi/wifi_component.cpp index abd95ef898..b8a31f97a3 100644 --- a/esphome/components/wifi/wifi_component.cpp +++ b/esphome/components/wifi/wifi_component.cpp @@ -1017,6 +1017,8 @@ void WiFiComponent::set_ap(const WiFiAP &ap) { } #endif // USE_WIFI_AP +void WiFiComponent::init_sta(size_t count) { this->sta_.init(count); } +void WiFiComponent::add_sta(const WiFiAP &ap) { this->sta_.push_back(ap); } void WiFiComponent::clear_sta() { // Clear roaming state - no more configured networks this->clear_roaming_state_(); diff --git a/esphome/components/wifi/wifi_component.h b/esphome/components/wifi/wifi_component.h index 1738348a3f..14c9f0ad42 100644 --- a/esphome/components/wifi/wifi_component.h +++ b/esphome/components/wifi/wifi_component.h @@ -442,8 +442,9 @@ class WiFiComponent final : public Component { void set_sta(const WiFiAP &ap); // Returns a copy of the currently selected AP configuration WiFiAP get_sta() const; - void init_sta(size_t count) { this->sta_.init(count); } - void add_sta(const WiFiAP &ap) { this->sta_.push_back(ap); } + // Kept out of line: inlining these into the generated setup() grows flash + void init_sta(size_t count); + void add_sta(const WiFiAP &ap); void clear_sta(); #ifdef USE_WIFI_AP