From 1f8a303faf5ee84435980edaab5ff5452b23301d Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 27 Dec 2022 17:57:21 +0100 Subject: [PATCH] Add SO177 for debugging (#17500) --- tasmota/tasmota.ino | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index 67bf25cd5..b494ed303 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -688,10 +688,18 @@ void BacklogLoop(void) { void SleepDelay(uint32_t 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 - XdrvXsnsCall(FUNC_SLEEP_LOOP); // Main purpose is reacting ASAP on serial data availability or interrupt handling (ADE7880) - delay(1); + + if (Settings->flag6.spare31) { // SetOption177 - (Debug) Disable FUNC_SLEEP_LOOP + while (!TimeReached(wait) && !Serial.available()) { // We need to service serial buffer ASAP as otherwise we get uart buffer overrun + delay(1); + } + } else { + while (!TimeReached(wait) && !Serial.available()) { // We need to service serial buffer ASAP as otherwise we get uart buffer overrun + XdrvXsnsCall(FUNC_SLEEP_LOOP); // Main purpose is reacting ASAP on serial data availability or interrupt handling (ADE7880) + delay(1); + } } + } else { delay(0); }