Skip to content

Commit

Permalink
fix delay(0) (#8960)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-a-v committed Jul 18, 2023
1 parent 10cd3a1 commit b7f7b74
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7f7b74

Please sign in to comment.