From 60de9696d88e813fec21a9b88c4c5bb70251993c Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 9 Apr 2021 14:00:09 +0200 Subject: [PATCH] Refactor backlog nodelay in relation to sleep --- tasmota/support_command.ino | 4 ---- tasmota/tasmota.ino | 6 ++---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index b81a86b10..b0f4d7b2d 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -323,11 +323,7 @@ void CmndBacklog(void) { if (XdrvMailbox.data_len) { if (0 == XdrvMailbox.index) { - if (!TasmotaGlobal.backlog_nodelay) { - TasmotaGlobal.backlog_sleep = TasmotaGlobal.sleep; - } TasmotaGlobal.backlog_nodelay = true; - TasmotaGlobal.sleep = 0; } #ifdef SUPPORT_IF_STATEMENT diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 94bda17b7..b9e94829a 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -170,7 +170,6 @@ struct { uint8_t latching_relay_pulse; // Latching relay pulse timer uint8_t active_device; // Active device in ExecuteCommandPower uint8_t sleep; // Current copy of Settings.sleep - uint8_t backlog_sleep; // Copy of sleep uint8_t leds_present; // Max number of LED supported uint8_t led_inverted; // LED inverted flag (1 = (0 = On, 1 = Off)) uint8_t led_power; // LED power state @@ -405,15 +404,14 @@ void BacklogLoop(void) { } TasmotaGlobal.backlog_mutex = false; } - if (BACKLOG_EMPTY && TasmotaGlobal.backlog_nodelay) { + if (BACKLOG_EMPTY) { TasmotaGlobal.backlog_nodelay = false; - TasmotaGlobal.sleep = TasmotaGlobal.backlog_sleep; } } } void SleepDelay(uint32_t mseconds) { - if (mseconds) { + if (!TasmotaGlobal.backlog_nodelay && mseconds) { uint32_t wait = millis() + mseconds; while (!TimeReached(wait) && !Serial.available()) { // We need to service serial buffer ASAP as otherwise we get uart buffer overrun delay(1);