From ec206fea2593cdd18a70fd5a5e650561cbf08e6f Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Tue, 18 Jul 2023 23:40:02 +0200 Subject: [PATCH] fix delay(0) --- cores/esp8266/core_esp8266_main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cores/esp8266/core_esp8266_main.cpp b/cores/esp8266/core_esp8266_main.cpp index f034f46524..d0309cc71f 100644 --- a/cores/esp8266/core_esp8266_main.cpp +++ b/cores/esp8266/core_esp8266_main.cpp @@ -166,6 +166,11 @@ extern "C" void __esp_delay(unsigned long ms) { extern "C" void esp_delay(unsigned long ms) __attribute__((weak, alias("__esp_delay"))); bool esp_try_delay(const uint32_t start_ms, const uint32_t timeout_ms, const uint32_t intvl_ms) { + if (!timeout_ms) { + esp_yield(); + return true; + } + uint32_t expired = millis() - start_ms; if (expired >= timeout_ms) { return true; // expired