Skip to content

Commit d179eb4

Browse files
authored
Merge pull request #8371 from bill88t/rpi-auto-disconnect
`stop_station` when no wifi-reconnect
2 parents 985a49a + 2284211 commit d179eb4

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,13 @@ bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) {
7575
}
7676

7777
void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) {
78-
self->enabled = enabled;
7978
// TODO: Actually enable and disable the WiFi module at this point.
79+
if (self->enabled && !enabled) {
80+
common_hal_wifi_radio_stop_station(self);
81+
common_hal_wifi_radio_stop_ap(self);
82+
}
83+
self->enabled = enabled;
84+
8085
}
8186

8287
mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void common_hal_wifi_init(bool user_initiated) {
7171

7272
void wifi_user_reset(void) {
7373
if (wifi_user_initiated) {
74-
// wifi_reset();
74+
wifi_reset();
7575
wifi_user_initiated = false;
7676
}
7777
}
@@ -83,7 +83,7 @@ void wifi_reset(void) {
8383
// the cyw43 wifi chip is not reset due to https://github.com/raspberrypi/pico-sdk/issues/980
8484
common_hal_wifi_monitor_deinit(MP_STATE_VM(wifi_monitor_singleton));
8585
common_hal_wifi_radio_obj.current_scan = NULL;
86-
// common_hal_wifi_radio_set_enabled(radio, false);
86+
common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, false);
8787
supervisor_workflow_request_background();
8888
}
8989

0 commit comments

Comments
 (0)