From ceeb2293e2354d57024bf36236c3e29eb4e619f5 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Mon, 25 Jan 2021 17:44:17 +0100 Subject: [PATCH] Prep for SO synonyms --- tasmota/support_command.ino | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index d037670d9..cbd04b426 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -847,13 +847,16 @@ void CmndSavedata(void) void CmndSetoptionSO(void) { snprintf_P(XdrvMailbox.command, CMDSZ, PSTR(D_CMND_SETOPTION)); // Rename result shortcut command SO to SetOption - CmndSetoption(); + CmndSetoptionBase(1); } void CmndSetoption(void) { -// snprintf_P(XdrvMailbox.command, CMDSZ, PSTR(D_CMND_SETOPTION)); // Rename result shortcut command SO to SetOption + CmndSetoptionBase(1); +} +void CmndSetoptionBase(bool indexed) +{ if (XdrvMailbox.index < 146) { uint32_t ptype; uint32_t pindex; @@ -996,7 +999,11 @@ void CmndSetoption(void) if (ptype < 99) { if (1 == ptype) { - ResponseCmndIdxNumber(Settings.param[pindex]); + if (indexed) { + ResponseCmndIdxNumber(Settings.param[pindex]); + } else { + ResponseCmndNumber(Settings.param[pindex]); + } } else { uint32_t flag = Settings.flag.data; if (3 == ptype) { @@ -1008,7 +1015,11 @@ void CmndSetoption(void) else if (5 == ptype) { flag = Settings.flag5.data; } - ResponseCmndIdxChar(GetStateText(bitRead(flag, pindex))); + if (indexed) { + ResponseCmndIdxChar(GetStateText(bitRead(flag, pindex))); + } else { + ResponseCmndChar(GetStateText(bitRead(flag, pindex))); + } } } }