Skip to content

Commit 1151d1b

Browse files
authored
Merge pull request #8590 from eightycc/8138
Implement wifi.stop_ap for RP2
2 parents a5bd4b2 + 1451d77 commit 1151d1b

File tree

1 file changed

+5
-11
lines changed
  • ports/raspberrypi/common-hal/wifi

1 file changed

+5
-11
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,12 @@ void common_hal_wifi_radio_stop_ap(wifi_radio_obj_t *self) {
206206
}
207207

208208
if (cyw43_tcpip_link_status(&cyw43_state, CYW43_ITF_AP) != CYW43_LINK_DOWN) {
209-
mp_raise_NotImplementedError(translate("Stopping AP is not supported."));
209+
// Disassociate from WLAN
210+
cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP);
211+
// Stop AP
212+
cyw43_wifi_set_up(&cyw43_state, CYW43_ITF_AP, false, 0);
213+
bindings_cyw43_wifi_enforce_pm();
210214
}
211-
212-
/*
213-
* AP cannot be disconnected. cyw43_wifi_leave is broken.
214-
* This code snippet should work, but doesn't.
215-
*
216-
* cyw43_wifi_leave(&cyw43_state, CYW43_ITF_AP);
217-
* cyw43_wifi_leave(&cyw43_state, CYW43_ITF_STA);
218-
*
219-
* bindings_cyw43_wifi_enforce_pm();
220-
*/
221215
}
222216

223217
static bool connection_unchanged(wifi_radio_obj_t *self, const uint8_t *ssid, size_t ssid_len) {

0 commit comments

Comments
 (0)