mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'bugfix/fix_some_wifi_bugs_24063_to_v5.1' into 'release/v5.1'
fix(wifi): Backport some wifi bugs 24063 to v5.1(Backport v5.1) See merge request espressif/esp-idf!24794
This commit is contained in:
@ -401,6 +401,12 @@ static const esp_err_msg_t esp_err_msg_table[] = {
|
|||||||
ERR_TBL_IT(ESP_ERR_WIFI_TWT_SETUP_TIMEOUT), /* 12312 0x3018 Timeout of receiving twt setup response
|
ERR_TBL_IT(ESP_ERR_WIFI_TWT_SETUP_TIMEOUT), /* 12312 0x3018 Timeout of receiving twt setup response
|
||||||
frame, timeout times can be set during
|
frame, timeout times can be set during
|
||||||
twt setup */
|
twt setup */
|
||||||
|
# endif
|
||||||
|
# ifdef ESP_ERR_WIFI_TWT_SETUP_TXFAIL
|
||||||
|
ERR_TBL_IT(ESP_ERR_WIFI_TWT_SETUP_TXFAIL), /* 12313 0x3019 TWT setup frame tx failed */
|
||||||
|
# endif
|
||||||
|
# ifdef ESP_ERR_WIFI_TWT_SETUP_REJECT
|
||||||
|
ERR_TBL_IT(ESP_ERR_WIFI_TWT_SETUP_REJECT), /* 12314 0x301a The twt setup request was rejected by the AP */
|
||||||
# endif
|
# endif
|
||||||
// components/wpa_supplicant/esp_supplicant/include/esp_wps.h
|
// components/wpa_supplicant/esp_supplicant/include/esp_wps.h
|
||||||
# ifdef ESP_ERR_WIFI_REGISTRAR
|
# ifdef ESP_ERR_WIFI_REGISTRAR
|
||||||
|
@ -1522,7 +1522,7 @@ hal_mac_is_low_rate_enabled = 0x40001af0;
|
|||||||
hal_mac_tx_get_blockack = 0x40001af4;
|
hal_mac_tx_get_blockack = 0x40001af4;
|
||||||
hal_mac_tx_set_ppdu = 0x40001af8;
|
hal_mac_tx_set_ppdu = 0x40001af8;
|
||||||
ic_get_trc = 0x40001afc;
|
ic_get_trc = 0x40001afc;
|
||||||
ic_mac_deinit = 0x40001b00;
|
/* ic_mac_deinit = 0x40001b00; */
|
||||||
ic_mac_init = 0x40001b04;
|
ic_mac_init = 0x40001b04;
|
||||||
ic_interface_enabled = 0x40001b08;
|
ic_interface_enabled = 0x40001b08;
|
||||||
is_lmac_idle = 0x40001b0c;
|
is_lmac_idle = 0x40001b0c;
|
||||||
|
@ -1589,7 +1589,7 @@ hal_mac_is_low_rate_enabled = 0x400015cc;
|
|||||||
hal_mac_tx_get_blockack = 0x400015d0;
|
hal_mac_tx_get_blockack = 0x400015d0;
|
||||||
/* hal_mac_tx_set_ppdu = 0x400015d4;*/
|
/* hal_mac_tx_set_ppdu = 0x400015d4;*/
|
||||||
ic_get_trc = 0x400015d8;
|
ic_get_trc = 0x400015d8;
|
||||||
ic_mac_deinit = 0x400015dc;
|
/* ic_mac_deinit = 0x400015dc; */
|
||||||
ic_mac_init = 0x400015e0;
|
ic_mac_init = 0x400015e0;
|
||||||
ic_interface_enabled = 0x400015e4;
|
ic_interface_enabled = 0x400015e4;
|
||||||
is_lmac_idle = 0x400015e8;
|
is_lmac_idle = 0x400015e8;
|
||||||
|
@ -72,7 +72,7 @@ pm_is_waked = 0x40000c9c;
|
|||||||
/* pm_on_beacon_rx = 0x40000ca4; */
|
/* pm_on_beacon_rx = 0x40000ca4; */
|
||||||
pm_on_data_rx = 0x40000ca8;
|
pm_on_data_rx = 0x40000ca8;
|
||||||
//pm_on_tbtt = 0x40000cac;
|
//pm_on_tbtt = 0x40000cac;
|
||||||
pm_parse_beacon = 0x40000cb0;
|
/* pm_parse_beacon = 0x40000cb0; */
|
||||||
//pm_process_tim = 0x40000cb4;
|
//pm_process_tim = 0x40000cb4;
|
||||||
//pm_rx_beacon_process = 0x40000cb8;
|
//pm_rx_beacon_process = 0x40000cb8;
|
||||||
/* pm_rx_data_process = 0x40000cbc; */
|
/* pm_rx_data_process = 0x40000cbc; */
|
||||||
@ -162,7 +162,7 @@ hal_mac_is_dma_enable = 0x40000e00;
|
|||||||
//wdevProcessRxSucDataAll = 0x40000e0c;
|
//wdevProcessRxSucDataAll = 0x40000e0c;
|
||||||
wdev_csi_len_align = 0x40000e10;
|
wdev_csi_len_align = 0x40000e10;
|
||||||
ppDequeueTxDone_Locked = 0x40000e14;
|
ppDequeueTxDone_Locked = 0x40000e14;
|
||||||
ppProcTxDone = 0x40000e18;
|
//ppProcTxDone = 0x40000e18;
|
||||||
//pm_tx_data_done_process = 0x40000e1c;
|
//pm_tx_data_done_process = 0x40000e1c;
|
||||||
config_is_cache_tx_buf_enabled = 0x40000e20;
|
config_is_cache_tx_buf_enabled = 0x40000e20;
|
||||||
ppMapWaitTxq = 0x40000e24;
|
ppMapWaitTxq = 0x40000e24;
|
||||||
@ -297,16 +297,16 @@ tsf_hal_unmap_tbtt_target_to_rx_frame = 0x40001024;
|
|||||||
//ppSelectTxFormat = 0x40001028;
|
//ppSelectTxFormat = 0x40001028;
|
||||||
//ppCertSetRate = 0x4000102c;
|
//ppCertSetRate = 0x4000102c;
|
||||||
//ppHEAMPDU2Normal = 0x40001030;
|
//ppHEAMPDU2Normal = 0x40001030;
|
||||||
ppCalTxHEAMPDULength = 0x40001034;
|
//ppCalTxHEAMPDULength = 0x40001034;
|
||||||
ppCalTxHESMPDULength = 0x40001038;
|
//ppCalTxHESMPDULength = 0x40001038;
|
||||||
rcGetRate = 0x4000103c;
|
rcGetRate = 0x4000103c;
|
||||||
rcGetDCMMaxRate = 0x40001040;
|
rcGetDCMMaxRate = 0x40001040;
|
||||||
//rcGetSMPDURate = 0x40001044;
|
//rcGetSMPDURate = 0x40001044;
|
||||||
ppDirectRecycleAmpdu = 0x40001048;
|
ppDirectRecycleAmpdu = 0x40001048;
|
||||||
ppCheckTxHEAMPDUlength = 0x4000104c;
|
//ppCheckTxHEAMPDUlength = 0x4000104c;
|
||||||
rx11AXRate2AMPDULimit = 0x40001050;
|
//rx11AXRate2AMPDULimit = 0x40001050;
|
||||||
//ppRegressAmpdu = 0x40001054;
|
//ppRegressAmpdu = 0x40001054;
|
||||||
ppCalDeliNum = 0x40001058;
|
//ppCalDeliNum = 0x40001058;
|
||||||
ppAdd2AMPDUTail = 0x4000105c;
|
ppAdd2AMPDUTail = 0x4000105c;
|
||||||
esp_test_disable_tx_statistics = 0x40001060;
|
esp_test_disable_tx_statistics = 0x40001060;
|
||||||
esp_test_enable_tx_statistics = 0x40001064;
|
esp_test_enable_tx_statistics = 0x40001064;
|
||||||
|
@ -1899,7 +1899,7 @@ hal_mac_is_low_rate_enabled = 0x400052a4;
|
|||||||
hal_mac_tx_get_blockack = 0x400052b0;
|
hal_mac_tx_get_blockack = 0x400052b0;
|
||||||
/* hal_mac_tx_set_ppdu = 0x400052bc;*/
|
/* hal_mac_tx_set_ppdu = 0x400052bc;*/
|
||||||
ic_get_trc = 0x400052c8;
|
ic_get_trc = 0x400052c8;
|
||||||
ic_mac_deinit = 0x400052d4;
|
/* ic_mac_deinit = 0x400052d4; */
|
||||||
ic_mac_init = 0x400052e0;
|
ic_mac_init = 0x400052e0;
|
||||||
ic_interface_enabled = 0x400052ec;
|
ic_interface_enabled = 0x400052ec;
|
||||||
is_lmac_idle = 0x400052f8;
|
is_lmac_idle = 0x400052f8;
|
||||||
|
@ -85,6 +85,8 @@ extern "C" {
|
|||||||
|
|
||||||
#define ESP_ERR_WIFI_TWT_FULL (ESP_ERR_WIFI_BASE + 23) /*!< no available flow id */
|
#define ESP_ERR_WIFI_TWT_FULL (ESP_ERR_WIFI_BASE + 23) /*!< no available flow id */
|
||||||
#define ESP_ERR_WIFI_TWT_SETUP_TIMEOUT (ESP_ERR_WIFI_BASE + 24) /*!< Timeout of receiving twt setup response frame, timeout times can be set during twt setup */
|
#define ESP_ERR_WIFI_TWT_SETUP_TIMEOUT (ESP_ERR_WIFI_BASE + 24) /*!< Timeout of receiving twt setup response frame, timeout times can be set during twt setup */
|
||||||
|
#define ESP_ERR_WIFI_TWT_SETUP_TXFAIL (ESP_ERR_WIFI_BASE + 25) /*!< TWT setup frame tx failed */
|
||||||
|
#define ESP_ERR_WIFI_TWT_SETUP_REJECT (ESP_ERR_WIFI_BASE + 26) /*!< The twt setup request was rejected by the AP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief WiFi stack configuration parameters passed to esp_wifi_init call.
|
* @brief WiFi stack configuration parameters passed to esp_wifi_init call.
|
||||||
|
@ -103,7 +103,8 @@ typedef struct
|
|||||||
flow_id could be specified to a value in the range of [0, 7], but it might be changed by AP in the response.
|
flow_id could be specified to a value in the range of [0, 7], but it might be changed by AP in the response.
|
||||||
When change TWT parameters of the existing TWT agreement, flow_id should be an existing one. The value range is [0, 7]. */
|
When change TWT parameters of the existing TWT agreement, flow_id should be an existing one. The value range is [0, 7]. */
|
||||||
uint16_t wake_invl_expn :5; /**< TWT Wake Interval Exponent. The value range is [0, 31]. */
|
uint16_t wake_invl_expn :5; /**< TWT Wake Interval Exponent. The value range is [0, 31]. */
|
||||||
uint16_t reserved :6; /**< bit: 10.15 reserved */
|
uint16_t wake_duration_unit :1; /**< TWT Wake duration unit, 0: 256us 1: TU (TU = 1024us)*/
|
||||||
|
uint16_t reserved :5; /**< bit: 11.15 reserved */
|
||||||
uint8_t min_wake_dura; /**< Nominal Minimum Wake Duration, indicates the minimum amount of time, in unit of 256 us, that the TWT requesting STA expects that it needs to be awake. The value range is [1, 255]. */
|
uint8_t min_wake_dura; /**< Nominal Minimum Wake Duration, indicates the minimum amount of time, in unit of 256 us, that the TWT requesting STA expects that it needs to be awake. The value range is [1, 255]. */
|
||||||
uint16_t wake_invl_mant; /**< TWT Wake Interval Mantissa. The value range is [1, 65535]. */
|
uint16_t wake_invl_mant; /**< TWT Wake Interval Mantissa. The value range is [1, 65535]. */
|
||||||
uint16_t twt_id; /**< TWT connection id, the value range is [0, 32767]. */
|
uint16_t twt_id; /**< TWT connection id, the value range is [0, 32767]. */
|
||||||
@ -204,8 +205,10 @@ typedef struct {
|
|||||||
|
|
||||||
/** Argument structure for WIFI_EVENT_TWT_SET_UP event */
|
/** Argument structure for WIFI_EVENT_TWT_SET_UP event */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
wifi_twt_setup_config_t config; /**< itwt setup config*/
|
wifi_twt_setup_config_t config; /**< itwt setup config, this value is determined by the AP */
|
||||||
esp_err_t status; /**< 1: indicate tx success, others : indicate tx fail */
|
esp_err_t status; /**< itwt setup status, 1: indicate setup success, others : indicate setup fail */
|
||||||
|
uint8_t reason; /**< itwt setup frame tx fail reason */
|
||||||
|
uint64_t target_wake_time; /**< TWT SP start time */
|
||||||
} wifi_event_sta_itwt_setup_t;
|
} wifi_event_sta_itwt_setup_t;
|
||||||
|
|
||||||
/** Argument structure for WIFI_EVENT_TWT_TEARDOWN event */
|
/** Argument structure for WIFI_EVENT_TWT_TEARDOWN event */
|
||||||
|
@ -969,6 +969,7 @@ typedef struct {
|
|||||||
uint8_t mac[6]; /**< MAC address of the station disconnects to soft-AP */
|
uint8_t mac[6]; /**< MAC address of the station disconnects to soft-AP */
|
||||||
uint8_t aid; /**< the aid that soft-AP gave to the station disconnects to */
|
uint8_t aid; /**< the aid that soft-AP gave to the station disconnects to */
|
||||||
bool is_mesh_child; /**< flag to identify mesh child */
|
bool is_mesh_child; /**< flag to identify mesh child */
|
||||||
|
uint8_t reason; /**< reason of disconnection */
|
||||||
} wifi_event_ap_stadisconnected_t;
|
} wifi_event_ap_stadisconnected_t;
|
||||||
|
|
||||||
/** Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event */
|
/** Argument structure for WIFI_EVENT_AP_PROBEREQRECVED event */
|
||||||
|
Submodule components/esp_wifi/lib updated: 82dd9020a4...e3e15870cb
@ -31,12 +31,13 @@ typedef struct {
|
|||||||
struct arg_int *setup;
|
struct arg_int *setup;
|
||||||
struct arg_int *teardown;
|
struct arg_int *teardown;
|
||||||
struct arg_int *suspend;
|
struct arg_int *suspend;
|
||||||
struct arg_int *trigger; //1-trigger-enabled, 0-non-trigger-enabled, setup
|
struct arg_int *trigger; //1-trigger-enabled, 0-non-trigger-enabled, setup
|
||||||
struct arg_int *flowtype; //1-unannounced, 0-announced, setup
|
struct arg_int *flowtype; //1-unannounced, 0-announced, setup
|
||||||
struct arg_int *negtype;
|
struct arg_int *negtype;
|
||||||
struct arg_int *wakeinvlexp; //setup
|
struct arg_int *wakeinvlexp; //setup
|
||||||
struct arg_int *wakeinvlman; //setup
|
struct arg_int *wakeduraunit; //1-TU, 0-256us
|
||||||
struct arg_int *minwakedur; //setup
|
struct arg_int *wakeinvlman; //setup
|
||||||
|
struct arg_int *minwakedur; //setup
|
||||||
struct arg_int *flowid;
|
struct arg_int *flowid;
|
||||||
struct arg_int *twtid;
|
struct arg_int *twtid;
|
||||||
struct arg_int *setup_timeout_time_ms;
|
struct arg_int *setup_timeout_time_ms;
|
||||||
@ -91,6 +92,12 @@ static int wifi_cmd_itwt(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (itwt_args.wakeduraunit->count) {
|
||||||
|
if (itwt_args.wakeduraunit->ival[0] < 0 || itwt_args.wakeduraunit->ival[0] > 1) {
|
||||||
|
ESP_LOGE(TAG, "(itwt)expect [0, 1], wake duration unit: %d", itwt_args.wakeduraunit->ival[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (itwt_args.twtid->count) {
|
if (itwt_args.twtid->count) {
|
||||||
if (itwt_args.twtid->ival[0] < 0 || itwt_args.twtid->ival[0] > 32767) {
|
if (itwt_args.twtid->ival[0] < 0 || itwt_args.twtid->ival[0] > 32767) {
|
||||||
ESP_LOGE(TAG, "(itwt)expect [0, 32767], twt id: %d", itwt_args.twtid->ival[0]);
|
ESP_LOGE(TAG, "(itwt)expect [0, 32767], twt id: %d", itwt_args.twtid->ival[0]);
|
||||||
@ -109,6 +116,7 @@ static int wifi_cmd_itwt(int argc, char **argv)
|
|||||||
.twt_id = itwt_args.twtid->count ? itwt_args.twtid->ival[0] : 0,
|
.twt_id = itwt_args.twtid->count ? itwt_args.twtid->ival[0] : 0,
|
||||||
.flow_type = itwt_args.flowtype->count ? ((itwt_args.flowtype->ival[0] == 0) ? 0 : 1) : 0,
|
.flow_type = itwt_args.flowtype->count ? ((itwt_args.flowtype->ival[0] == 0) ? 0 : 1) : 0,
|
||||||
.min_wake_dura = itwt_args.minwakedur->count ? itwt_args.minwakedur->ival[0] : 255,
|
.min_wake_dura = itwt_args.minwakedur->count ? itwt_args.minwakedur->ival[0] : 255,
|
||||||
|
.wake_duration_unit = itwt_args.wakeduraunit->count ? itwt_args.wakeduraunit->ival[0] : 0,
|
||||||
.wake_invl_expn = itwt_args.wakeinvlexp->count ? itwt_args.wakeinvlexp->ival[0] : 10,
|
.wake_invl_expn = itwt_args.wakeinvlexp->count ? itwt_args.wakeinvlexp->ival[0] : 10,
|
||||||
.wake_invl_mant = itwt_args.wakeinvlman->count ? itwt_args.wakeinvlman->ival[0] : 512,
|
.wake_invl_mant = itwt_args.wakeinvlman->count ? itwt_args.wakeinvlman->ival[0] : 512,
|
||||||
.trigger = itwt_args.trigger->count ? (itwt_args.trigger->ival[0] ? 1 : 0) : 1,
|
.trigger = itwt_args.trigger->count ? (itwt_args.trigger->ival[0] ? 1 : 0) : 1,
|
||||||
@ -178,6 +186,7 @@ void register_wifi_itwt(void)
|
|||||||
itwt_args.flowtype = arg_int0("f", NULL, "<flow_type>", "flow type: 0-announced, 1-unannounced");
|
itwt_args.flowtype = arg_int0("f", NULL, "<flow_type>", "flow type: 0-announced, 1-unannounced");
|
||||||
itwt_args.negtype = arg_int0("n", NULL, "<neg_type>", "negotiate type");
|
itwt_args.negtype = arg_int0("n", NULL, "<neg_type>", "negotiate type");
|
||||||
itwt_args.minwakedur = arg_int0("d", NULL, "<minwakedur>", "Norminal Min. Wake Duration");
|
itwt_args.minwakedur = arg_int0("d", NULL, "<minwakedur>", "Norminal Min. Wake Duration");
|
||||||
|
itwt_args.wakeduraunit = arg_int0("u", NULL, "<wakeduraunit>", "wake duration unit 0-256us, 1-TU (TU = 1024us)");
|
||||||
itwt_args.wakeinvlexp = arg_int0("e", NULL, "<wakeinvlexp>", "Wake Interval Exponent");
|
itwt_args.wakeinvlexp = arg_int0("e", NULL, "<wakeinvlexp>", "Wake Interval Exponent");
|
||||||
itwt_args.wakeinvlman = arg_int0("m", NULL, "<wakeinvlman>", "Wake Interval Mantissa");
|
itwt_args.wakeinvlman = arg_int0("m", NULL, "<wakeinvlman>", "Wake Interval Mantissa");
|
||||||
itwt_args.flowid = arg_int0("i", NULL, "<flow_id>", "Flow ID");
|
itwt_args.flowid = arg_int0("i", NULL, "<flow_id>", "Flow ID");
|
||||||
|
@ -44,11 +44,13 @@ menu "Example Configuration"
|
|||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
0- a non-trigger-enabled TWT, 1-a trigger-enabled TWT
|
0- a non-trigger-enabled TWT, 1-a trigger-enabled TWT
|
||||||
|
|
||||||
config EXAMPLE_ITWT_ANNOUNCED
|
config EXAMPLE_ITWT_ANNOUNCED
|
||||||
bool "announced"
|
bool "announced"
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
0- an unannounced TWT, 1-an announced TWT
|
0- an unannounced TWT, 1-an announced TWT
|
||||||
|
|
||||||
config EXAMPLE_ITWT_MIN_WAKE_DURA
|
config EXAMPLE_ITWT_MIN_WAKE_DURA
|
||||||
int "itwt minimum wake duration"
|
int "itwt minimum wake duration"
|
||||||
range 1 255
|
range 1 255
|
||||||
@ -56,30 +58,42 @@ menu "Example Configuration"
|
|||||||
help
|
help
|
||||||
Nominal Minimum Wake Duration, indicates the minimum amount of time, in unit of 256 us, that the TWT
|
Nominal Minimum Wake Duration, indicates the minimum amount of time, in unit of 256 us, that the TWT
|
||||||
requesting STA expects that it needs to be awake. The value range is [1, 255].
|
requesting STA expects that it needs to be awake. The value range is [1, 255].
|
||||||
|
|
||||||
|
config EXAMPLE_ITWT_WAKE_DURATION_UNIT
|
||||||
|
int "itwt wake duration unit"
|
||||||
|
range 0 1
|
||||||
|
default 0
|
||||||
|
help
|
||||||
|
TWT wake duration unit, 0: 256us 1: TU (TU = 1024us)
|
||||||
|
|
||||||
config EXAMPLE_ITWT_WAKE_INVL_EXPN
|
config EXAMPLE_ITWT_WAKE_INVL_EXPN
|
||||||
int "itwt wake interval exponent"
|
int "itwt wake interval exponent"
|
||||||
range 0 31
|
range 0 31
|
||||||
default 10
|
default 10
|
||||||
help
|
help
|
||||||
TWT Wake Interval Exponent, in microseconds. The value range is [0, 31].
|
TWT Wake Interval Exponent, in microseconds. The value range is [0, 31].
|
||||||
|
|
||||||
config EXAMPLE_ITWT_WAKE_INVL_MANT
|
config EXAMPLE_ITWT_WAKE_INVL_MANT
|
||||||
int "itwt wake interval mantissa"
|
int "itwt wake interval mantissa"
|
||||||
range 1 65535
|
range 1 65535
|
||||||
default 512
|
default 512
|
||||||
help
|
help
|
||||||
TWT Wake Interval Mantissa, in microseconds. The value range is [1, 65535].
|
TWT Wake Interval Mantissa, in microseconds. The value range is [1, 65535].
|
||||||
|
|
||||||
config EXAMPLE_ITWT_ID
|
config EXAMPLE_ITWT_ID
|
||||||
int "itwt connection id"
|
int "itwt connection id"
|
||||||
range 0 32767
|
range 0 32767
|
||||||
default 0
|
default 0
|
||||||
help
|
help
|
||||||
TWT Connection id. The value range is [0, 32767].
|
TWT Connection id. The value range is [0, 32767].
|
||||||
|
|
||||||
config EXAMPLE_ITWT_SETUP_TIMEOUT_TIME_MS
|
config EXAMPLE_ITWT_SETUP_TIMEOUT_TIME_MS
|
||||||
int "itwt wake interval mantissa"
|
int "itwt setup timeout times"
|
||||||
range 100 65535
|
range 100 65535
|
||||||
default 5000
|
default 5000
|
||||||
help
|
help
|
||||||
TWT setup timeout time, in microseconds. The value range is [100, 65535].
|
TWT setup timeout time, in microseconds. The value range is [100, 65535].
|
||||||
|
|
||||||
endmenu
|
endmenu
|
||||||
|
|
||||||
choice EXAMPLE_MAX_CPU_FREQ
|
choice EXAMPLE_MAX_CPU_FREQ
|
||||||
|
@ -46,6 +46,7 @@ static const char *TAG = "itwt";
|
|||||||
/*set the ssid and password via "idf.py menuconfig"*/
|
/*set the ssid and password via "idf.py menuconfig"*/
|
||||||
#define DEFAULT_SSID CONFIG_EXAMPLE_WIFI_SSID
|
#define DEFAULT_SSID CONFIG_EXAMPLE_WIFI_SSID
|
||||||
#define DEFAULT_PWD CONFIG_EXAMPLE_WIFI_PASSWORD
|
#define DEFAULT_PWD CONFIG_EXAMPLE_WIFI_PASSWORD
|
||||||
|
#define ITWT_SETUP_SUCCESS 1
|
||||||
|
|
||||||
#if CONFIG_EXAMPLE_ITWT_TRIGGER_ENABLE
|
#if CONFIG_EXAMPLE_ITWT_TRIGGER_ENABLE
|
||||||
uint8_t trigger_enabled = 1;
|
uint8_t trigger_enabled = 1;
|
||||||
@ -123,6 +124,7 @@ static void got_ip_handler(void *arg, esp_event_base_t event_base,
|
|||||||
.twt_id = CONFIG_EXAMPLE_ITWT_ID,
|
.twt_id = CONFIG_EXAMPLE_ITWT_ID,
|
||||||
.flow_type = flow_type_announced ? 0 : 1,
|
.flow_type = flow_type_announced ? 0 : 1,
|
||||||
.min_wake_dura = CONFIG_EXAMPLE_ITWT_MIN_WAKE_DURA,
|
.min_wake_dura = CONFIG_EXAMPLE_ITWT_MIN_WAKE_DURA,
|
||||||
|
.wake_duration_unit = CONFIG_EXAMPLE_ITWT_WAKE_DURATION_UNIT,
|
||||||
.wake_invl_expn = CONFIG_EXAMPLE_ITWT_WAKE_INVL_EXPN,
|
.wake_invl_expn = CONFIG_EXAMPLE_ITWT_WAKE_INVL_EXPN,
|
||||||
.wake_invl_mant = CONFIG_EXAMPLE_ITWT_WAKE_INVL_MANT,
|
.wake_invl_mant = CONFIG_EXAMPLE_ITWT_WAKE_INVL_MANT,
|
||||||
.trigger = trigger_enabled,
|
.trigger = trigger_enabled,
|
||||||
@ -156,14 +158,23 @@ static void itwt_setup_handler(void *arg, esp_event_base_t event_base,
|
|||||||
int32_t event_id, void *event_data)
|
int32_t event_id, void *event_data)
|
||||||
{
|
{
|
||||||
wifi_event_sta_itwt_setup_t *setup = (wifi_event_sta_itwt_setup_t *) event_data;
|
wifi_event_sta_itwt_setup_t *setup = (wifi_event_sta_itwt_setup_t *) event_data;
|
||||||
if (setup->config.setup_cmd == TWT_ACCEPT) {
|
if (setup->status == ITWT_SETUP_SUCCESS) {
|
||||||
/* TWT Wake Interval = TWT Wake Interval Mantissa * (2 ^ TWT Wake Interval Exponent) */
|
/* TWT Wake Interval = TWT Wake Interval Mantissa * (2 ^ TWT Wake Interval Exponent) */
|
||||||
ESP_LOGI(TAG, "<WIFI_EVENT_ITWT_SETUP>twt_id:%d, flow_id:%d, %s, %s, wake_dura:%d, wake_invl_e:%d, wake_invl_m:%d", setup->config.twt_id,
|
ESP_LOGI(TAG, "<WIFI_EVENT_ITWT_SETUP>twt_id:%d, flow_id:%d, %s, %s, wake_dura:%d, wake_dura_unit:%d, wake_invl_e:%d, wake_invl_m:%d", setup->config.twt_id,
|
||||||
setup->config.flow_id, setup->config.trigger ? "trigger-enabled" : "non-trigger-enabled", setup->config.flow_type ? "unannounced" : "announced",
|
setup->config.flow_id, setup->config.trigger ? "trigger-enabled" : "non-trigger-enabled", setup->config.flow_type ? "unannounced" : "announced",
|
||||||
setup->config.min_wake_dura, setup->config.wake_invl_expn, setup->config.wake_invl_mant);
|
setup->config.min_wake_dura, setup->config.wake_duration_unit, setup->config.wake_invl_expn, setup->config.wake_invl_mant);
|
||||||
ESP_LOGI(TAG, "<WIFI_EVENT_ITWT_SETUP>wake duration:%d us, service period:%d us", setup->config.min_wake_dura << 8, setup->config.wake_invl_mant << setup->config.wake_invl_expn);
|
ESP_LOGI(TAG, "<WIFI_EVENT_ITWT_SETUP>target wake time:%lld, wake duration:%d us, service period:%d us", setup->target_wake_time, setup->config.min_wake_dura << (setup->config.wake_duration_unit == 1 ? 10 : 8),
|
||||||
|
setup->config.wake_invl_mant << setup->config.wake_invl_expn);
|
||||||
} else {
|
} else {
|
||||||
ESP_LOGE(TAG, "<WIFI_EVENT_ITWT_SETUP>twt_id:%d, unexpected setup command:%d", setup->config.twt_id, setup->config.setup_cmd);
|
if (setup->status == ESP_ERR_WIFI_TWT_SETUP_TIMEOUT) {
|
||||||
|
ESP_LOGE(TAG, "<WIFI_EVENT_ITWT_SETUP>twt_id:%d, timeout of receiving twt setup response frame", setup->config.twt_id);
|
||||||
|
} else if (setup->status == ESP_ERR_WIFI_TWT_SETUP_TXFAIL) {
|
||||||
|
ESP_LOGE(TAG, "<WIFI_EVENT_ITWT_SETUP>twt_id:%d, twt setup frame tx failed, reason: %d", setup->config.twt_id, setup->reason);
|
||||||
|
} else if (setup->status == ESP_ERR_WIFI_TWT_SETUP_REJECT) {
|
||||||
|
ESP_LOGE(TAG, "<WIFI_EVENT_ITWT_SETUP>twt_id:%d, twt setup request was rejected, setup cmd: %d", setup->config.twt_id, setup->config.setup_cmd);
|
||||||
|
} else {
|
||||||
|
ESP_LOGE(TAG, "<WIFI_EVENT_ITWT_SETUP>twt_id:%d, twt setup failed, status: %d", setup->config.twt_id, setup->status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user