diff --git a/components/esp_wifi/include/esp_private/wifi.h b/components/esp_wifi/include/esp_private/wifi.h index 5487286bfe..ca7d636454 100644 --- a/components/esp_wifi/include/esp_private/wifi.h +++ b/components/esp_wifi/include/esp_private/wifi.h @@ -613,6 +613,11 @@ esp_err_t esp_wifi_internal_set_spp_amsdu(wifi_interface_t ifidx, bool spp_cap, */ void esp_wifi_internal_update_light_sleep_default_params(int min_freq_mhz, int max_freq_mhz); +/** + * @brief Update WIFI modem sleep default parameters + */ +void esp_wifi_internal_update_modem_sleep_default_params(void); + /** * @brief Set the min active time for wifi to enter the sleep state when light sleep * diff --git a/components/esp_wifi/src/wifi_init.c b/components/esp_wifi/src/wifi_init.c index 8d23390e81..3e2707f0a0 100644 --- a/components/esp_wifi/src/wifi_init.c +++ b/components/esp_wifi/src/wifi_init.c @@ -330,13 +330,16 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config) } #endif -#if CONFIG_PM_ENABLE && CONFIG_ESP_WIFI_SLP_IRAM_OPT +#if CONFIG_ESP_WIFI_SLP_IRAM_OPT +#if CONFIG_PM_ENABLE int min_freq_mhz = esp_pm_impl_get_cpu_freq(PM_MODE_LIGHT_SLEEP); int max_freq_mhz = esp_pm_impl_get_cpu_freq(PM_MODE_CPU_MAX); esp_wifi_internal_update_light_sleep_default_params(min_freq_mhz, max_freq_mhz); esp_pm_register_light_sleep_default_params_config_callback(esp_wifi_internal_update_light_sleep_default_params); - +#else + esp_wifi_internal_update_modem_sleep_default_params(); +#endif #endif uint32_t min_active_time_us = CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME * 1000;