Make sure the default power saving mode is applied by default (#3370)

This commit is contained in:
Dániel Buga 2025-04-11 12:47:32 +02:00 committed by GitHub
parent 0e7b1c3b8d
commit c92d0d3667
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,6 @@ use esp_wifi_sys::include::{
esp_eap_fast_config, esp_eap_fast_config,
esp_wifi_sta_enterprise_enable, esp_wifi_sta_enterprise_enable,
wifi_pkt_rx_ctrl_t, wifi_pkt_rx_ctrl_t,
wifi_ps_type_t_WIFI_PS_NONE,
wifi_scan_channel_bitmap_t, wifi_scan_channel_bitmap_t,
WIFI_PROTOCOL_11AX, WIFI_PROTOCOL_11AX,
WIFI_PROTOCOL_11B, WIFI_PROTOCOL_11B,
@ -2595,6 +2594,10 @@ pub fn new<'d>(
inited: &'d EspWifiController<'d>, inited: &'d EspWifiController<'d>,
_device: crate::hal::peripherals::WIFI<'d>, _device: crate::hal::peripherals::WIFI<'d>,
) -> Result<(WifiController<'d>, Interfaces<'d>), WifiError> { ) -> Result<(WifiController<'d>, Interfaces<'d>), WifiError> {
let mut controller = WifiController {
_phantom: Default::default(),
};
if !inited.wifi() { if !inited.wifi() {
crate::wifi::wifi_init()?; crate::wifi::wifi_init()?;
@ -2617,14 +2620,11 @@ pub fn new<'d>(
esp_wifi_result!(esp_wifi_set_country(&country))?; esp_wifi_result!(esp_wifi_set_country(&country))?;
} }
esp_wifi_result!(unsafe { controller.set_power_saving(PowerSaveMode::default())?;
esp_wifi_sys::include::esp_wifi_set_ps(wifi_ps_type_t_WIFI_PS_NONE)
})?;
} }
Ok(( Ok((
WifiController { controller,
_phantom: Default::default(),
},
Interfaces { Interfaces {
sta: WifiDevice { sta: WifiDevice {
_phantom: Default::default(), _phantom: Default::default(),