From 7c9d9d171bdf166b4b5e3d18af018f26bdc7b9b9 Mon Sep 17 00:00:00 2001 From: Andrey Klimov Date: Sun, 22 Sep 2019 00:25:25 +0300 Subject: [PATCH] Critical AC fix Some additional commands compatibility for generic driver --- lighthub/item.cpp | 7 ++++++- lighthub/modules/out_ac.cpp | 9 +++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lighthub/item.cpp b/lighthub/item.cpp index e0931a0..f7ba6e0 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -496,7 +496,12 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode } - if (driver) return driver->Ctrl(cmd, n, Parameters, send, suffixCode, subItem); + if (driver) + { + int res = driver->Ctrl(cmd, n, Parameters, send, suffixCode, subItem); + setCmd(cmd); + return res; + } // Legacy code bool toExecute = (chActive>0); //if channel is already active - unconditionally propogate changes switch (cmd) { diff --git a/lighthub/modules/out_ac.cpp b/lighthub/modules/out_ac.cpp index 4f2bb8c..61dc10c 100644 --- a/lighthub/modules/out_ac.cpp +++ b/lighthub/modules/out_ac.cpp @@ -250,11 +250,11 @@ int out_AC::Ctrl(short cmd, short n, int * Parameters, boolean send, int suffixC switch(suffixCode) { case S_SET: - set_tmp = Parameters[0]-16; - if (set_tmp >= 0 && set_tmp <= 30) + set_tmp = Parameters[0]; + if (set_tmp >= 10 && set_tmp <= 30) { - data[B_SET_TMP] = set_tmp; - if (send) publishTopic(item->itemArr->name,(long)Parameters[0],"/set"); + data[B_SET_TMP] = set_tmp -16; + if (send) publishTopic(item->itemArr->name,(long) set_tmp,"/set"); } break; @@ -263,6 +263,7 @@ int out_AC::Ctrl(short cmd, short n, int * Parameters, boolean send, int suffixC switch (cmd) { case CMD_ON: + case CMD_XON: data[B_POWER] |= 1; SendData(on, sizeof(on)/sizeof(byte)); if (send) publishTopic(item->itemArr->name,"ON","/cmd");