From 8ba0c9d1b7f5deb85bccc0cd3552579addf9b012 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Tue, 26 Jan 2021 12:03:08 +0100 Subject: [PATCH] Document CmndSetoptionBase() --- tasmota/support_command.ino | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index cbd04b426..b5389b00b 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -47,7 +47,7 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix void (* const TasmotaCommand[])(void) PROGMEM = { &CmndBacklog, &CmndDelay, &CmndPower, &CmndStatus, &CmndState, &CmndSleep, &CmndUpgrade, &CmndUpgrade, &CmndOtaUrl, &CmndSeriallog, &CmndRestart, &CmndPowerOnState, &CmndPulsetime, &CmndBlinktime, &CmndBlinkcount, &CmndSavedata, - &CmndSetoptionSO, &CmndSetoption, &CmndTemperatureResolution, &CmndHumidityResolution, &CmndPressureResolution, &CmndPowerResolution, + &CmndSetoption, &CmndSetoption, &CmndTemperatureResolution, &CmndHumidityResolution, &CmndPressureResolution, &CmndPowerResolution, &CmndVoltageResolution, &CmndFrequencyResolution, &CmndCurrentResolution, &CmndEnergyResolution, &CmndWeightResolution, &CmndModule, &CmndModules, &CmndGpio, &CmndGpios, &CmndTemplate, &CmndPwm, &CmndPwmfrequency, &CmndPwmrange, &CmndButtonDebounce, &CmndSwitchDebounce, &CmndSyslog, &CmndLoghost, &CmndLogport, &CmndSerialSend, &CmndBaudrate, &CmndSerialConfig, @@ -844,19 +844,17 @@ void CmndSavedata(void) ResponseCmndChar((Settings.save_data > 1) ? stemp1 : GetStateText(Settings.save_data)); } -void CmndSetoptionSO(void) -{ +void CmndSetoption(void) { snprintf_P(XdrvMailbox.command, CMDSZ, PSTR(D_CMND_SETOPTION)); // Rename result shortcut command SO to SetOption CmndSetoptionBase(1); } -void CmndSetoption(void) -{ - CmndSetoptionBase(1); -} - -void CmndSetoptionBase(bool indexed) -{ +void CmndSetoptionBase(bool indexed) { + // Allow a command to access a single SetOption by it's command name + // indexed = 0 : No index will be returned attached to the command + // {"ClockDirection":"OFF"} + // indexed = 1 : The SetOption index will be returned with the command + // {"SetOption16":"OFF"} if (XdrvMailbox.index < 146) { uint32_t ptype; uint32_t pindex;