Update wifi.Radio.connect doc

Now it includes bssid info.
This commit is contained in:
Scott Shawcroft 2020-11-24 17:54:39 -08:00
parent e778fc1f87
commit 4ac11c8d31
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
2 changed files with 20 additions and 4 deletions

View File

@ -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

View File

@ -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) {