mirror of https://github.com/arendst/Tasmota.git
parent
c33d5efd72
commit
f9403c8489
|
@ -367,13 +367,19 @@ void BacklogLoop(void) {
|
|||
|
||||
void SleepDelay(uint32_t mseconds) {
|
||||
if (mseconds) {
|
||||
for (uint32_t wait = 0; wait < mseconds; wait++) {
|
||||
// ESP8266 does an optimistic_yield(1000) in Serial.available()
|
||||
// ESP32 does not so needs delay here
|
||||
#ifdef ESP32
|
||||
delay(1);
|
||||
uint32_t wait = millis() + mseconds;
|
||||
while (!TimeReached(wait)) {
|
||||
#ifdef ESP8266
|
||||
if ((wait - millis()) > 10) { // ESP8266 does an optimistic_yield(10000) in Serial.available()
|
||||
#endif
|
||||
if (Serial.available()) { break; } // We need to service serial buffer ASAP as otherwise we get uart buffer overrun
|
||||
if (Serial.available()) { return; } // We need to service serial buffer ASAP as otherwise we get uart buffer overrun
|
||||
#ifdef ESP8266
|
||||
} else {
|
||||
#endif
|
||||
delay(1);
|
||||
#ifdef ESP8266
|
||||
}
|
||||
#endif // ESP8266
|
||||
}
|
||||
} else {
|
||||
delay(0);
|
||||
|
|
Loading…
Reference in New Issue