mirror of
https://github.com/esphome/esphome.git
synced 2026-09-18 18:48:39 +00:00
move ifdef guard to outside if statement
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user