From 2d5b9297e3cba744ede6f877b2d5471fef60ce47 Mon Sep 17 00:00:00 2001 From: m1nl Date: Thu, 24 Apr 2025 00:38:17 +0200 Subject: [PATCH] improve WiFi power saving configuration (stable in current sdk) --- src/mesh/wifi/WiFiAPClient.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mesh/wifi/WiFiAPClient.cpp b/src/mesh/wifi/WiFiAPClient.cpp index 7a56c258b..dd29eb3c5 100644 --- a/src/mesh/wifi/WiFiAPClient.cpp +++ b/src/mesh/wifi/WiFiAPClient.cpp @@ -296,10 +296,12 @@ bool initWifi() #ifdef ARCH_ESP32 WiFi.onEvent(WiFiEvent); WiFi.setAutoReconnect(true); - WiFi.setSleep(false); - // This is needed to improve performance. - esp_wifi_set_ps(WIFI_PS_NONE); // Disable radio power saving +#ifdef WIFI_MAX_PERFORMANCE + esp_wifi_set_ps(config.power.is_power_saving ? WIFI_PS_MIN_MODEM : WIFI_PS_NONE); +#else + esp_wifi_set_ps(config.power.is_power_saving ? WIFI_PS_MAX_MODEM : WIFI_PS_MIN_MODEM); +#endif WiFi.onEvent( [](WiFiEvent_t event, WiFiEventInfo_t info) {