diff --git a/esphome/components/ethernet/ethernet_component.h b/esphome/components/ethernet/ethernet_component.h index 4f30959e40..31f9fa360a 100644 --- a/esphome/components/ethernet/ethernet_component.h +++ b/esphome/components/ethernet/ethernet_component.h @@ -114,12 +114,6 @@ class EthernetComponent : public Component { /// @brief Set arbitratry PHY registers from config. void write_phy_register_(esp_eth_mac_t *mac, PHYRegister register_data); - private: - // Stores a pointer to a string literal (static storage duration). - // ONLY set from Python-generated code with string literals - never dynamic strings. - const char *use_address_{""}; - - protected: #ifdef USE_ETHERNET_SPI uint8_t clk_pin_; uint8_t miso_pin_; @@ -163,6 +157,11 @@ class EthernetComponent : public Component { esp_eth_handle_t eth_handle_; esp_eth_phy_t *phy_{nullptr}; optional> fixed_mac_; + + private: + // Stores a pointer to a string literal (static storage duration). + // ONLY set from Python-generated code with string literals - never dynamic strings. + const char *use_address_{""}; }; // NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables) diff --git a/esphome/components/wifi/wifi_component.h b/esphome/components/wifi/wifi_component.h index 4aa2ad15d4..89b7b1fa41 100644 --- a/esphome/components/wifi/wifi_component.h +++ b/esphome/components/wifi/wifi_component.h @@ -393,12 +393,6 @@ class WiFiComponent : public Component { void wifi_scan_done_callback_(); #endif - private: - // Stores a pointer to a string literal (static storage duration). - // ONLY set from Python-generated code with string literals - never dynamic strings. - const char *use_address_{""}; - - protected: FixedVector sta_; std::vector sta_priorities_; wifi_scan_vector_t scan_result_; @@ -450,6 +444,11 @@ class WiFiComponent : public Component { // Pointers at the end (naturally aligned) Trigger<> *connect_trigger_{new Trigger<>()}; Trigger<> *disconnect_trigger_{new Trigger<>()}; + + private: + // Stores a pointer to a string literal (static storage duration). + // ONLY set from Python-generated code with string literals - never dynamic strings. + const char *use_address_{""}; }; extern WiFiComponent *global_wifi_component; // NOLINT(cppcoreguidelines-avoid-non-const-global-variables)