mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
fix delay(0) (#8960)
This commit is contained in:
parent
10cd3a1eae
commit
b7f7b7488a
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user