From 8b5961c37d1a4ec604f174643dfafe3e6574d0a0 Mon Sep 17 00:00:00 2001 From: Marcus Date: Wed, 6 Jan 2021 23:53:46 +0100 Subject: [PATCH] remove code that did not seem to be necessary --- tasmota/xdrv_48_timeprop.ino | 51 ------------------------------------ 1 file changed, 51 deletions(-) diff --git a/tasmota/xdrv_48_timeprop.ino b/tasmota/xdrv_48_timeprop.ino index a457c8d94..6e8537dbb 100644 --- a/tasmota/xdrv_48_timeprop.ino +++ b/tasmota/xdrv_48_timeprop.ino @@ -82,11 +82,6 @@ # include "Timeprop.h" -#define D_CMND_TIMEPROP "timeprop_" -#define D_CMND_TIMEPROP_SETPOWER "setpower_" // add index no on end (0:8) and data is power 0:1 - -enum TimepropCommands { CMND_TIMEPROP_SETPOWER }; -const char kTimepropCommands[] PROGMEM = D_CMND_TIMEPROP_SETPOWER; static Timeprop timeprops[TIMEPROP_NUM_OUTPUTS]; static int relayNos[TIMEPROP_NUM_OUTPUTS] = {TIMEPROP_RELAYS}; @@ -148,50 +143,7 @@ void Timeprop_Xdrv_Power() { /* } XdrvMailbox; */ // To get here post with topic cmnd/timeprop_setpower_n where n is index into timeprops 0:7 -bool Timeprop_Command() -{ - char command [CMDSZ]; - bool serviced = true; - uint8_t ua_prefix_len = strlen(D_CMND_TIMEPROP); // to detect prefix of command - /* - snprintf_P(log_data, sizeof(log_data), "Command called: " - "index: %d data_len: %d payload: %d topic: %s data: %s\n", - XdrvMailbox.index, - XdrvMailbox.data_len, - XdrvMailbox.payload, - (XdrvMailbox.payload >= 0 ? XdrvMailbox.topic : ""), - (XdrvMailbox.data_len >= 0 ? XdrvMailbox.data : "")); - AddLog(LOG_LEVEL_INFO); - */ - if (0 == strncasecmp_P(XdrvMailbox.topic, PSTR(D_CMND_TIMEPROP), ua_prefix_len)) { - // command starts with timeprop_ - int command_code = GetCommandCode(command, sizeof(command), XdrvMailbox.topic + ua_prefix_len, kTimepropCommands); - if (CMND_TIMEPROP_SETPOWER == command_code) { - /* - snprintf_P(log_data, sizeof(log_data), "Timeprop command timeprop_setpower: " - "index: %d data_len: %d payload: %d topic: %s data: %s", - XdrvMailbox.index, - XdrvMailbox.data_len, - XdrvMailbox.payload, - (XdrvMailbox.payload >= 0 ? XdrvMailbox.topic : ""), - (XdrvMailbox.data_len >= 0 ? XdrvMailbox.data : "")); - AddLog(LOG_LEVEL_INFO); - */ - if (XdrvMailbox.index >=0 && XdrvMailbox.index < TIMEPROP_NUM_OUTPUTS) { - timeprops[XdrvMailbox.index].setPower( atof(XdrvMailbox.data), timeprop_current_time_secs ); - } - snprintf_P(TasmotaGlobal.mqtt_data, sizeof(TasmotaGlobal.mqtt_data), PSTR("{\"" D_CMND_TIMEPROP D_CMND_TIMEPROP_SETPOWER "%d\":\"%s\"}"), - XdrvMailbox.index, XdrvMailbox.data); - } - else { - serviced = false; - } - } else { - serviced = false; - } - return serviced; -} /*********************************************************************************************\ * Interface @@ -210,9 +162,6 @@ bool Xdrv48(byte function) case FUNC_EVERY_SECOND: Timeprop_Every_Second(); break; - case FUNC_COMMAND: - result = Timeprop_Command(); - break; case FUNC_SET_POWER: Timeprop_Xdrv_Power(); break;