diff options
| author | Angus Gratton <angus@redyak.com.au> | 2025-05-15 11:26:17 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2025-05-20 23:14:41 +1000 |
| commit | 186caf9f0326c9d61494a7d5c6d0408c0fef8485 (patch) | |
| tree | 46652f6ef4029fb2f8bb0258600e0d144c969f71 | |
| parent | 9ef16b466bf980a3b3e0980e7d010b0b9130569b (diff) | |
extmod/network_cyw43: Disconnect STA if making inactive.
esp32 port will disconnect if active(0) is called on a STA
interface, but rp2 port stays associated without this change.
This work was funded through GitHub Sponsors.
Signed-off-by: Angus Gratton <angus@redyak.com.au>
| -rw-r--r-- | extmod/network_cyw43.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/extmod/network_cyw43.c b/extmod/network_cyw43.c index 1b1b10b40..9ebfa904d 100644 --- a/extmod/network_cyw43.c +++ b/extmod/network_cyw43.c @@ -143,6 +143,9 @@ static mp_obj_t network_cyw43_active(size_t n_args, const mp_obj_t *args) { return mp_obj_new_bool(if_active[self->itf]); } else { bool value = mp_obj_is_true(args[1]); + if (!value && self->itf == CYW43_ITF_STA) { + cyw43_wifi_leave(self->cyw, self->itf); + } cyw43_wifi_set_up(self->cyw, self->itf, value, get_country_code()); if_active[self->itf] = value; return mp_const_none; |
