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(),