Merge branch 'feat/add_support_for_ap_choose' into 'master'

feat(wifi): add support for ap choose

Closes WIFIBUG-732, WIFIBUG-741, WIFIBUG-744, WIFIBUG-735, WIFI-6430, and BT-3853

See merge request espressif/esp-idf!33353
This commit is contained in:
Xu Xiao 2024-09-13 15:03:02 +08:00
commit e035e798b7
12 changed files with 38 additions and 6 deletions

@ -1 +1 @@
Subproject commit a067a167a3f5581e48f4d21ed3030475dbf281da Subproject commit b526a0d7204fb36cb322ead9b1096ffd6a097dc9

View File

@ -41,7 +41,7 @@ enum {
/** /**
* @brief Channel state information(CSI) configuration type * @brief Channel state information(CSI) configuration type
*/ */
#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 #if CONFIG_SOC_WIFI_MAC_VERSION_NUM == 3
typedef struct { typedef struct {
uint32_t enable : 1; /**< enable to acquire CSI */ uint32_t enable : 1; /**< enable to acquire CSI */
uint32_t acquire_csi_legacy : 1; /**< enable to acquire L-LTF */ uint32_t acquire_csi_legacy : 1; /**< enable to acquire L-LTF */
@ -172,7 +172,7 @@ typedef enum {
/** /**
* @brief RxControl Info * @brief RxControl Info
*/ */
#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61 #if CONFIG_SOC_WIFI_MAC_VERSION_NUM == 3
typedef struct { typedef struct {
signed rssi: 8; /**< the RSSI of the reception frame */ signed rssi: 8; /**< the RSSI of the reception frame */
unsigned rate: 5; /**< if cur_bb_format is RX_BB_FORMAT_11B, it's the transmission rate. otherwise it's Rate field of L-SIG */ unsigned rate: 5; /**< if cur_bb_format is RX_BB_FORMAT_11B, it's the transmission rate. otherwise it's Rate field of L-SIG */

View File

@ -280,9 +280,10 @@ typedef enum {
/** @brief Structure describing parameters for a WiFi fast scan */ /** @brief Structure describing parameters for a WiFi fast scan */
typedef struct { typedef struct {
int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */ int8_t rssi; /**< The minimum rssi to accept in the fast scan mode */
wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode wifi_auth_mode_t authmode; /**< The weakest authmode to accept in the fast scan mode
Note: In case this value is not set and password is set as per WPA2 standards(password len >= 8), it will be defaulted to WPA2 and device won't connect to deprecated WEP/WPA networks. Please set authmode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks */ Note: In case this value is not set and password is set as per WPA2 standards(password len >= 8), it will be defaulted to WPA2 and device won't connect to deprecated WEP/WPA networks. Please set authmode threshold as WIFI_AUTH_WEP/WIFI_AUTH_WPA_PSK to connect to WEP/WPA networks */
uint8_t rssi_5g_adjustment; /**< The RSSI value of the 5G AP is within the rssi_5g_adjustment range compared to the 2G AP, the 5G AP will be given priority for connection. */
} wifi_scan_threshold_t; } wifi_scan_threshold_t;
typedef enum { typedef enum {

@ -1 +1 @@
Subproject commit f78422a3cb497b8f73a3d35956cf31d677a4e08b Subproject commit d44e16781303546cce729625004c88c1fef983d3

View File

@ -1387,6 +1387,10 @@ config SOC_WIFI_HE_SUPPORT_5G
bool bool
default y default y
config SOC_WIFI_MAC_VERSION_NUM
int
default 3
config SOC_BLE_SUPPORTED config SOC_BLE_SUPPORTED
bool bool
default y default y

View File

@ -592,6 +592,7 @@
#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */ #define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */
#define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */ #define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */
#define SOC_WIFI_HE_SUPPORT_5G (1) /*!< Support Wi-Fi 6 in 5G */ #define SOC_WIFI_HE_SUPPORT_5G (1) /*!< Support Wi-Fi 6 in 5G */
#define SOC_WIFI_MAC_VERSION_NUM (3) /*!< Wi-Fi MAC version num is 3 */
/*---------------------------------- Bluetooth CAPS ----------------------------------*/ /*---------------------------------- Bluetooth CAPS ----------------------------------*/
#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */ #define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */

View File

@ -1483,6 +1483,10 @@ config SOC_WIFI_HE_SUPPORT
bool bool
default y default y
config SOC_WIFI_MAC_VERSION_NUM
int
default 2
config SOC_BLE_SUPPORTED config SOC_BLE_SUPPORTED
bool bool
default y default y

View File

@ -584,6 +584,7 @@
#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */ #define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */
#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */ #define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */
#define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */ #define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */
#define SOC_WIFI_MAC_VERSION_NUM (2) /*!< Wi-Fi MAC version num is 2 */
/*---------------------------------- Bluetooth CAPS ----------------------------------*/ /*---------------------------------- Bluetooth CAPS ----------------------------------*/
#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */ #define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */

View File

@ -847,6 +847,10 @@ config SOC_WIFI_HE_SUPPORT
bool bool
default y default y
config SOC_WIFI_MAC_VERSION_NUM
int
default 3
config SOC_PHY_COMBO_MODULE config SOC_PHY_COMBO_MODULE
bool bool
default y default y

View File

@ -455,6 +455,7 @@
#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */ #define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */
#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */ #define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */
#define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */ #define SOC_WIFI_HE_SUPPORT (1) /*!< Support Wi-Fi 6 */
#define SOC_WIFI_MAC_VERSION_NUM (3) /*!< Wi-Fi MAC version num is 3 */
/*---------------------------------- Bluetooth CAPS ----------------------------------*/ /*---------------------------------- Bluetooth CAPS ----------------------------------*/
// \#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */ // \#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */

View File

@ -65,4 +65,13 @@ menu "Example Configuration"
bool "wpa2" bool "wpa2"
endchoice endchoice
config EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT
int "fast scan rssi 5g adjustment"
depends on EXAMPLE_FAST_SCAN_THRESHOLD && SOC_WIFI_HE_SUPPORT_5G
range 0 128
default 10
help
It is used to compensate for the signal difference between 2G and 5G, allowing
the STA to prioritize connecting to the 5G AP
endmenu endmenu

View File

@ -61,9 +61,15 @@
#else #else
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN #define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
#endif #endif
#if CONFIG_SOC_WIFI_HE_SUPPORT_5G
#define DEFAULT_RSSI_5G_ADJUSTMENT CONFIG_EXAMPLE_FAST_SCAN_RSSI_5G_ADJUSTMENT
#else
#define DEFAULT_RSSI_5G_ADJUSTMENT 0
#endif
#else #else
#define DEFAULT_RSSI -127 #define DEFAULT_RSSI -127
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN #define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
#define DEFAULT_RSSI_5G_ADJUSTMENT 0
#endif /*CONFIG_EXAMPLE_FAST_SCAN_THRESHOLD*/ #endif /*CONFIG_EXAMPLE_FAST_SCAN_THRESHOLD*/
static const char *TAG = "scan"; static const char *TAG = "scan";
@ -107,6 +113,7 @@ static void fast_scan(void)
.sort_method = DEFAULT_SORT_METHOD, .sort_method = DEFAULT_SORT_METHOD,
.threshold.rssi = DEFAULT_RSSI, .threshold.rssi = DEFAULT_RSSI,
.threshold.authmode = DEFAULT_AUTHMODE, .threshold.authmode = DEFAULT_AUTHMODE,
.threshold.rssi_5g_adjustment = DEFAULT_RSSI_5G_ADJUSTMENT,
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));