diff --git a/components/FastLED-idf/hal/esp32-hal-misc.c b/components/FastLED-idf/hal/esp32-hal-misc.c index bae5a75..56a98a7 100644 --- a/components/FastLED-idf/hal/esp32-hal-misc.c +++ b/components/FastLED-idf/hal/esp32-hal-misc.c @@ -153,17 +153,11 @@ void delay(uint32_t ms) void IRAM_ATTR delayMicroseconds(uint32_t us) { - uint32_t m = micros(); + uint64_t now = esp_timer_get_time(); if(us){ - uint32_t e = (m + us); - if(m > e){ //overflow - while(micros() > e){ - NOP(); - } - } - while(micros() < e){ + do { NOP(); - } + } while ((esp_timer_get_time() - now) < us); } }