mirror of https://github.com/arendst/Tasmota.git
Add command ``Backlog3`` to execute commands without response but rule processing (#21740)
This commit is contained in:
parent
60d0c2208b
commit
09b2670c45
|
@ -305,8 +305,10 @@ struct TasmotaGlobal_t {
|
|||
|
||||
bool serial_local; // Handle serial locally
|
||||
bool fallback_topic_flag; // Use Topic or FallbackTopic
|
||||
bool no_mqtt_response; // Respond with rule processing only
|
||||
bool backlog_nodelay; // Execute all backlog commands with no delay
|
||||
bool backlog_mutex; // Command backlog pending
|
||||
bool backlog_no_mqtt_response; // Set respond with rule processing only
|
||||
bool stop_flash_rotate; // Allow flash configuration rotation
|
||||
bool blinkstate; // LED state
|
||||
bool pwm_present; // Any PWM channel configured with SetOption15 0
|
||||
|
@ -711,6 +713,7 @@ void BacklogLoop(void) {
|
|||
free(cmd);
|
||||
nodelay = true;
|
||||
} else {
|
||||
TasmotaGlobal.no_mqtt_response = TasmotaGlobal.backlog_no_mqtt_response;
|
||||
ExecuteCommand(cmd, SRC_BACKLOG);
|
||||
free(cmd);
|
||||
if (nodelay || TasmotaGlobal.backlog_nodelay) {
|
||||
|
@ -719,23 +722,6 @@ void BacklogLoop(void) {
|
|||
break;
|
||||
}
|
||||
} while (!BACKLOG_EMPTY);
|
||||
/*
|
||||
// This adds 96 bytes
|
||||
for (auto &cmd : backlog) {
|
||||
backlog.remove(&cmd);
|
||||
if (!strncasecmp_P(cmd, PSTR(D_CMND_NODELAY), strlen(D_CMND_NODELAY))) {
|
||||
free(cmd);
|
||||
nodelay = true;
|
||||
} else {
|
||||
ExecuteCommand(cmd, SRC_BACKLOG);
|
||||
free(cmd);
|
||||
if (nodelay || TasmotaGlobal.backlog_nodelay) {
|
||||
TasmotaGlobal.backlog_timer = millis(); // Reset backlog_timer which has been set by ExecuteCommand (CommandHandler)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
TasmotaGlobal.backlog_mutex = false;
|
||||
}
|
||||
if (BACKLOG_EMPTY) {
|
||||
|
|
|
@ -474,19 +474,25 @@ void CommandHandler(char* topicBuf, char* dataBuf, uint32_t data_len) {
|
|||
}
|
||||
|
||||
if (ResponseLength()) {
|
||||
if (TasmotaGlobal.no_mqtt_response){ // If it is activated, Tasmota will not publish MQTT messages, but it will proccess event trigger rules
|
||||
XdrvRulesProcess(0);
|
||||
} else {
|
||||
MqttPublishPrefixTopicRulesProcess_P(RESULT_OR_STAT, type);
|
||||
}
|
||||
}
|
||||
TasmotaGlobal.fallback_topic_flag = false;
|
||||
TasmotaGlobal.no_mqtt_response = false;
|
||||
}
|
||||
|
||||
void CmndBacklog(void) {
|
||||
// Backlog command1;command2;.. Execute commands in sequence with a delay in between set with SetOption34
|
||||
// Backlog0 command1;command2;.. Execute commands in sequence with no delay
|
||||
// Backlog2 command1;command2;.. Execute commands in sequence with no delay and no response but rule processing only
|
||||
// Backlog3 command1;command2;.. Execute commands in sequence with a delay but no response but rule processing only
|
||||
|
||||
if (XdrvMailbox.data_len) {
|
||||
if (0 == XdrvMailbox.index) {
|
||||
TasmotaGlobal.backlog_nodelay = true;
|
||||
}
|
||||
TasmotaGlobal.backlog_nodelay = (0 == (XdrvMailbox.index & 0x01)); // Backlog0, Backlog2
|
||||
TasmotaGlobal.backlog_no_mqtt_response = (2 == (XdrvMailbox.index & 0x02)); // Backlog2, Backlog3
|
||||
|
||||
char *blcommand = strtok(XdrvMailbox.data, ";");
|
||||
while (blcommand != nullptr) {
|
||||
|
|
Loading…
Reference in New Issue