summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBennyE <bennye_hh@posteo.net>2020-11-20 00:11:17 +0100
committerBennyE <bennye_hh@posteo.net>2020-11-20 00:11:17 +0100
commit6760cdf678061abeaf2627e5903c8601eee6fc66 (patch)
treed006687a10fa3fda1718335f118485040c68a8ba
parent17a8bafe0513c81565d25a6633808c639d5fa1f6 (diff)
Let connect() choose strongest AP if channel and BSSID are not given
-rw-r--r--ports/esp32s2/common-hal/wifi/Radio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c
index 61c95dea8..bcbca0ec7 100644
--- a/ports/esp32s2/common-hal/wifi/Radio.c
+++ b/ports/esp32s2/common-hal/wifi/Radio.c
@@ -142,10 +142,10 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t
} else {
config->sta.bssid_set = 0;
}
- // if channel and bssid both not set, do a full scan instead of fast scan
- // this will ensure that the best AP is chosen automatically
- if ((self->sta.bssid_set == 0) && (self->sta.channel == NULL)) {
- config.scan_method = WIFI_ALL_CHANNEL_SCAN;
+ // If channel is 0 (default/unset) and BSSID is not given, do a full scan instead of fast scan
+ // This will ensure that the best AP in range is chosen automatically
+ if ((config->sta.bssid_set == 0) && (config->sta.channel == 0)) {
+ config->sta.scan_method = WIFI_ALL_CHANNEL_SCAN;
}
esp_wifi_set_config(ESP_IF_WIFI_STA, config);
self->starting_retries = 5;