feat(twt): twt add parameter to enable keep alive

pull/14315/merge
yinqingzhao 2024-10-25 19:33:55 +08:00
rodzic e1a3ff1529
commit 34ba72a431
6 zmienionych plików z 22 dodań i 3 usunięć

Wyświetl plik

@ -112,7 +112,7 @@ pm_disable_sleep_delay_timer = 0x40000d50;
/*pm_dream = 0x40000d54;*/
pm_mac_wakeup = 0x40000d58;
pm_mac_sleep = 0x40000d5c;
pm_enable_active_timer = 0x40000d60;
/*pm_enable_active_timer = 0x40000d60;*/
pm_enable_sleep_delay_timer = 0x40000d64;
pm_local_tsf_process = 0x40000d68;
pm_set_beacon_filter = 0x40000d6c;

Wyświetl plik

@ -113,7 +113,7 @@ pm_disable_sleep_delay_timer = 0x40000cbc;
pm_dream = 0x40000cc0;
pm_mac_wakeup = 0x40000cc4;
pm_mac_sleep = 0x40000cc8;
pm_enable_active_timer = 0x40000ccc;
/*pm_enable_active_timer = 0x40000ccc;*/
pm_enable_sleep_delay_timer = 0x40000cd0;
pm_local_tsf_process = 0x40000cd4;
pm_set_beacon_filter = 0x40000cd8;

Wyświetl plik

@ -406,6 +406,7 @@ typedef enum {
/** Argument structure for twt configuration */
typedef struct {
bool post_wakeup_event; /**< post twt wakeup event */
bool twt_enable_keep_alive; /**< twt enable send qos null to keep alive */
} wifi_twt_config_t;
/** Argument structure for WIFI_EVENT_TWT_WAKEUP event */

@ -1 +1 @@
Subproject commit a663beed1a9ef3a316e8502268c14e053db108e1
Subproject commit 601124b36a88ae0ab5b8538b0769cbf893e9d9f2

Wyświetl plik

@ -38,6 +38,12 @@ menu "Example Configuration"
help
Set static gateway address.
config EXAMPLE_TWT_ENABLE_KEEP_ALIVE_QOS_NULL
bool "enable keep alive qos null"
default n
help
Enable send QOS NULL to keep alive during TWT.
menu "iTWT Configuration"
config EXAMPLE_ITWT_TRIGGER_ENABLE
bool "trigger-enabled"

Wyświetl plik

@ -49,6 +49,12 @@ static const char *TAG = "itwt";
#define DEFAULT_PWD CONFIG_EXAMPLE_WIFI_PASSWORD
#define ITWT_SETUP_SUCCESS 1
#if CONFIG_EXAMPLE_TWT_ENABLE_KEEP_ALIVE_QOS_NULL
bool keep_alive_enabled = true;
#else
bool keep_alive_enabled = false;
#endif
#if CONFIG_EXAMPLE_ITWT_TRIGGER_ENABLE
uint8_t trigger_enabled = 1;
#else
@ -264,6 +270,12 @@ static void wifi_itwt(void)
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
wifi_twt_config_t wifi_twt_config = {
.post_wakeup_event = false,
.twt_enable_keep_alive = keep_alive_enabled,
};
ESP_ERROR_CHECK(esp_wifi_sta_twt_config(&wifi_twt_config));
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT20);
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11AX);
esp_wifi_set_ps(WIFI_PS_MIN_MODEM);