diff options
| author | Dan Halbert <halbert@halwitz.org> | 2020-11-22 21:01:49 -0500 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2020-11-22 21:01:49 -0500 |
| commit | 25591a3f8a28d45157b082fcf8c9ba8a31cbe4f6 (patch) | |
| tree | 72808da72dcbbef97e7a13530222c2ba13c5dc6a | |
| parent | a0f1ec3c4a3dd52b11752e10d0dd31202e9c705f (diff) | |
| parent | f62ea25331678cc400c6149bbe3102c371540c6e (diff) | |
Merge branch 'esp32s2-common-hal-mcu-delay-us' into sleep
| -rw-r--r-- | ports/esp32s2/common-hal/microcontroller/__init__.c | 2 | ||||
| -rw-r--r-- | ports/esp32s2/common-hal/wifi/__init__.c | 10 |
2 files changed, 7 insertions, 5 deletions
diff --git a/ports/esp32s2/common-hal/microcontroller/__init__.c b/ports/esp32s2/common-hal/microcontroller/__init__.c index fdfbd65fa..9d87e4536 100644 --- a/ports/esp32s2/common-hal/microcontroller/__init__.c +++ b/ports/esp32s2/common-hal/microcontroller/__init__.c @@ -44,7 +44,7 @@ #include "esp_sleep.h" void common_hal_mcu_delay_us(uint32_t delay) { - + mp_hal_delay_us(delay); } volatile uint32_t nesting_count = 0; diff --git a/ports/esp32s2/common-hal/wifi/__init__.c b/ports/esp32s2/common-hal/wifi/__init__.c index 2eb3719b4..f53e68fc2 100644 --- a/ports/esp32s2/common-hal/wifi/__init__.c +++ b/ports/esp32s2/common-hal/wifi/__init__.c @@ -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(); @@ -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; } |
