move ifdef guard to outside if statement

This commit is contained in:
Kevin Ahrendt
2025-12-02 15:08:43 -05:00
parent 2a27a3a95a
commit 2821f3041c
4 changed files with 8 additions and 8 deletions
@@ -105,13 +105,13 @@ bool WiFiComponent::wifi_apply_power_save_() {
}
wifi_fpm_auto_sleep_set_in_null_mode(1);
bool success = wifi_set_sleep_type(power_save);
if (success) {
#ifdef USE_WIFI_LISTENERS
if (success) {
for (auto *listener : this->power_save_listeners_) {
listener->on_wifi_power_save(this->power_save_);
}
#endif
}
#endif
return success;
}
@@ -281,13 +281,13 @@ bool WiFiComponent::wifi_apply_power_save_() {
break;
}
bool success = esp_wifi_set_ps(power_save) == ESP_OK;
if (success) {
#ifdef USE_WIFI_LISTENERS
if (success) {
for (auto *listener : this->power_save_listeners_) {
listener->on_wifi_power_save(this->power_save_);
}
#endif
}
#endif
return success;
}
@@ -71,13 +71,13 @@ bool WiFiComponent::wifi_sta_pre_setup_() {
}
bool WiFiComponent::wifi_apply_power_save_() {
bool success = WiFi.setSleep(this->power_save_ != WIFI_POWER_SAVE_NONE);
if (success) {
#ifdef USE_WIFI_LISTENERS
if (success) {
for (auto *listener : this->power_save_listeners_) {
listener->on_wifi_power_save(this->power_save_);
}
#endif
}
#endif
return success;
}
bool WiFiComponent::wifi_sta_ip_config_(const optional<ManualIP> &manual_ip) {
@@ -55,13 +55,13 @@ bool WiFiComponent::wifi_apply_power_save_() {
}
int ret = cyw43_wifi_pm(&cyw43_state, pm);
bool success = ret == 0;
if (success) {
#ifdef USE_WIFI_LISTENERS
if (success) {
for (auto *listener : this->power_save_listeners_) {
listener->on_wifi_power_save(this->power_save_);
}
#endif
}
#endif
return success;
}