mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 19:59:50 +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) {
|
||||
case CH_DIMMER:
|
||||
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);
|
||||
break;
|
||||
case CH_RGB:
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -894,7 +894,7 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
||||
{
|
||||
#ifdef ADAFRUIT_LED
|
||||
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 + 1, (rgb >> 8) & 0xFF);
|
||||
DmxWrite(iaddr + 2, rgb & 0xFF);
|
||||
@@ -1548,7 +1548,7 @@ switch (cause)
|
||||
|
||||
void Item::sendDelayedStatus()
|
||||
{ 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)
|
||||
{
|
||||
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_ON);
|
||||
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);
|
||||
|
||||
@@ -211,7 +211,7 @@ case S_CMD:
|
||||
st = item->getVal();
|
||||
|
||||
|
||||
if (st && (st<MIN_VOLUME)) st=INIT_VOLUME;
|
||||
if (st && (st<MIN_VOLUME) && send) st=INIT_VOLUME;
|
||||
item->setVal(st);
|
||||
|
||||
if (st) //Stored smthng
|
||||
@@ -227,12 +227,12 @@ case S_CMD:
|
||||
item->setVal(st);
|
||||
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;
|
||||
|
||||
case CMD_OFF:
|
||||
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;
|
||||
|
||||
} //switch cmd
|
||||
|
||||
@@ -121,7 +121,7 @@ CRGB pixel;
|
||||
int Value = map(st->v, 0, 100, 0, 255);
|
||||
|
||||
#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);
|
||||
#else
|
||||
int Hue = map(st->h, 0, 365, 0, 255);
|
||||
@@ -287,7 +287,7 @@ case S_CMD:
|
||||
PixelCtrl(&st,CMD_ON,from,to);
|
||||
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);
|
||||
|
||||
if (st.aslong ) //Stored smthng
|
||||
|
||||
Reference in New Issue
Block a user