Add command ``Backlog 1;``

Add command ``Backlog 1;`` to allow execution of following commands without delay
This commit is contained in:
Theo Arends 2021-04-07 17:55:33 +02:00
parent 403eba7a99
commit ad423d199d
4 changed files with 21 additions and 9 deletions

View File

@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
- Berry add ``gpio`` module - Berry add ``gpio`` module
- Berry add ``light`` module - Berry add ``light`` module
- Support for dummy energy monitor using user values set by commands ``VoltageSet``, ``CurrentSet``, ``PowerSet`` and ``FrequencySet``. Enable by selecting any GPIO as ``Option A2`` (#10640) - Support for dummy energy monitor using user values set by commands ``VoltageSet``, ``CurrentSet``, ``PowerSet`` and ``FrequencySet``. Enable by selecting any GPIO as ``Option A2`` (#10640)
- Command ``Backlog 1;`` to allow execution of following commands without delay
### Changed ### Changed
- PubSubClient library from EspEasy v2.7.12 to Tasmota v2.8.12 - PubSubClient library from EspEasy v2.7.12 to Tasmota v2.8.12

View File

@ -83,6 +83,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) [#11073](https://github.com/arendst/Tasmota/issues/11073) - Command ``Sensor80 1 <0..7>`` to control MFRC522 RFID antenna gain from 18dB (0) to 48dB (7) [#11073](https://github.com/arendst/Tasmota/issues/11073)
- Command ``SerialBuffer 256..520`` to change hardware serial receive buffer size from default (256) to max local buffer size (520) [#11448](https://github.com/arendst/Tasmota/issues/11448) - Command ``SerialBuffer 256..520`` to change hardware serial receive buffer size from default (256) to max local buffer size (520) [#11448](https://github.com/arendst/Tasmota/issues/11448)
- Command ``SetOption126 1`` to enable DS18x20 arithmetic mean over teleperiod for JSON temperature based on [#11472](https://github.com/arendst/Tasmota/issues/11472) - Command ``SetOption126 1`` to enable DS18x20 arithmetic mean over teleperiod for JSON temperature based on [#11472](https://github.com/arendst/Tasmota/issues/11472)
- Command ``Backlog 1;`` to allow execution of following commands without delay
- Commands ``MqttKeepAlive 1..100`` to set Mqtt Keep Alive timer (default 30) and ``MqttTimeout 1..100`` to set Mqtt Socket Timeout (default 4) [#5341](https://github.com/arendst/Tasmota/issues/5341) - Commands ``MqttKeepAlive 1..100`` to set Mqtt Keep Alive timer (default 30) and ``MqttTimeout 1..100`` to set Mqtt Socket Timeout (default 4) [#5341](https://github.com/arendst/Tasmota/issues/5341)
- Commands ``DisplayType`` to select sub-modules where implemented and ``DisplayInvert`` to select inverted display where implemented - Commands ``DisplayType`` to select sub-modules where implemented and ``DisplayInvert`` to select inverted display where implemented
- Support for SML VBUS [#11125](https://github.com/arendst/Tasmota/issues/11125) - Support for SML VBUS [#11125](https://github.com/arendst/Tasmota/issues/11125)

View File

@ -317,8 +317,10 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len)
/********************************************************************************************/ /********************************************************************************************/
void CmndBacklog(void) void CmndBacklog(void) {
{ // Backlog command1;command2;.. Execute commands in sequence with a delay in between set with SetOption34
// Backlog 1;command1;command2;.. Execute commands in sequence with no delay
if (XdrvMailbox.data_len) { if (XdrvMailbox.data_len) {
#ifdef SUPPORT_IF_STATEMENT #ifdef SUPPORT_IF_STATEMENT
@ -340,15 +342,19 @@ void CmndBacklog(void)
} }
} }
if (*blcommand != '\0') { if (*blcommand != '\0') {
if (BACKLOG_EMPTY && ('1' == *blcommand)) {
TasmotaGlobal.backlog_nodelay = true;
} else {
#ifdef SUPPORT_IF_STATEMENT #ifdef SUPPORT_IF_STATEMENT
if (backlog.size() < MAX_BACKLOG) { if (backlog.size() < MAX_BACKLOG) {
backlog.add(blcommand); backlog.add(blcommand);
} }
#else #else
TasmotaGlobal.backlog[TasmotaGlobal.backlog_index] = blcommand; TasmotaGlobal.backlog[TasmotaGlobal.backlog_index] = blcommand;
TasmotaGlobal.backlog_index++; TasmotaGlobal.backlog_index++;
if (TasmotaGlobal.backlog_index >= MAX_BACKLOG) TasmotaGlobal.backlog_index = 0; if (TasmotaGlobal.backlog_index >= MAX_BACKLOG) TasmotaGlobal.backlog_index = 0;
#endif #endif
}
} }
blcommand = strtok(nullptr, ";"); blcommand = strtok(nullptr, ";");
} }

View File

@ -141,6 +141,7 @@ struct {
bool rule_teleperiod; // Process rule based on teleperiod data using prefix TELE- bool rule_teleperiod; // Process rule based on teleperiod data using prefix TELE-
bool serial_local; // Handle serial locally bool serial_local; // Handle serial locally
bool fallback_topic_flag; // Use Topic or FallbackTopic bool fallback_topic_flag; // Use Topic or FallbackTopic
bool backlog_nodelay; // Execute all backlog commands with no delay
bool backlog_mutex; // Command backlog pending bool backlog_mutex; // Command backlog pending
bool stop_flash_rotate; // Allow flash configuration rotation bool stop_flash_rotate; // Allow flash configuration rotation
bool blinkstate; // LED state bool blinkstate; // LED state
@ -398,11 +399,14 @@ void BacklogLoop(void) {
if (!nodelay_detected) { if (!nodelay_detected) {
ExecuteCommand((char*)cmd.c_str(), SRC_BACKLOG); ExecuteCommand((char*)cmd.c_str(), SRC_BACKLOG);
} }
if (nodelay) { if (nodelay || TasmotaGlobal.backlog_nodelay) {
TasmotaGlobal.backlog_timer = millis(); // Reset backlog_timer which has been set by ExecuteCommand (CommandHandler) TasmotaGlobal.backlog_timer = millis(); // Reset backlog_timer which has been set by ExecuteCommand (CommandHandler)
} }
TasmotaGlobal.backlog_mutex = false; TasmotaGlobal.backlog_mutex = false;
} }
if (BACKLOG_EMPTY) {
TasmotaGlobal.backlog_nodelay = false;
}
} }
} }