mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-01 03:26:58 +03:00
fix delay(0) (#8960)
This commit is contained in:
@ -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")));
|
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) {
|
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;
|
uint32_t expired = millis() - start_ms;
|
||||||
if (expired >= timeout_ms) {
|
if (expired >= timeout_ms) {
|
||||||
return true; // expired
|
return true; // expired
|
||||||
|
Reference in New Issue
Block a user