Skip to content

Commit ed31c7d

Browse files
committed
Await down on stop_station
1 parent 827eaeb commit ed31c7d

File tree

1 file changed

+9
-1
lines changed
  • ports/raspberrypi/common-hal/wifi

1 file changed

+9
-1
lines changed

ports/raspberrypi/common-hal/wifi/Radio.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,15 @@ void common_hal_wifi_radio_stop_station(wifi_radio_obj_t *self) {
161161
// (by tcpip_link_status). However since ap disconnection isn't working
162162
// either, this is not an issue.
163163
cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP);
164-
164+
size_t timeout_ms = (size_t)MICROPY_FLOAT_C_FUN(ceil)(500);
165+
uint64_t start = port_get_raw_ticks(NULL);
166+
uint64_t deadline = start + timeout_ms;
167+
while (port_get_raw_ticks(NULL) < deadline && (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_STA) != CYW43_LINK_DOWN)) {
168+
RUN_BACKGROUND_TASKS;
169+
if (mp_hal_is_interrupted()) {
170+
break;
171+
}
172+
}
165173
bindings_cyw43_wifi_enforce_pm();
166174
}
167175

0 commit comments

Comments
 (0)