|
|
|
@ -215,61 +215,5 @@ void LEDControl_::type_letter(uint8_t letter) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* SetHSV from light_ws2812. Their source was:
|
|
|
|
|
* getRGB() function based on <http://www.codeproject.com/miscctrl/CPicker.asp>
|
|
|
|
|
* dim_curve idea by Jims
|
|
|
|
|
* */
|
|
|
|
|
void LEDControl_::SetHSV(cRGB *crgb, int hue, byte sat, byte val) {
|
|
|
|
|
/* convert hue, saturation and brightness ( HSB/HSV ) to RGB
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int base;
|
|
|
|
|
|
|
|
|
|
if (sat == 0) { // Acromatic color (gray). Hue doesn't mind.
|
|
|
|
|
crgb->r = val;
|
|
|
|
|
crgb->g = val;
|
|
|
|
|
crgb->b = val;
|
|
|
|
|
} else {
|
|
|
|
|
base = ((255 - sat) * val) >> 8;
|
|
|
|
|
|
|
|
|
|
switch (hue / 60) {
|
|
|
|
|
case 0:
|
|
|
|
|
crgb->r = val;
|
|
|
|
|
crgb->g = (((val - base)*hue) / 60) + base;
|
|
|
|
|
crgb->b = base;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
crgb->r = (((val - base)*(60 - (hue % 60))) / 60) + base;
|
|
|
|
|
crgb->g = val;
|
|
|
|
|
crgb->b = base;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
crgb->r = base;
|
|
|
|
|
crgb->g = val;
|
|
|
|
|
crgb->b = (((val - base)*(hue % 60)) / 60) + base;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
|
crgb->r = base;
|
|
|
|
|
crgb->g = (((val - base)*(60 - (hue % 60))) / 60) + base;
|
|
|
|
|
crgb->b = val;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 4:
|
|
|
|
|
crgb->r = (((val - base)*(hue % 60)) / 60) + base;
|
|
|
|
|
crgb->g = base;
|
|
|
|
|
crgb->b = val;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
|
crgb->r = val;
|
|
|
|
|
crgb->g = base;
|
|
|
|
|
crgb->b = (((val - base)*(60 - (hue % 60))) / 60) + base;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LEDControl_ LEDControl;
|
|
|
|
|