Skip to content

Commit 25591a3

Browse files
committed
Merge branch 'esp32s2-common-hal-mcu-delay-us' into sleep
2 parents a0f1ec3 + f62ea25 commit 25591a3

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
#include "esp_sleep.h"
4545

4646
void common_hal_mcu_delay_us(uint32_t delay) {
47-
47+
mp_hal_delay_us(delay);
4848
}
4949

5050
volatile uint32_t nesting_count = 0;

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

Lines changed: 6 additions & 4 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();
@@ -143,7 +146,6 @@ void wifi_reset(void) {
143146
radio->handler_instance_got_ip));
144147
ESP_ERROR_CHECK(esp_wifi_deinit());
145148
esp_netif_destroy(radio->netif);
146-
ESP_ERROR_CHECK(esp_event_loop_delete_default());
147149
radio->netif = NULL;
148150
}
149151

0 commit comments

Comments
 (0)