feat(wifi): add softap csa&dtim&wait_bcast_data setting and ignore err nodata v5.2

This commit is contained in:
wangtao@espressif.com 2024-07-05 10:55:10 +08:00
parent db8df15ee7
commit cd0ffdac12
7 changed files with 44 additions and 14 deletions

View File

@ -1925,7 +1925,7 @@ ieee80211_send_deauth = 0x40002120;
ieee80211_alloc_deauth = 0x40002124;
ieee80211_send_proberesp = 0x40002128;
ieee80211_getcapinfo = 0x40002130;
sta_rx_csa = 0x40002134;
/* sta_rx_csa = 0x40002134; */
/* sta_recv_sa_query_resp = 0x40002144; */
ieee80211_set_max_rate = 0x4000214c;
ic_set_sta = 0x40002150;

View File

@ -327,17 +327,30 @@ menu "Wi-Fi"
int "Minimum active time"
range 8 60
default 50
depends on ESP_WIFI_SLP_IRAM_OPT
help
The minimum timeout for waiting to receive data, unit: milliseconds.
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station enters the active state,
it will work for at least ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME. If a data packet is received or sent
during this period, the time will be refreshed. If the time is up, but the station still has packets
to receive or send, the time will also be refreshed. unit: milliseconds.
config ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME
int "Maximum keep alive time"
range 10 60
default 10
depends on ESP_WIFI_SLP_IRAM_OPT
help
The maximum time that wifi keep alive, unit: seconds.
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. If no packet has been
sent within ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME, a null data packet will be sent
to maintain the connection with the AP. unit: seconds.
config ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME
int "Minimum wait broadcast data time"
range 10 30
default 15
help
Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station knows through the beacon
that AP will send broadcast packet, it will wait for ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME
before entering the sleep process. If a broadcast packet is received with more data bits, the time
will refreshed. unit: milliseconds.
config ESP_WIFI_FTM_ENABLE
bool "WiFi FTM"

View File

@ -618,13 +618,13 @@ 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 Set the delay time for wifi to enter the sleep state when light sleep
* @brief Set the min active time for wifi to enter the sleep state when light sleep
*
* @param return_to_sleep_delay: minimum timeout time for waiting to receive
* @param min_active_time: minimum timeout time for waiting to receive
* data, when no data is received during the timeout period,
* the wifi enters the sleep process.
*/
void esp_wifi_set_sleep_delay_time(uint32_t return_to_sleep_delay);
void esp_wifi_set_sleep_min_active_time(uint32_t min_active_time);
/**
* @brief Set wifi keep alive time
@ -633,6 +633,17 @@ void esp_wifi_set_sleep_delay_time(uint32_t return_to_sleep_delay);
*/
void esp_wifi_set_keep_alive_time(uint32_t keep_alive_time);
/**
* @brief Set the min broadcast data wait time for wifi to enter the sleep state
*
* @attention Default sleep wait broadcast data time is 15000, Uint µs.
*
* @param time: When the station knows through the beacon that the AP
* will send broadcast packet, it will wait for a minimum of
* wait_broadcast_data_time before entering the sleep process.
*/
void esp_wifi_set_sleep_wait_broadcast_data_time(uint32_t time);
/**
* @brief Configure wifi beacon montior default parameters
*

View File

@ -347,7 +347,7 @@ esp_err_t esp_wifi_get_mode(wifi_mode_t *mode);
* @return
* - ESP_OK: succeed
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the wifi related config is correct
* - ESP_ERR_NO_MEM: out of memory
* - ESP_ERR_WIFI_CONN: WiFi internal error, station or soft-AP control block wrong
* - ESP_FAIL: other WiFi internal errors
@ -538,7 +538,7 @@ esp_err_t esp_wifi_scan_get_ap_record(wifi_ap_record_t *ap_record);
* - ESP_ERR_WIFI_NOT_INIT: WiFi is not initialized by esp_wifi_init
* - ESP_ERR_WIFI_NOT_STARTED: WiFi is not started by esp_wifi_start
* - ESP_ERR_WIFI_MODE: WiFi mode is wrong
* - ESP_ERR_INVALID_ARG: invalid argument
* - ESP_ERR_INVALID_ARG: It doesn't normally happen, the function called inside the API was passed invalid argument, user should check if the wifi related config is correct
*/
esp_err_t esp_wifi_clear_ap_list(void);

View File

@ -298,6 +298,8 @@ typedef struct {
uint8_t ssid_hidden; /**< Broadcast SSID or not, default 0, broadcast the SSID */
uint8_t max_connection; /**< Max number of stations allowed to connect in */
uint16_t beacon_interval; /**< Beacon interval which should be multiples of 100. Unit: TU(time unit, 1 TU = 1024 us). Range: 100 ~ 60000. Default value: 100 */
uint8_t csa_count; /**< Channel Switch Announcement Count. Notify the station that the channel will switch after the csa_count beacon intervals. Default value: 3 */
uint8_t dtim_period; /**< Dtim period of soft-AP. Default value: 2 */
wifi_cipher_type_t pairwise_cipher; /**< Pairwise cipher of SoftAP, group cipher will be derived using this. Cipher values are valid starting from WIFI_CIPHER_TYPE_TKIP, enum values before that will be considered as invalid and default cipher suites(TKIP+CCMP) will be used. Valid cipher suites in softAP mode are WIFI_CIPHER_TYPE_TKIP, WIFI_CIPHER_TYPE_CCMP and WIFI_CIPHER_TYPE_TKIP_CCMP. */
bool ftm_responder; /**< Enable FTM Responder mode */
wifi_pmf_config_t pmf_cfg; /**< Configuration for Protected Management Frame */

@ -1 +1 @@
Subproject commit b427dba32c98cc1cbc2aa286c8d35679649aa99d
Subproject commit 21b94ecb0303ca880c16585d7f5948ea615c2223

View File

@ -320,12 +320,16 @@ esp_err_t esp_wifi_init(const wifi_init_config_t *config)
esp_pm_register_light_sleep_default_params_config_callback(esp_wifi_internal_update_light_sleep_default_params);
uint32_t sleep_delay_us = CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME * 1000;
esp_wifi_set_sleep_delay_time(sleep_delay_us);
#endif
uint32_t min_active_time_us = CONFIG_ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME * 1000;
esp_wifi_set_sleep_min_active_time(min_active_time_us);
uint32_t keep_alive_time_us = CONFIG_ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME * 1000 * 1000;
esp_wifi_set_keep_alive_time(keep_alive_time_us);
#endif
uint32_t wait_broadcast_data_time_us = CONFIG_ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME * 1000;
esp_wifi_set_sleep_wait_broadcast_data_time(wait_broadcast_data_time_us);
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
#if SOC_PM_MODEM_RETENTION_BY_REGDMA