mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Implemented warm white (and added cool white) RGBW white algorithms
This commit is contained in:
parent
b77e7c4acd
commit
bceb255b7a
@ -6,7 +6,13 @@
|
||||
|
||||
namespace RGBW {
|
||||
|
||||
enum WhiteAlgorithm { INVALID, SUBTRACT_MINIMUM, SUB_MIN_WARM_ADJUST, WHITE_OFF };
|
||||
enum WhiteAlgorithm {
|
||||
INVALID,
|
||||
SUBTRACT_MINIMUM,
|
||||
SUB_MIN_WARM_ADJUST,
|
||||
SUB_MIN_COOL_ADJUST,
|
||||
WHITE_OFF
|
||||
};
|
||||
|
||||
WhiteAlgorithm stringToWhiteAlgorithm(QString str);
|
||||
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm);
|
||||
|
@ -9,6 +9,7 @@ WhiteAlgorithm stringToWhiteAlgorithm(QString str)
|
||||
{
|
||||
if (str == "subtract_minimum") return SUBTRACT_MINIMUM;
|
||||
if (str == "sub_min_warm_adjust") return SUB_MIN_WARM_ADJUST;
|
||||
if (str == "sub_min_cool_adjust") return SUB_MIN_COOL_ADJUST;
|
||||
if (str.isEmpty() || str == "white_off") return WHITE_OFF;
|
||||
return INVALID;
|
||||
}
|
||||
@ -28,7 +29,31 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
|
||||
|
||||
case SUB_MIN_WARM_ADJUST:
|
||||
{
|
||||
Error(Logger::getInstance("RGBtoRGBW"), "white algorithm 'sub_min_warm_adjust' is not implemented yet." );
|
||||
// http://forum.garagecube.com/viewtopic.php?t=10178
|
||||
// warm white
|
||||
float F1 = 0.274;
|
||||
float F2 = 0.454;
|
||||
float F3 = 2.333;
|
||||
|
||||
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
||||
output->red = input.red - output->white/F1;
|
||||
output->green = input.green - output->white/F2;
|
||||
output->blue = input.blue - output->white/F3;
|
||||
break;
|
||||
}
|
||||
|
||||
case SUB_MIN_COOL_ADJUST:
|
||||
{
|
||||
// http://forum.garagecube.com/viewtopic.php?t=10178
|
||||
// cold white
|
||||
float F1 = 0.299;
|
||||
float F2 = 0.587;
|
||||
float F3 = 0.114;
|
||||
|
||||
output->white = qMin(input.red*F1,qMin(input.green*F2,input.blue*F3));
|
||||
output->red = input.red - output->white/F1;
|
||||
output->green = input.green - output->white/F2;
|
||||
output->blue = input.blue - output->white/F3;
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user