8000 esp32s2: initialize event loop ane netif only once · adafruit/circuitpython@dd108b7 · GitHub
[go: up one dir, main page]

Skip to content

Commit dd108b7

Browse files
committed
esp32s2: initialize event loop ane netif only once
deinitting these seems to cause problems.
1 parent 83d790a commit dd108b7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,17 @@ static void event_handler(void* arg, esp_event_base_t event_base,
8888
}
8989
}
9090

91-
static bool wifi_inited;
91+
static bool wifi_inited, wifi_ever_inited;
9292

9393
void common_hal_wifi_init(void) {
9494
wifi_inited = true;
9595
common_hal_wifi_radio_obj.base.type = &wifi_radio_type;
9696

97-
ESP_ERROR_CHECK(esp_netif_init());
98-
ESP_ERROR_CHECK(esp_event_loop_create_default());
97+
if (!wifi_ever_inited) {
98+
ESP_ERROR_CHECK(esp_netif_init());
99+
ESP_ERROR_CHECK(esp_event_loop_create_default());
100+
}
101+
wifi_ever_inited = true;
99102

100103
wifi_radio_obj_t* self = &common_hal_wifi_radio_obj;
101104
self->netif = esp_netif_create_default_wifi_sta();

0 commit comments

Comments
 (0)
0