From c92d0d3667ad2ec9e3b0687ce4980fc99654cbb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Fri, 11 Apr 2025 12:47:32 +0200 Subject: [PATCH] Make sure the default power saving mode is applied by default (#3370) --- esp-wifi/src/wifi/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/esp-wifi/src/wifi/mod.rs b/esp-wifi/src/wifi/mod.rs index 12a7a438b..41bd8f32f 100644 --- a/esp-wifi/src/wifi/mod.rs +++ b/esp-wifi/src/wifi/mod.rs @@ -36,7 +36,6 @@ use esp_wifi_sys::include::{ esp_eap_fast_config, esp_wifi_sta_enterprise_enable, wifi_pkt_rx_ctrl_t, - wifi_ps_type_t_WIFI_PS_NONE, wifi_scan_channel_bitmap_t, WIFI_PROTOCOL_11AX, WIFI_PROTOCOL_11B, @@ -2595,6 +2594,10 @@ pub fn new<'d>( inited: &'d EspWifiController<'d>, _device: crate::hal::peripherals::WIFI<'d>, ) -> Result<(WifiController<'d>, Interfaces<'d>), WifiError> { + let mut controller = WifiController { + _phantom: Default::default(), + }; + if !inited.wifi() { crate::wifi::wifi_init()?; @@ -2617,14 +2620,11 @@ pub fn new<'d>( esp_wifi_result!(esp_wifi_set_country(&country))?; } - esp_wifi_result!(unsafe { - esp_wifi_sys::include::esp_wifi_set_ps(wifi_ps_type_t_WIFI_PS_NONE) - })?; + controller.set_power_saving(PowerSaveMode::default())?; } + Ok(( - WifiController { - _phantom: Default::default(), - }, + controller, Interfaces { sta: WifiDevice { _phantom: Default::default(),