modem sleep: optimize wifi station modem sleep percentage

This commit is contained in:
Li Shuai 2021-05-12 17:00:01 +08:00
parent 83445ba63e
commit 7fbf7a0d17
2 changed files with 16 additions and 17 deletions

View File

@ -323,7 +323,6 @@ menu "Wi-Fi"
config ESP_WIFI_SLP_IRAM_OPT config ESP_WIFI_SLP_IRAM_OPT
bool "WiFi SLP IRAM speed optimization" bool "WiFi SLP IRAM speed optimization"
depends on FREERTOS_USE_TICKLESS_IDLE
select PM_SLP_DEFAULT_PARAMS_OPT select PM_SLP_DEFAULT_PARAMS_OPT
help help
Select this option to place called Wi-Fi library TBTT process and receive beacon functions in IRAM. Select this option to place called Wi-Fi library TBTT process and receive beacon functions in IRAM.
@ -336,7 +335,7 @@ menu "Wi-Fi"
config ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME config ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME
int "Minimum active time" int "Minimum active time"
range 8 60 range 8 60
default 8 default 50
depends on ESP_WIFI_SLP_IRAM_OPT depends on ESP_WIFI_SLP_IRAM_OPT
help help
The minimum timeout for waiting to receive data, unit: milliseconds. The minimum timeout for waiting to receive data, unit: milliseconds.
@ -344,7 +343,7 @@ menu "Wi-Fi"
config ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME config ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME
int "Maximum keep alive time" int "Maximum keep alive time"
range 10 60 range 10 60
default 60 default 10
depends on ESP_WIFI_SLP_IRAM_OPT depends on ESP_WIFI_SLP_IRAM_OPT
help help
The maximum time that wifi keep alive, unit: seconds. The maximum time that wifi keep alive, unit: seconds.

View File

@ -146,15 +146,15 @@ esp_err_t esp_wifi_deinit(void)
#if CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER #if CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER
tcpip_adapter_clear_default_wifi_handlers(); tcpip_adapter_clear_default_wifi_handlers();
#endif #endif
#if CONFIG_ESP_WIFI_SLP_IRAM_OPT
esp_pm_unregister_light_sleep_default_params_config_callback();
#endif
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE #if CONFIG_FREERTOS_USE_TICKLESS_IDLE
#if SOC_WIFI_HW_TSF #if SOC_WIFI_HW_TSF
esp_pm_unregister_skip_light_sleep_callback(esp_wifi_internal_is_tsf_active); esp_pm_unregister_skip_light_sleep_callback(esp_wifi_internal_is_tsf_active);
esp_pm_unregister_inform_out_light_sleep_overhead_callback(esp_wifi_internal_update_light_sleep_wake_ahead_time); esp_pm_unregister_inform_out_light_sleep_overhead_callback(esp_wifi_internal_update_light_sleep_wake_ahead_time);
esp_sleep_disable_wifi_wakeup(); esp_sleep_disable_wifi_wakeup();
#endif #endif
#if CONFIG_ESP_WIFI_SLP_IRAM_OPT
esp_pm_unregister_light_sleep_default_params_config_callback();
#endif
#endif #endif
#if CONFIG_MAC_BB_PD #if CONFIG_MAC_BB_PD
esp_unregister_mac_bb_pd_callback(pm_mac_sleep); esp_unregister_mac_bb_pd_callback(pm_mac_sleep);
@ -214,17 +214,6 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
} }
#endif #endif
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
#if CONFIG_MAC_BB_PD
if (esp_register_mac_bb_pd_callback(pm_mac_sleep) != ESP_OK
|| esp_register_mac_bb_pu_callback(pm_mac_wakeup) != ESP_OK) {
esp_unregister_mac_bb_pd_callback(pm_mac_sleep);
esp_unregister_mac_bb_pu_callback(pm_mac_wakeup);
return ESP_ERR_INVALID_ARG;
}
#endif
#if CONFIG_ESP_WIFI_SLP_IRAM_OPT #if CONFIG_ESP_WIFI_SLP_IRAM_OPT
esp_pm_register_light_sleep_default_params_config_callback(esp_wifi_internal_update_light_sleep_default_params); esp_pm_register_light_sleep_default_params_config_callback(esp_wifi_internal_update_light_sleep_default_params);
@ -239,6 +228,17 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
esp_wifi_set_keep_alive_time(keep_alive_time_us); esp_wifi_set_keep_alive_time(keep_alive_time_us);
#endif #endif
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
#if CONFIG_MAC_BB_PD
if (esp_register_mac_bb_pd_callback(pm_mac_sleep) != ESP_OK
|| esp_register_mac_bb_pu_callback(pm_mac_wakeup) != ESP_OK) {
esp_unregister_mac_bb_pd_callback(pm_mac_sleep);
esp_unregister_mac_bb_pu_callback(pm_mac_wakeup);
return ESP_ERR_INVALID_ARG;
}
#endif
#if SOC_WIFI_HW_TSF #if SOC_WIFI_HW_TSF
esp_err_t ret = esp_pm_register_skip_light_sleep_callback(esp_wifi_internal_is_tsf_active); esp_err_t ret = esp_pm_register_skip_light_sleep_callback(esp_wifi_internal_is_tsf_active);
if (ret != ESP_OK) { if (ret != ESP_OK) {