mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
HSV -> RGB translation for Adafruit fixed (OMG!)
RGB volume restoring issue fixed AirFlow regulator action timer more precsision
This commit is contained in:
@@ -722,12 +722,12 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
|||||||
switch (itemType) {
|
switch (itemType) {
|
||||||
case CH_DIMMER:
|
case CH_DIMMER:
|
||||||
case CH_MODBUS:
|
case CH_MODBUS:
|
||||||
if (st.aslong<MIN_VOLUME) st.aslong=INIT_VOLUME;
|
if (st.aslong<MIN_VOLUME && send) st.aslong=INIT_VOLUME;
|
||||||
setVal(st.aslong);
|
setVal(st.aslong);
|
||||||
break;
|
break;
|
||||||
case CH_RGB:
|
case CH_RGB:
|
||||||
case CH_RGBW:
|
case CH_RGBW:
|
||||||
if (st.aslong && (st.v<MIN_VOLUME)) st.v=INIT_VOLUME;
|
if (st.aslong && (st.v<MIN_VOLUME) && send) st.v=INIT_VOLUME;
|
||||||
setVal(st.aslong);
|
setVal(st.aslong);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -894,7 +894,7 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
|||||||
{
|
{
|
||||||
#ifdef ADAFRUIT_LED
|
#ifdef ADAFRUIT_LED
|
||||||
Adafruit_NeoPixel strip(0, 0, 0);
|
Adafruit_NeoPixel strip(0, 0, 0);
|
||||||
uint32_t rgb = strip.ColorHSV(map(Par[0], 0, 365, 0, 655535), rgbSaturation, rgbValue);
|
uint32_t rgb = strip.ColorHSV(map(Par[0], 0, 365, 0, 65535), rgbSaturation, rgbValue);
|
||||||
DmxWrite(iaddr, (rgb >> 16)& 0xFF);
|
DmxWrite(iaddr, (rgb >> 16)& 0xFF);
|
||||||
DmxWrite(iaddr + 1, (rgb >> 8) & 0xFF);
|
DmxWrite(iaddr + 1, (rgb >> 8) & 0xFF);
|
||||||
DmxWrite(iaddr + 2, rgb & 0xFF);
|
DmxWrite(iaddr + 2, rgb & 0xFF);
|
||||||
@@ -1548,7 +1548,7 @@ switch (cause)
|
|||||||
|
|
||||||
void Item::sendDelayedStatus()
|
void Item::sendDelayedStatus()
|
||||||
{ long int flags = getFlag(SEND_COMMAND | SEND_PARAMETERS);
|
{ long int flags = getFlag(SEND_COMMAND | SEND_PARAMETERS);
|
||||||
debugSerial<<flags<<F(" Delayed Status ")<<itemArr->name<<endl;
|
// debugSerial<<flags<<F(" Delayed Status ")<<itemArr->name<<endl;
|
||||||
if (flags)
|
if (flags)
|
||||||
{
|
{
|
||||||
SendStatus(SEND_COMMAND | SEND_PARAMETERS);
|
SendStatus(SEND_COMMAND | SEND_PARAMETERS);
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ case S_SET:
|
|||||||
if (chActive>0 && !st) item->setCmd(CMD_OFF);
|
if (chActive>0 && !st) item->setCmd(CMD_OFF);
|
||||||
if (chActive==0 && st) item->setCmd(CMD_ON);
|
if (chActive==0 && st) item->setCmd(CMD_ON);
|
||||||
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS | SEND_DEFFERED);
|
item->SendStatus(SEND_COMMAND | SEND_PARAMETERS | SEND_DEFFERED);
|
||||||
item->setExt(millis()+maxOnTime); //Extend motor time
|
if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
|
||||||
}
|
}
|
||||||
else item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
|
else item->SendStatus(SEND_PARAMETERS | SEND_DEFFERED);
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ case S_CMD:
|
|||||||
st = item->getVal();
|
st = item->getVal();
|
||||||
|
|
||||||
|
|
||||||
if (st && (st<MIN_VOLUME)) st=INIT_VOLUME;
|
if (st && (st<MIN_VOLUME) && send) st=INIT_VOLUME;
|
||||||
item->setVal(st);
|
item->setVal(st);
|
||||||
|
|
||||||
if (st) //Stored smthng
|
if (st) //Stored smthng
|
||||||
@@ -227,12 +227,12 @@ case S_CMD:
|
|||||||
item->setVal(st);
|
item->setVal(st);
|
||||||
if (send) item->SendStatus(SEND_COMMAND | SEND_PARAMETERS );
|
if (send) item->SendStatus(SEND_COMMAND | SEND_PARAMETERS );
|
||||||
}
|
}
|
||||||
item->setExt(millis()+maxOnTime); //Extend motor time
|
if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case CMD_OFF:
|
case CMD_OFF:
|
||||||
if (send) item->SendStatus(SEND_COMMAND);
|
if (send) item->SendStatus(SEND_COMMAND);
|
||||||
item->setExt(millis()+maxOnTime); //Extend motor time
|
if (item->getExt()) item->setExt(millis()+maxOnTime); //Extend motor time
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
} //switch cmd
|
} //switch cmd
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ CRGB pixel;
|
|||||||
int Value = map(st->v, 0, 100, 0, 255);
|
int Value = map(st->v, 0, 100, 0, 255);
|
||||||
|
|
||||||
#ifdef ADAFRUIT_LED
|
#ifdef ADAFRUIT_LED
|
||||||
uint16_t Hue = map(st->h, 0, 365, 0, 655535);
|
uint16_t Hue = map(st->h, 0, 365, 0, 65535);
|
||||||
pixel = leds->ColorHSV(Hue, Saturation, Value);
|
pixel = leds->ColorHSV(Hue, Saturation, Value);
|
||||||
#else
|
#else
|
||||||
int Hue = map(st->h, 0, 365, 0, 255);
|
int Hue = map(st->h, 0, 365, 0, 255);
|
||||||
@@ -287,7 +287,7 @@ case S_CMD:
|
|||||||
PixelCtrl(&st,CMD_ON,from,to);
|
PixelCtrl(&st,CMD_ON,from,to);
|
||||||
else //whole strip
|
else //whole strip
|
||||||
{
|
{
|
||||||
if (st.aslong && (st.v<MIN_VOLUME)) st.v=INIT_VOLUME;
|
if (st.aslong && (st.v<MIN_VOLUME) && send) st.v=INIT_VOLUME;
|
||||||
item->setVal(st.aslong);
|
item->setVal(st.aslong);
|
||||||
|
|
||||||
if (st.aslong ) //Stored smthng
|
if (st.aslong ) //Stored smthng
|
||||||
|
|||||||
Reference in New Issue
Block a user