refactor(wifi): remove enum values WIFI_BW_HT20 and WIFI_BW_HT40

This commit is contained in:
yinqingzhao
2025-12-18 10:52:30 +08:00
committed by Jack
parent 2ca037ffa1
commit 28800ed85b
11 changed files with 37 additions and 27 deletions
+4 -4
View File
@@ -730,8 +730,8 @@ esp_err_t esp_wifi_get_protocol(wifi_interface_t ifx, uint8_t *protocol_bitmap);
/** /**
* @brief Set the bandwidth of specified interface * @brief Set the bandwidth of specified interface
* *
* @attention 1. WIFI_BW_HT40 is supported only when the interface support 11N * @attention 1. WIFI_BW40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20. * @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW20.
* @attention 3. Can not set WiFi bandwidth under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_set_bandwidths instead * @attention 3. Can not set WiFi bandwidth under band mode 2.4G + 5G (WIFI_BAND_MODE_AUTO), you can use esp_wifi_set_bandwidths instead
* @attention 4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO) * @attention 4. API return ESP_ERR_NOT_SUPPORTED if the band mode is set to 2.4G + 5G (WIFI_BAND_MODE_AUTO)
* *
@@ -1740,8 +1740,8 @@ esp_err_t esp_wifi_get_protocols(wifi_interface_t ifx, wifi_protocols_t *protoco
/** /**
* @brief Set the bandwidth of specified interface and specified band * @brief Set the bandwidth of specified interface and specified band
* *
* @attention 1. WIFI_BW_HT40 is supported only when the interface support 11N * @attention 1. WIFI_BW40 is supported only when the interface support 11N
* @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW_HT20. * @attention 2. When the interface supports 11AX/11AC, it only supports setting WIFI_BW20.
* @attention 3. When the WiFi band mode is set to 2.4G only, it will not set 5G bandwidth * @attention 3. When the WiFi band mode is set to 2.4G only, it will not set 5G bandwidth
* @attention 4. When the WiFi band mode is set to 5G only, it will not set 2.4G bandwidth * @attention 4. When the WiFi band mode is set to 5G only, it will not set 2.4G bandwidth
* *
@@ -276,10 +276,8 @@ typedef enum {
* @brief Wi-Fi bandwidth type * @brief Wi-Fi bandwidth type
*/ */
typedef enum { typedef enum {
WIFI_BW_HT20 = 1, /**< Bandwidth is HT20 */ WIFI_BW20 = 1, /**< Bandwidth is 20 MHz */
WIFI_BW20 = WIFI_BW_HT20, /**< Bandwidth is 20 MHz */ WIFI_BW40 = 2, /**< Bandwidth is 40 MHz */
WIFI_BW_HT40 = 2, /**< Bandwidth is HT40 */
WIFI_BW40 = WIFI_BW_HT40, /**< Bandwidth is 40 MHz */
WIFI_BW80 = 3, /**< Bandwidth is 80 MHz */ WIFI_BW80 = 3, /**< Bandwidth is 80 MHz */
WIFI_BW160 = 4, /**< Bandwidth is 160 MHz */ WIFI_BW160 = 4, /**< Bandwidth is 160 MHz */
WIFI_BW80_BW80 = 5, /**< Bandwidth is 80 + 80 MHz */ WIFI_BW80_BW80 = 5, /**< Bandwidth is 80 + 80 MHz */
+5 -5
View File
@@ -723,7 +723,7 @@ Wi-Fi Bandwidth Mode
esp_wifi_set_protocol(WIFI_IF_STA, protocol); esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// Set STA interface bandwidth to 40 MHz // Set STA interface bandwidth to 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40); esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c6 .. only:: esp32c6
@@ -748,7 +748,7 @@ Wi-Fi Bandwidth Mode
esp_wifi_set_protocol(WIFI_IF_STA, protocol); esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// Set bandwidth of station to 40 MHz // Set bandwidth of station to 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40); esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c5 .. only:: esp32c5
@@ -777,8 +777,8 @@ Wi-Fi Bandwidth Mode
// Set bandwidth to 20 MHz for 2.4 GHz band and 40 MHz for 5 GHz band // Set bandwidth to 20 MHz for 2.4 GHz band and 40 MHz for 5 GHz band
wifi_bandwidths_t bw = { wifi_bandwidths_t bw = {
.ghz_2g = WIFI_BW_HT20, .ghz_2g = WIFI_BW20,
.ghz_5g = WIFI_BW_HT40 .ghz_5g = WIFI_BW40
}; };
esp_wifi_set_bandwidths(WIFI_IF_STA, &bw); esp_wifi_set_bandwidths(WIFI_IF_STA, &bw);
@@ -801,7 +801,7 @@ Wi-Fi Bandwidth Mode
esp_wifi_set_protocol(WIFI_IF_STA, protocol); esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// Set bandwidth of the station interface to 40 MHz // Set bandwidth of the station interface to 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40); esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. note:: .. note::
@@ -37,6 +37,8 @@ Removed Variables, Macros and Enum Values
- **FTM:** Field ``use_get_report_api`` from structure ``wifi_ftm_initiator_cfg_t`` and field ``ftm_report_data`` from structure ``wifi_event_ftm_report_t`` has been removed. Please use ``esp_wifi_ftm_get_report`` to fetch raw FTM report data instead. - **FTM:** Field ``use_get_report_api`` from structure ``wifi_ftm_initiator_cfg_t`` and field ``ftm_report_data`` from structure ``wifi_event_ftm_report_t`` has been removed. Please use ``esp_wifi_ftm_get_report`` to fetch raw FTM report data instead.
- **Wi-Fi Bandwidth:** The enum values ``WIFI_BW_HT20`` and ``WIFI_BW_HT40`` have been removed. Please use the enum values ``WIFI_BW20`` and ``WIFI_BW40`` directly.
Modified Functions and Types Modified Functions and Types
---------------------------- ----------------------------
@@ -723,7 +723,7 @@ Wi-Fi 带宽模式
esp_wifi_set_protocol(WIFI_IF_STA, protocol); esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// 设置 STA 的带宽为 40 MHz // 设置 STA 的带宽为 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40); esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c6 .. only:: esp32c6
@@ -748,7 +748,7 @@ Wi-Fi 带宽模式
esp_wifi_set_protocol(WIFI_IF_STA, protocol); esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// 设置 STA 的带宽为 40 MHz // 设置 STA 的带宽为 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40); esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. only:: esp32c5 .. only:: esp32c5
@@ -777,8 +777,8 @@ Wi-Fi 带宽模式
// 设置 2.4 GHz 带宽为 20 MHz5 GHz 带宽为 40 MHz // 设置 2.4 GHz 带宽为 20 MHz5 GHz 带宽为 40 MHz
wifi_bandwidths_t bw = { wifi_bandwidths_t bw = {
.ghz_2g = WIFI_BW_HT20, .ghz_2g = WIFI_BW20,
.ghz_5g = WIFI_BW_HT40 .ghz_5g = WIFI_BW40
}; };
esp_wifi_set_bandwidths(WIFI_IF_STA, &bw); esp_wifi_set_bandwidths(WIFI_IF_STA, &bw);
@@ -801,7 +801,7 @@ Wi-Fi 带宽模式
esp_wifi_set_protocol(WIFI_IF_STA, protocol); esp_wifi_set_protocol(WIFI_IF_STA, protocol);
// 设置 STA 的带宽为 40 MHz // 设置 STA 的带宽为 40 MHz
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT40); esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW40);
.. note:: .. note::
@@ -37,6 +37,8 @@ Wi-Fi
- **FTM** 结构体 ``wifi_ftm_initiator_cfg_t`` 中的字段 ``use_get_report_api`` 和结构体 ``wifi_event_ftm_report_t`` 中的字段 ``ftm_report_data`` 已被移除。请改用 ``esp_wifi_ftm_get_report`` 获取原始 FTM 报告数据。 - **FTM** 结构体 ``wifi_ftm_initiator_cfg_t`` 中的字段 ``use_get_report_api`` 和结构体 ``wifi_event_ftm_report_t`` 中的字段 ``ftm_report_data`` 已被移除。请改用 ``esp_wifi_ftm_get_report`` 获取原始 FTM 报告数据。
- **Wi-Fi 接口宏:** 枚举值 ``WIFI_BW_HT20````WIFI_BW_HT40`` 已被移除。请直接使用枚举值 ``WIFI_BW20````WIFI_BW40``
已修改的函数和类型 已修改的函数和类型
------------------ ------------------
+4 -4
View File
@@ -437,10 +437,10 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
proto.ghz_2g = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N; proto.ghz_2g = WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N;
proto.ghz_5g = 0; proto.ghz_5g = 0;
esp_wifi_set_protocols(WIFI_IF_AP, &proto); esp_wifi_set_protocols(WIFI_IF_AP, &proto);
bws.ghz_2g = WIFI_BW_HT40; bws.ghz_2g = WIFI_BW40;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws); esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
} else { } else {
bws.ghz_2g = WIFI_BW_HT20; bws.ghz_2g = WIFI_BW20;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws); esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
} }
} else { } else {
@@ -449,13 +449,13 @@ static bool wifi_cmd_ap_set(const char* ssid, const char* pass, uint8_t channel,
proto.ghz_2g = 0; proto.ghz_2g = 0;
proto.ghz_5g = WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11A; proto.ghz_5g = WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11A;
esp_wifi_set_protocols(WIFI_IF_AP, &proto); esp_wifi_set_protocols(WIFI_IF_AP, &proto);
bws.ghz_5g=WIFI_BW_HT40; bws.ghz_5g=WIFI_BW40;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws); esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
} else { } else {
proto.ghz_2g = 0; proto.ghz_2g = 0;
proto.ghz_5g = WIFI_PROTOCOL_11AC | WIFI_PROTOCOL_11A | WIFI_PROTOCOL_11AX; proto.ghz_5g = WIFI_PROTOCOL_11AC | WIFI_PROTOCOL_11A | WIFI_PROTOCOL_11AX;
esp_wifi_set_protocols(WIFI_IF_AP, &proto); esp_wifi_set_protocols(WIFI_IF_AP, &proto);
bws.ghz_5g = WIFI_BW_HT20; bws.ghz_5g = WIFI_BW20;
esp_wifi_set_bandwidths(WIFI_IF_AP, &bws); esp_wifi_set_bandwidths(WIFI_IF_AP, &bws);
} }
#endif #endif
+1 -1
View File
@@ -4,7 +4,7 @@ dependencies:
espressif/iperf-cmd: espressif/iperf-cmd:
version: "~0.1.3" version: "~0.1.3"
esp-qa/wifi-cmd: esp-qa/wifi-cmd:
version: "~0.2.0" version: "~0.2.7"
esp-qa/ping-cmd: esp-qa/ping-cmd:
version: "~1.0.0" version: "~1.0.0"
espressif/esp_wifi_remote: espressif/esp_wifi_remote:
+3 -3
View File
@@ -277,8 +277,8 @@ static void wifi_itwt(void)
ESP_ERROR_CHECK(esp_wifi_sta_twt_config(&wifi_twt_config)); ESP_ERROR_CHECK(esp_wifi_sta_twt_config(&wifi_twt_config));
#if CONFIG_SOC_WIFI_SUPPORT_5G #if CONFIG_SOC_WIFI_SUPPORT_5G
wifi_bandwidths_t bw = { wifi_bandwidths_t bw = {
.ghz_2g = WIFI_BW_HT20, .ghz_2g = WIFI_BW20,
.ghz_5g = WIFI_BW_HT20, .ghz_5g = WIFI_BW20,
}; };
esp_wifi_set_bandwidths(WIFI_IF_STA, &bw); esp_wifi_set_bandwidths(WIFI_IF_STA, &bw);
@@ -288,7 +288,7 @@ static void wifi_itwt(void)
}; };
esp_wifi_set_protocols(WIFI_IF_STA, &protocol); esp_wifi_set_protocols(WIFI_IF_STA, &protocol);
#else #else
esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW_HT20); esp_wifi_set_bandwidth(WIFI_IF_STA, WIFI_BW20);
esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11AX); esp_wifi_set_protocol(WIFI_IF_STA, WIFI_PROTOCOL_11B | WIFI_PROTOCOL_11G | WIFI_PROTOCOL_11N | WIFI_PROTOCOL_11AX);
#endif #endif
esp_wifi_set_ps(WIFI_PS_MIN_MODEM); esp_wifi_set_ps(WIFI_PS_MIN_MODEM);
+8
View File
@@ -753,3 +753,11 @@
- -
re: "fatal error: soc/uart_channel.h: No such file or directory" re: "fatal error: soc/uart_channel.h: No such file or directory"
hint: "The header file 'soc/uart_channel.h' has been removed. All equivalent UART GPIO lookup macros can be found in 'soc/uart_pins.h' now." hint: "The header file 'soc/uart_channel.h' has been removed. All equivalent UART GPIO lookup macros can be found in 'soc/uart_pins.h' now."
-
re: "error: 'WIFI_BW_HT20' undeclared \\(first use in this function\\)"
hint: "The enum value 'WIFI_BW_HT20' has been removed. Use 'WIFI_BW20' instead."
-
re: "error: 'WIFI_BW_HT40' undeclared \\(first use in this function\\)"
hint: "The enum value 'WIFI_BW_HT40' has been removed. Use 'WIFI_BW40' instead."