From a5168410a4184a83d7bd145742b0bfef8ab8b996 Mon Sep 17 00:00:00 2001 From: Buger Date: Mon, 15 Mar 2021 11:10:22 +0100 Subject: [PATCH] added scan_method = WIFI_ALL_CHANNEL_SCAN into wifi config in WiFi.begin() to let the scan choose the nearest / strongest AP in case that there are multiple APs with the same SSID --- libraries/WiFi/src/WiFiSTA.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index 035dfc0475a..72d5e998b5f 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -134,6 +134,7 @@ wl_status_t WiFiSTAClass::begin(const char* ssid, const char *passphrase, int32_ wifi_config_t conf; memset(&conf, 0, sizeof(wifi_config_t)); strcpy(reinterpret_cast(conf.sta.ssid), ssid); + conf.sta.scan_method = WIFI_ALL_CHANNEL_SCAN; //force full scan to be able to choose the nearest / strongest AP if(passphrase) { if (strlen(passphrase) == 64){ // it's not a passphrase, is the PSK