diff options
| author | Damien George <damien@micropython.org> | 2021-08-27 18:08:19 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2021-08-31 13:00:11 +1000 |
| commit | 30691ed2a1f59fc74f6e051c70eaa7c280889381 (patch) | |
| tree | 6841b06091d7d6f6270bc53ac68673e50a56230c /extmod/network_cyw43.c | |
| parent | 52a78e69658eca65bcb8d6577df2de2db7932c9e (diff) | |
drivers/cyw43: Make wifi join fail if interface is not active.
Otherwise the Python network object continues to report that it is
attempting to connect.
Also make the return error code consistent with wifi scan.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'extmod/network_cyw43.c')
| -rw-r--r-- | extmod/network_cyw43.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/extmod/network_cyw43.c b/extmod/network_cyw43.c index adbe427b1..a5ed5d5b8 100644 --- a/extmod/network_cyw43.c +++ b/extmod/network_cyw43.c @@ -196,7 +196,7 @@ STATIC mp_obj_t network_cyw43_scan(size_t n_args, const mp_obj_t *pos_args, mp_m int scan_res = cyw43_wifi_scan(self->cyw, &opts, MP_OBJ_TO_PTR(res), network_cyw43_scan_cb); if (scan_res < 0) { - mp_raise_msg(&mp_type_OSError, MP_ERROR_TEXT("STA must be active")); + mp_raise_OSError(-scan_res); } // Wait for scan to finish, with a 10s timeout @@ -240,7 +240,7 @@ STATIC mp_obj_t network_cyw43_connect(size_t n_args, const mp_obj_t *pos_args, m } int ret = cyw43_wifi_join(self->cyw, ssid.len, ssid.buf, key.len, key.buf, args[ARG_auth].u_int, bssid.buf, args[ARG_channel].u_int); if (ret != 0) { - mp_raise_OSError(ret); + mp_raise_OSError(-ret); } return mp_const_none; } |
