mirror of https://github.com/arendst/Tasmota.git
Refactor backlog nodelay in relation to sleep
This commit is contained in:
parent
dd7cecc064
commit
60de9696d8
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue