diff --git a/lighthub/abstractout.h b/lighthub/abstractout.h index 766027d..a4e8ac6 100644 --- a/lighthub/abstractout.h +++ b/lighthub/abstractout.h @@ -9,6 +9,7 @@ public: virtual int Ctrl(short cmd, short n=0, int * Parameters=NULL, boolean send=true, int suffixCode=0, char* subItem=NULL) =0; virtual int isActive(){return 0;}; virtual int getDefaultOnVal(){return 100;}; + virtual int getChanType(){return 0;} protected: Item * item; }; diff --git a/lighthub/item.cpp b/lighthub/item.cpp index 4eda43c..69e2d08 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -1468,9 +1468,11 @@ int Item::SendStatus(int sendFlags) { { // Preparing parameters payload ////////// CHstore st; + int chanType = itemType; + if (driver) chanType = driver->getChanType(); //retrive stored values st.aslong = getVal(); - switch (itemType) { + switch (chanType) { //case CH_GROUP: case CH_RGBW: case CH_RGB: @@ -1481,6 +1483,9 @@ int Item::SendStatus(int sendFlags) { snprintf(valstr, sizeof(valstr), "%d,%d,%d", st.h,st.s,st.v); else snprintf(valstr, sizeof(valstr), "%d", st.v); + break; + case CH_RELAY: + sendFlags &= ~SEND_PARAMETERS; //No need to send value for relay break; default: snprintf(valstr, sizeof(valstr), "%d", st.aslong); diff --git a/lighthub/modules/out_spiled.cpp b/lighthub/modules/out_spiled.cpp index cb4b4e6..09423cf 100644 --- a/lighthub/modules/out_spiled.cpp +++ b/lighthub/modules/out_spiled.cpp @@ -53,6 +53,11 @@ int out_SPILed::Poll() return 1; }; +int out_SPILed::getChanType() +{ + return CH_RGB; +} + int out_SPILed::PixelCtrl(CHstore *st, short cmd, int from, int to, bool show, bool rgb) { //debugSerial<SendStatus(SEND_PARAMETERS | SEND_DEFFERED); return 1; //break; case S_CMD: + item->setCmd(cmd); switch (cmd) { case CMD_ON: diff --git a/lighthub/modules/out_spiled.h b/lighthub/modules/out_spiled.h index bd15d83..57f7ff3 100644 --- a/lighthub/modules/out_spiled.h +++ b/lighthub/modules/out_spiled.h @@ -13,6 +13,7 @@ public: int Stop() override; int Status() override; int isActive() override; + int getChanType() override; int Ctrl(short cmd, short n=0, int * Parameters=NULL, boolean send=true, int suffixCode=0, char* subItem=NULL) override; int PixelCtrl(CHstore *st, short cmd, int from =0 , int to = 1024, bool show = 1, bool rgb = 0); int numLeds;