8000 esp32s2: don't delete the event loop by jepler · Pull Request #3716 · adafruit/circuitpython · GitHub
[go: up one dir, main page]

Skip to content

esp32s2: don't delete the event loop #3716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions ports/esp32s2/common-hal/wifi/__init__.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,17 @@ static void event_handler(void* arg, esp_event_base_t event_base,
}
}

static bool wifi_inited;
static bool wifi_inited, wifi_ever_inited;

void common_hal_wifi_init(void) {
wifi_inited = true;
common_hal_wifi_radio_obj.base.type = &wifi_radio_type;

ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
if (!wifi_ever_inited) {
ESP_ERROR_CHECK(esp_netif_init());
ESP_ERROR_CHECK(esp_event_loop_create_default());
}
wifi_ever_inited = true;

wifi_radio_obj_t* self = &common_hal_wifi_radio_obj;
self->netif = esp_netif_create_default_wifi_sta();
Expand Down Expand Up @@ -143,7 +146,6 @@ void wifi_reset(void) {
radio->handler_instance_got_ip));
ESP_ERROR_CHECK(esp_wifi_deinit());
esp_netif_destroy(radio->netif);
ESP_ERROR_CHECK(esp_event_loop_delete_default());
radio->netif = NULL;
}

Expand Down
0