wifi_reset

This commit is contained in:
Bill Sideris 2023-09-28 17:53:40 +03:00
parent 8c37156675
commit c3cf7c0894
No known key found for this signature in database
GPG Key ID: 1BEF1BCEBA58EA33
2 changed files with 8 additions and 3 deletions

View File

@ -75,8 +75,13 @@ bool common_hal_wifi_radio_get_enabled(wifi_radio_obj_t *self) {
}
void common_hal_wifi_radio_set_enabled(wifi_radio_obj_t *self, bool enabled) {
self->enabled = enabled;
// TODO: Actually enable and disable the WiFi module at this point.
if (self->enabled && !enabled) {
common_hal_wifi_radio_stop_station(self);
common_hal_wifi_radio_stop_ap(self);
}
self->enabled = enabled;
}
mp_obj_t common_hal_wifi_radio_get_hostname(wifi_radio_obj_t *self) {

View File

@ -71,7 +71,7 @@ void common_hal_wifi_init(bool user_initiated) {
void wifi_user_reset(void) {
if (wifi_user_initiated) {
// wifi_reset();
wifi_reset();
wifi_user_initiated = false;
}
}
@ -83,7 +83,7 @@ void wifi_reset(void) {
// the cyw43 wifi chip is not reset due to https://github.com/raspberrypi/pico-sdk/issues/980
common_hal_wifi_monitor_deinit(MP_STATE_VM(wifi_monitor_singleton));
common_hal_wifi_radio_obj.current_scan = NULL;
// common_hal_wifi_radio_set_enabled(radio, false);
common_hal_wifi_radio_set_enabled(&common_hal_wifi_radio_obj, false);
supervisor_workflow_request_background();
}