[wifi] Guard retry_phase_to_log_string with log level check to fix warning (#15801)

Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
This commit is contained in:
Edvard Filistovič
2026-04-17 13:58:39 +03:00
committed by GitHub
parent cfe8c0eeee
commit 6a46437a5f
@@ -308,6 +308,7 @@ bool CompactString::operator==(const StringRef &other) const {
/// │ - Roaming fail (RECONNECTING on other AP): counter preserved │ /// │ - Roaming fail (RECONNECTING on other AP): counter preserved │
/// └──────────────────────────────────────────────────────────────────────┘ /// └──────────────────────────────────────────────────────────────────────┘
#if ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_INFO
// Use if-chain instead of switch to avoid jump table in RODATA (wastes RAM on ESP8266) // Use if-chain instead of switch to avoid jump table in RODATA (wastes RAM on ESP8266)
static const LogString *retry_phase_to_log_string(WiFiRetryPhase phase) { static const LogString *retry_phase_to_log_string(WiFiRetryPhase phase) {
if (phase == WiFiRetryPhase::INITIAL_CONNECT) if (phase == WiFiRetryPhase::INITIAL_CONNECT)
@@ -326,6 +327,7 @@ static const LogString *retry_phase_to_log_string(WiFiRetryPhase phase) {
return LOG_STR("RESTARTING"); return LOG_STR("RESTARTING");
return LOG_STR("UNKNOWN"); return LOG_STR("UNKNOWN");
} }
#endif // ESPHOME_LOG_LEVEL >= ESPHOME_LOG_LEVEL_INFO
bool WiFiComponent::went_through_explicit_hidden_phase_() const { bool WiFiComponent::went_through_explicit_hidden_phase_() const {
// If first configured network is marked hidden, we went through EXPLICIT_HIDDEN phase // If first configured network is marked hidden, we went through EXPLICIT_HIDDEN phase