From 152c2801ae834f170005215335c7cfb569610697 Mon Sep 17 00:00:00 2001 From: Federico Leoni Date: Tue, 9 Jun 2020 14:08:57 -0300 Subject: [PATCH] Prep for Tuya MCU Discovery --- tasmota/tasmota.h | 8 +++++ tasmota/xdrv_16_tuyamcu.ino | 62 ++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/tasmota/tasmota.h b/tasmota/tasmota.h index 949acec1b..c3913e8a1 100644 --- a/tasmota/tasmota.h +++ b/tasmota/tasmota.h @@ -344,4 +344,12 @@ const SerConfu8 kTasmotaSerialConfig[] PROGMEM = { SERIAL_5O2, SERIAL_6O2, SERIAL_7O2, SERIAL_8O2 }; +enum TuyaSupportedFunctions { TUYA_MCU_FUNC_NONE, TUYA_MCU_FUNC_SWT1 = 1, TUYA_MCU_FUNC_SWT2, TUYA_MCU_FUNC_SWT3, TUYA_MCU_FUNC_SWT4, + TUYA_MCU_FUNC_REL1 = 11, TUYA_MCU_FUNC_REL2, TUYA_MCU_FUNC_REL3, TUYA_MCU_FUNC_REL4, TUYA_MCU_FUNC_REL5, + TUYA_MCU_FUNC_REL6, TUYA_MCU_FUNC_REL7, TUYA_MCU_FUNC_REL8, TUYA_MCU_FUNC_DIMMER = 21, TUYA_MCU_FUNC_POWER = 31, + TUYA_MCU_FUNC_CURRENT, TUYA_MCU_FUNC_VOLTAGE, TUYA_MCU_FUNC_BATTERY_STATE, TUYA_MCU_FUNC_BATTERY_PERCENTAGE, + TUYA_MCU_FUNC_REL1_INV = 41, TUYA_MCU_FUNC_REL2_INV, TUYA_MCU_FUNC_REL3_INV, TUYA_MCU_FUNC_REL4_INV, TUYA_MCU_FUNC_REL5_INV, + TUYA_MCU_FUNC_REL6_INV, TUYA_MCU_FUNC_REL7_INV, TUYA_MCU_FUNC_REL8_INV, TUYA_MCU_FUNC_LOWPOWER_MODE = 51, TUYA_MCU_FUNC_LAST = 255 +}; + #endif // _TASMOTA_H_ diff --git a/tasmota/xdrv_16_tuyamcu.ino b/tasmota/xdrv_16_tuyamcu.ino index bada16061..5c5b1a120 100644 --- a/tasmota/xdrv_16_tuyamcu.ino +++ b/tasmota/xdrv_16_tuyamcu.ino @@ -73,37 +73,37 @@ struct TUYA { } Tuya; -enum TuyaSupportedFunctions { - TUYA_MCU_FUNC_NONE, - TUYA_MCU_FUNC_SWT1 = 1, // Buttons - TUYA_MCU_FUNC_SWT2, - TUYA_MCU_FUNC_SWT3, - TUYA_MCU_FUNC_SWT4, - TUYA_MCU_FUNC_REL1 = 11, // Relays - TUYA_MCU_FUNC_REL2, - TUYA_MCU_FUNC_REL3, - TUYA_MCU_FUNC_REL4, - TUYA_MCU_FUNC_REL5, - TUYA_MCU_FUNC_REL6, - TUYA_MCU_FUNC_REL7, - TUYA_MCU_FUNC_REL8, - TUYA_MCU_FUNC_DIMMER = 21, - TUYA_MCU_FUNC_POWER = 31, - TUYA_MCU_FUNC_CURRENT, - TUYA_MCU_FUNC_VOLTAGE, - TUYA_MCU_FUNC_BATTERY_STATE, - TUYA_MCU_FUNC_BATTERY_PERCENTAGE, - TUYA_MCU_FUNC_REL1_INV = 41, // Inverted Relays - TUYA_MCU_FUNC_REL2_INV, - TUYA_MCU_FUNC_REL3_INV, - TUYA_MCU_FUNC_REL4_INV, - TUYA_MCU_FUNC_REL5_INV, - TUYA_MCU_FUNC_REL6_INV, - TUYA_MCU_FUNC_REL7_INV, - TUYA_MCU_FUNC_REL8_INV, - TUYA_MCU_FUNC_LOWPOWER_MODE = 51, - TUYA_MCU_FUNC_LAST = 255 -}; +// enum TuyaSupportedFunctions { +// TUYA_MCU_FUNC_NONE, +// TUYA_MCU_FUNC_SWT1 = 1, // Buttons +// TUYA_MCU_FUNC_SWT2, +// TUYA_MCU_FUNC_SWT3, +// TUYA_MCU_FUNC_SWT4, +// TUYA_MCU_FUNC_REL1 = 11, // Relays +// TUYA_MCU_FUNC_REL2, +// TUYA_MCU_FUNC_REL3, +// TUYA_MCU_FUNC_REL4, +// TUYA_MCU_FUNC_REL5, +// TUYA_MCU_FUNC_REL6, +// TUYA_MCU_FUNC_REL7, +// TUYA_MCU_FUNC_REL8, +// TUYA_MCU_FUNC_DIMMER = 21, +// TUYA_MCU_FUNC_POWER = 31, +// TUYA_MCU_FUNC_CURRENT, +// TUYA_MCU_FUNC_VOLTAGE, +// TUYA_MCU_FUNC_BATTERY_STATE, +// TUYA_MCU_FUNC_BATTERY_PERCENTAGE, +// TUYA_MCU_FUNC_REL1_INV = 41, // Inverted Relays +// TUYA_MCU_FUNC_REL2_INV, +// TUYA_MCU_FUNC_REL3_INV, +// TUYA_MCU_FUNC_REL4_INV, +// TUYA_MCU_FUNC_REL5_INV, +// TUYA_MCU_FUNC_REL6_INV, +// TUYA_MCU_FUNC_REL7_INV, +// TUYA_MCU_FUNC_REL8_INV, +// TUYA_MCU_FUNC_LOWPOWER_MODE = 51, +// TUYA_MCU_FUNC_LAST = 255 +// }; const char kTuyaCommand[] PROGMEM = "|" // No prefix D_CMND_TUYA_MCU "|" D_CMND_TUYA_MCU_SEND_STATE;