interim spi-led fix

This commit is contained in:
2019-10-22 01:29:48 +03:00
parent 26e8fed4e1
commit 86b19d081d
4 changed files with 14 additions and 1 deletions

View File

@@ -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;
};

View File

@@ -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);

View File

@@ -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<<F("cmd: ")<<cmd<<endl;
@@ -181,6 +186,7 @@ else item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
return 1;
//break;
case S_CMD:
item->setCmd(cmd);
switch (cmd)
{
case CMD_ON:

View File

@@ -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;