diff --git a/components/esp32/include/esp_wifi_types.h b/components/esp32/include/esp_wifi_types.h index 2410b73ce..a37b1b707 100755 --- a/components/esp32/include/esp_wifi_types.h +++ b/components/esp32/include/esp_wifi_types.h @@ -132,6 +132,16 @@ typedef struct { uint32_t reserved:31; /**< bit: 1..31 reserved */ } wifi_ap_record_t; +typedef enum { + WIFI_FAST_SCAN = 0, /**< Do fast scan, scan will end after find SSID match AP */ + WIFI_ALL_CHANNEL_SCAN, /**< All channel scan, scan will end after scan all the channel */ +}wifi_scan_method_t; + +typedef enum { + WIFI_CONNECT_AP_BY_SIGNAL = 0, /**< Sort match AP in scan list by RSSI */ + WIFI_CONNECT_AP_BY_SECURITY, /**< Sort match AP in scan list by security mode */ +}wifi_sort_method_t; + typedef enum { WIFI_PS_NONE, /**< No power save */ WIFI_PS_MODEM, /**< Modem power save */ @@ -161,9 +171,11 @@ typedef struct { typedef struct { uint8_t ssid[32]; /**< SSID of target AP*/ uint8_t password[64]; /**< password of target AP*/ + wifi_scan_method_t scan_method; /**< do all channel scan or fast scan */ bool bssid_set; /**< whether set MAC address of target AP or not. Generally, station_config.bssid_set needs to be 0; and it needs to be 1 only when users need to check the MAC address of the AP.*/ uint8_t bssid[6]; /**< MAC address of target AP*/ uint8_t channel; /**< channel of target AP. Set to 1~13 to scan starting from the specified channel before connecting to AP. If the channel of AP is unknown, set it to 0.*/ + wifi_sort_method_t sort_method; /**< sort the connect AP in the list by rssi or security mode */ } wifi_sta_config_t; typedef union { diff --git a/components/esp32/lib b/components/esp32/lib index a3c8f349f..1a06dd167 160000 --- a/components/esp32/lib +++ b/components/esp32/lib @@ -1 +1 @@ -Subproject commit a3c8f349fe3c9e5be6cf74b813a1dc505fe38dc1 +Subproject commit 1a06dd1671e386d75f98844c454c8a86e5b71c1b diff --git a/examples/wifi/power_save/main/power_save.c b/examples/wifi/power_save/main/power_save.c index 98bc601ed..dae26fb9a 100644 --- a/examples/wifi/power_save/main/power_save.c +++ b/examples/wifi/power_save/main/power_save.c @@ -68,7 +68,7 @@ static void wifi_power_save(void) wifi_config_t wifi_config = { .sta = { .ssid = DEFAULT_SSID, - .password = DEFAULT_PWD + .password = DEFAULT_PWD, }, }; ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));