Skip to content

Commit dcc27a8

Browse files
committed
Need to ensure wifi radio is set enabled again on esp32
.. otherwise, nothing set it enabled on the second soft reboot.
1 parent 72f5537 commit dcc27a8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ static bool wifi_ever_inited;
141141
static bool wifi_user_initiated;
142142

143143
void common_hal_wifi_init(bool user_initiated) {
144+
wifi_radio_obj_t *self = &common_hal_wifi_radio_obj;
145+
144146
if (wifi_inited) {
147+
if (user_initiated && !wifi_user_initiated) {
148+
common_hal_wifi_radio_set_enabled(self, true);
149+
}
145150
return;
146151
}
147152
wifi_inited = true;
@@ -154,7 +159,6 @@ void common_hal_wifi_init(bool user_initiated) {
154159
}
155160
wifi_ever_inited = true;
156161

157-
wifi_radio_obj_t *self = &common_hal_wifi_radio_obj;
158162
self->netif = esp_netif_create_default_wifi_sta();
159163
self->ap_netif = esp_netif_create_default_wifi_ap();
160164
self->started = false;
@@ -204,6 +208,7 @@ void common_hal_wifi_init(bool user_initiated) {
204208
void wifi_user_reset(void) {
205209
if (wifi_user_initiated) {
206210
wifi_reset();
211+
wifi_user_initiated = false;
207212
}
208213
}
209214

0 commit comments

Comments
 (0)