mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(wifi): add support for ap choose
This commit is contained in:
parent
68d504b4fd
commit
ffb227ebd2
@ -41,7 +41,7 @@ enum {
|
||||
/**
|
||||
* @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 {
|
||||
uint32_t enable : 1; /**< enable to acquire CSI */
|
||||
uint32_t acquire_csi_legacy : 1; /**< enable to acquire L-LTF */
|
||||
@ -172,7 +172,7 @@ typedef enum {
|
||||
/**
|
||||
* @brief RxControl Info
|
||||
*/
|
||||
#if CONFIG_IDF_TARGET_ESP32C5 || CONFIG_IDF_TARGET_ESP32C61
|
||||
#if CONFIG_SOC_WIFI_MAC_VERSION_NUM == 3
|
||||
typedef struct {
|
||||
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 */
|
||||
|
@ -280,9 +280,10 @@ typedef enum {
|
||||
|
||||
/** @brief Structure describing parameters for a WiFi fast scan */
|
||||
typedef struct {
|
||||
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
|
||||
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
|
||||
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;
|
||||
|
||||
typedef enum {
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit f78422a3cb497b8f73a3d35956cf31d677a4e08b
|
||||
Subproject commit d44e16781303546cce729625004c88c1fef983d3
|
@ -1387,6 +1387,10 @@ config SOC_WIFI_HE_SUPPORT_5G
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_WIFI_MAC_VERSION_NUM
|
||||
int
|
||||
default 3
|
||||
|
||||
config SOC_BLE_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
@ -592,6 +592,7 @@
|
||||
#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */
|
||||
#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_MAC_VERSION_NUM (3) /*!< Wi-Fi MAC version num is 3 */
|
||||
|
||||
/*---------------------------------- Bluetooth CAPS ----------------------------------*/
|
||||
#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */
|
||||
|
@ -1483,6 +1483,10 @@ config SOC_WIFI_HE_SUPPORT
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_WIFI_MAC_VERSION_NUM
|
||||
int
|
||||
default 2
|
||||
|
||||
config SOC_BLE_SUPPORTED
|
||||
bool
|
||||
default y
|
||||
|
@ -584,6 +584,7 @@
|
||||
#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */
|
||||
#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */
|
||||
#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 ----------------------------------*/
|
||||
#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */
|
||||
|
@ -847,6 +847,10 @@ config SOC_WIFI_HE_SUPPORT
|
||||
bool
|
||||
default y
|
||||
|
||||
config SOC_WIFI_MAC_VERSION_NUM
|
||||
int
|
||||
default 3
|
||||
|
||||
config SOC_PHY_COMBO_MODULE
|
||||
bool
|
||||
default y
|
||||
|
@ -455,6 +455,7 @@
|
||||
#define SOC_WIFI_CSI_SUPPORT (1) /*!< Support CSI */
|
||||
#define SOC_WIFI_MESH_SUPPORT (1) /*!< Support WIFI MESH */
|
||||
#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 ----------------------------------*/
|
||||
// \#define SOC_BLE_SUPPORTED (1) /*!< Support Bluetooth Low Energy hardware */
|
||||
|
@ -65,4 +65,13 @@ menu "Example Configuration"
|
||||
bool "wpa2"
|
||||
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
|
||||
|
@ -61,9 +61,15 @@
|
||||
#else
|
||||
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
||||
#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
|
||||
#define DEFAULT_RSSI -127
|
||||
#define DEFAULT_AUTHMODE WIFI_AUTH_OPEN
|
||||
#define DEFAULT_RSSI_5G_ADJUSTMENT 0
|
||||
#endif /*CONFIG_EXAMPLE_FAST_SCAN_THRESHOLD*/
|
||||
|
||||
static const char *TAG = "scan";
|
||||
@ -107,6 +113,7 @@ static void fast_scan(void)
|
||||
.sort_method = DEFAULT_SORT_METHOD,
|
||||
.threshold.rssi = DEFAULT_RSSI,
|
||||
.threshold.authmode = DEFAULT_AUTHMODE,
|
||||
.threshold.rssi_5g_adjustment = DEFAULT_RSSI_5G_ADJUSTMENT,
|
||||
},
|
||||
};
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||
|
Loading…
Reference in New Issue
Block a user