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>
This commit is contained in:
Angus Gratton
2025-05-15 11:26:17 +10:00
committed by Damien George
parent 9ef16b466b
commit 186caf9f03

View File

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