From 545c6a3511dabe3a9c0731a87cbe1379498b08de Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 7 Apr 2023 13:03:20 +0200 Subject: [PATCH] Refactor saving some bytes --- tasmota/tasmota_support/support_command.ino | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tasmota/tasmota_support/support_command.ino b/tasmota/tasmota_support/support_command.ino index 6bc2989b5..4637cd09c 100644 --- a/tasmota/tasmota_support/support_command.ino +++ b/tasmota/tasmota_support/support_command.ino @@ -629,16 +629,14 @@ void CmndJson(void) { } else if (parameters.isObject()) { // Should have been escaped // AddLog(LOG_LEVEL_DEBUG, PSTR("JSN: Object")); } else { - if (strchr(parameters.getStr(), ';')) { - String compound = command; - compound += " "; - compound += parameters.getStr(); // Rule1 ON Clock#Timer=1 DO Backlog Color #FF000000D0; Wakeup 100 ENDON - ExecuteCommand((char*)compound.c_str(), SRC_FILE); - } else { + String cmnd_param = command; + cmnd_param += " "; + cmnd_param += parameters.getStr(); + if (cmnd_param.indexOf(";") == -1) { // Rule1 ON Clock#Timer=1 DO Backlog Color #FF000000D0; Wakeup 100 ENDON if (backlog.length()) { backlog += ";"; } - backlog += command; - backlog += " "; - backlog += parameters.getStr(); // HSBColor 51,97,100 + backlog += cmnd_param; // HSBColor 51,97,100 + } else { + ExecuteCommand((char*)cmnd_param.c_str(), SRC_FILE); } } }