Skip to content

Commit 17a8baf

Browse files
committed
Choose best AP in range if no channel/bssid given
1 parent 60c608b commit 17a8baf

File tree

1 file changed

+5
-0
lines changed
  • ports/esp32s2/common-hal/wifi

1 file changed

+5
-0
lines changed

ports/esp32s2/common-hal/wifi/Radio.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t
142142
} else {
143143
config->sta.bssid_set = 0;
144144
}
145+
// if channel and bssid both not set, do a full scan instead of fast scan
146+
// this will ensure that the best AP is chosen automatically
147+
if ((self->sta.bssid_set == 0) && (self->sta.channel == NULL)) {
148+
config.scan_method = WIFI_ALL_CHANNEL_SCAN;
149+
}
145150
esp_wifi_set_config(ESP_IF_WIFI_STA, config);
146151
self->starting_retries = 5;
147152
self->retries_left = 5;

0 commit comments

Comments
 (0)