diff options
| author | Scott Shawcroft <scott@adafruit.com> | 2020-11-23 15:19:57 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-23 15:19:57 -0800 |
| commit | a80bf222110ad873344fcedb600978754df5a19b (patch) | |
| tree | 0f1b8c9e33fa47ba8826d45b9a59b91f4676d80f | |
| parent | f8dcb2517068499902135f19a818e08c3044a94d (diff) | |
| parent | 2773f534c946df46da5ba87c0968b5e4912a6b2b (diff) | |
Merge pull request #3727 from BennyE/wifi-full-scan
esp32s2: Do a full scan when channel/BSSID are not given
| -rw-r--r-- | ports/esp32s2/common-hal/wifi/Radio.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c index 1945da207..f7c431a56 100644 --- a/ports/esp32s2/common-hal/wifi/Radio.c +++ b/ports/esp32s2/common-hal/wifi/Radio.c @@ -142,6 +142,13 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t } else { config->sta.bssid_set = 0; } + // 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; + } else { + config->sta.scan_method = WIFI_FAST_SCAN; + } esp_wifi_set_config(ESP_IF_WIFI_STA, config); self->starting_retries = 5; self->retries_left = 5; |
