Add SO177 for debugging (#17500)

This commit is contained in:
Theo Arends 2022-12-27 17:57:21 +01:00
parent bd4fe78775
commit 1f8a303faf
1 changed files with 11 additions and 3 deletions

View File

@ -688,10 +688,18 @@ void BacklogLoop(void) {
void SleepDelay(uint32_t mseconds) { void SleepDelay(uint32_t mseconds) {
if (!TasmotaGlobal.backlog_nodelay && mseconds) { if (!TasmotaGlobal.backlog_nodelay && mseconds) {
uint32_t wait = millis() + 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) if (Settings->flag6.spare31) { // SetOption177 - (Debug) Disable FUNC_SLEEP_LOOP
delay(1); 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 { } else {
delay(0); delay(0);
} }