summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ports/esp32s2/common-hal/wifi/Radio.c4
-rw-r--r--shared-bindings/wifi/Radio.c20
2 files changed, 20 insertions, 4 deletions
diff --git a/ports/esp32s2/common-hal/wifi/Radio.c b/ports/esp32s2/common-hal/wifi/Radio.c
index f7c431a56..bc987bc1c 100644
--- a/ports/esp32s2/common-hal/wifi/Radio.c
+++ b/ports/esp32s2/common-hal/wifi/Radio.c
@@ -138,9 +138,9 @@ wifi_radio_error_t common_hal_wifi_radio_connect(wifi_radio_obj_t *self, uint8_t
if (bssid_len > 0){
memcpy(&config->sta.bssid, bssid, bssid_len);
config->sta.bssid[bssid_len] = 0;
- config->sta.bssid_set = 1;
+ config->sta.bssid_set = true;
} else {
- config->sta.bssid_set = 0;
+ config->sta.bssid_set = false;
}
// 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
diff --git a/shared-bindings/wifi/Radio.c b/shared-bindings/wifi/Radio.c
index e81e8793c..991abd4f1 100644
--- a/shared-bindings/wifi/Radio.c
+++ b/shared-bindings/wifi/Radio.c
@@ -142,9 +142,25 @@ const mp_obj_property_t wifi_radio_hostname_obj = {
(mp_obj_t)&mp_const_none_obj},
};
-//| def connect(self, ssid: ReadableBuffer, password: ReadableBuffer = b"", *, channel: Optional[int] = 0, timeout: Optional[float] = None) -> bool:
+//| def connect(self,
+//| ssid: ReadableBuffer,
+//| password: ReadableBuffer = b"",
+//| *,
+//| channel: Optional[int] = 0,
+//| bssid: Optional[ReadableBuffer] = b"",
+//| timeout: Optional[float] = None) -> bool:
//| """Connects to the given ssid and waits for an ip address. Reconnections are handled
-//| automatically once one connection succeeds."""
+//| automatically once one connection succeeds.
+//|
+//| By default, this will scan all channels and connect to the access point (AP) with the
+//| given ``ssid`` and greatest signal strength (rssi).
+//|
+//| If ``channel`` is given, the scan will begin with the given channel and connect to
+//| the first AP with the given ``ssid``. This can speed up the connection time
+//| significantly because a full scan doesn't occur.
+//|
+//| If ``bssid`` is given, the scan will start at the first channel or the one given and
+//| connect to the AP with the given ``bssid`` and ``ssid``."""
//| ...
//|
STATIC mp_obj_t wifi_radio_connect(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {