From 5c92c5a9a98c94a1f73f86d82bb13c927a7f1c54 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 4 Jan 2021 12:47:00 +0100 Subject: [PATCH] Optimize sleepdelay --- tasmota/tasmota.ino | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index a4c39681a..8eb7303fb 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -368,8 +368,7 @@ void BacklogLoop(void) { void SleepDelay(uint32_t mseconds) { if (mseconds) { uint32_t wait = millis() + mseconds; - while (!TimeReached(wait)) { - if (Serial.available()) { return; } // We need to service serial buffer ASAP as otherwise we get uart buffer overrun + while (!TimeReached(wait) && !Serial.available()) { // We need to service serial buffer ASAP as otherwise we get uart buffer overrun delay(1); } } else {