Optimize sleepdelay

Optimize sleepdelay (#10379)
This commit is contained in:
Theo Arends 2021-01-03 15:28:52 +01:00
parent 1e49cb5a2a
commit 7b5184c89b

View File

@ -368,7 +368,11 @@ 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);
#endif
if (Serial.available()) { break; } // We need to service serial buffer ASAP as otherwise we get uart buffer overrun
}
} else {
@ -383,7 +387,6 @@ void loop(void) {
XsnsCall(FUNC_LOOP);
OsWatchLoop();
ButtonLoop();
SwitchLoop();
#ifdef USE_DEVICE_GROUPS