esp32: don't fully reset the wifi device

.. this makes reconnecting without a full reset not work.

Because this works on other generations of the esp32 (c2, c3, etc),
apply this behavior only to esp32.

After this change, it's possible to connect multiple times to wifi in
different runs of code.py or the repl after soft rebooting.
This commit is contained in:
Jeff Epler 2022-07-14 14:57:12 -05:00
parent 01b18cc8dc
commit 72f5537027
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -214,6 +214,7 @@ void wifi_reset(void) {
common_hal_wifi_monitor_deinit(MP_STATE_VM(wifi_monitor_singleton));
wifi_radio_obj_t *radio = &common_hal_wifi_radio_obj;
common_hal_wifi_radio_set_enabled(radio, false);
#ifndef CONFIG_IDF_TARGET_ESP32
ESP_ERROR_CHECK(esp_event_handler_instance_unregister(WIFI_EVENT,
ESP_EVENT_ANY_ID,
radio->handler_instance_all_wifi));
@ -226,6 +227,7 @@ void wifi_reset(void) {
esp_netif_destroy(radio->ap_netif);
radio->ap_netif = NULL;
wifi_inited = false;
#endif
supervisor_workflow_request_background();
}