Add command ``NoDelay``

Add command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
This commit is contained in:
Theo Arends 2020-10-15 12:32:40 +02:00
parent bd315810e6
commit 29e73dae9b
4 changed files with 23 additions and 10 deletions

View File

@ -6,6 +6,8 @@ All notable changes to this project will be documented in this file.
## [9.0.0.2]
### Added
- Support for Vietnamese language translations by Tâm.NT
- Support for timers in case of no-sunset permanent day by cybermaus (#9543)
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
### Changed
- Command ``Gpio17`` replaces command ``Adc``
@ -14,6 +16,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Convert AdcParam parameters from versions before v9.0.0.2
- Telegram message decoding error regression from v8.5.0.1
- Correct Energy period display shortly after midnight by gominoa (#9536)
## [9.0.0.1] - 20201010
### Added

View File

@ -59,6 +59,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
## Changelog v9.0.0.2
### Added
- Command ``NoDelay`` for immediate backlog command execution by Erik Montnemery (#9544)
- Optional support for Mitsubishi Electric HVAC by David Gwynne (#9237)
- Optional support for Orno WE517-Modbus energy meter by Maxime Vincent (#9353)
- SDM630 three phase ImportActive Energy display when ``#define SDM630_IMPORT`` is enabled by Janusz Kostorz (#9124)
@ -68,6 +69,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Zigbee ``ZbData`` command for better support of device specific data
- Support for analog buttons indexed within standard button range
- Support for Vietnamese language translations by Tâm.NT
- Support for timers in case of no-sunset permanent day by cybermaus (#9543)
### Changed
- Redesigned ESP8266 GPIO internal representation in line with ESP32 changing ``Template`` layout too
@ -88,6 +90,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota
- Light wakeup exception 0 (divide by zero) when ``WakeupDuration`` is not initialised (#9466)
- Thermostat sensor status corruption regression from v8.5.0.1 (#9449)
- Telegram message decoding error regression from v8.5.0.1
- Correct Energy period display shortly after midnight by gominoa (#9536)
### Removed
- Support for direct upgrade from Tasmota versions before v7.0

View File

@ -212,6 +212,7 @@
// Commands tasmota.ino
#define D_CMND_BACKLOG "Backlog"
#define D_CMND_DELAY "Delay"
#define D_CMND_NODELAY "NoDelay"
#define D_CMND_STATUS "Status"
#define D_STATUS1_PARAMETER "PRM"
#define D_STATUS2_FIRMWARE "FWR"

View File

@ -318,19 +318,25 @@ void setup(void) {
void BacklogLoop(void) {
if (TimeReached(backlog_delay)) {
if (!BACKLOG_EMPTY && !backlog_mutex) {
backlog_mutex = true;
bool nodelay = false;
bool nodelay_detected = false;
String cmd;
do {
#ifdef SUPPORT_IF_STATEMENT
backlog_mutex = true;
String cmd = backlog.shift();
backlog_mutex = false;
ExecuteCommand((char*)cmd.c_str(), SRC_BACKLOG);
cmd = backlog.shift();
#else
backlog_mutex = true;
ExecuteCommand((char*)backlog[backlog_pointer].c_str(), SRC_BACKLOG);
backlog[backlog_pointer] = (const char*) nullptr; // force deallocation of the String internal memory
backlog_pointer++;
if (backlog_pointer >= MAX_BACKLOG) { backlog_pointer = 0; }
backlog_mutex = false;
cmd = backlog[backlog_pointer];
backlog[backlog_pointer] = (const char*) nullptr; // Force deallocation of the String internal memory
backlog_pointer++;
if (backlog_pointer >= MAX_BACKLOG) { backlog_pointer = 0; }
#endif
nodelay_detected = !strncasecmp_P(cmd.c_str(), PSTR(D_CMND_NODELAY), strlen(D_CMND_NODELAY));
if (nodelay_detected) { nodelay = true; }
} while (nodelay_detected);
ExecuteCommand((char*)cmd.c_str(), SRC_BACKLOG);
if (nodelay) { backlog_delay = 0; } // Reset backlog_delay which has been set by ExecuteCommand (CommandHandler)
backlog_mutex = false;
}
}
}