Merge pull request #2 from hyperion-project/master

pull
This commit is contained in:
b1rdhous3 2019-02-10 01:05:26 +01:00 committed by GitHub
commit 03a701822f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 59 additions and 20 deletions

View File

@ -294,7 +294,8 @@
"wiz_cc_btn_stop": "Stopnout video", "wiz_cc_btn_stop": "Stopnout video",
"wiz_cc_summary": "Závěr nastavení. Během přehrávání videa můžete znovu měnit nebo otestovat hodnoty. Pokud jste hotovi, klikněte na tlačítko Uložit.", "wiz_cc_summary": "Závěr nastavení. Během přehrávání videa můžete znovu měnit nebo otestovat hodnoty. Pokud jste hotovi, klikněte na tlačítko Uložit.",
"edt_dev_enum_subtract_minimum": "Odčtěte minimum", "edt_dev_enum_subtract_minimum": "Odčtěte minimum",
"edt_dev_enum_sub_min_warm_adjust": "Teplota barvy", "edt_dev_enum_sub_min_cool_adjust": "Teplota barvy: cool",
"edt_dev_enum_sub_min_warm_adjust": "Teplota barvy: warm",
"edt_dev_enum_white_off": "Bílá vypnutá", "edt_dev_enum_white_off": "Bílá vypnutá",
"edt_dev_general_heading_title": "Obecné nastavení", "edt_dev_general_heading_title": "Obecné nastavení",
"edt_dev_general_name_title": "Název konfigurace", "edt_dev_general_name_title": "Název konfigurace",

View File

@ -348,6 +348,7 @@
"wiz_cc_summary" : "Im folgenden eine Zusammenfassung deiner Einstellungen. Während du ein Video abspielst, kannst du hier weiter ausprobieren. Wenn du fertig bist, klicke auf speichern.", "wiz_cc_summary" : "Im folgenden eine Zusammenfassung deiner Einstellungen. Während du ein Video abspielst, kannst du hier weiter ausprobieren. Wenn du fertig bist, klicke auf speichern.",
"edt_dev_auth_key_title" : "Aurora API Schlüssel", "edt_dev_auth_key_title" : "Aurora API Schlüssel",
"edt_dev_enum_subtract_minimum" : "Subtrahiere minimum", "edt_dev_enum_subtract_minimum" : "Subtrahiere minimum",
"edt_dev_enum_sub_min_cool_adjust" : "Minimale Anpassung: cool",
"edt_dev_enum_sub_min_warm_adjust" : "Minimale Anpassung: warm", "edt_dev_enum_sub_min_warm_adjust" : "Minimale Anpassung: warm",
"edt_dev_enum_white_off" : "Weiß ist aus", "edt_dev_enum_white_off" : "Weiß ist aus",
"edt_dev_general_heading_title" : "Allgemeine Einstellungen", "edt_dev_general_heading_title" : "Allgemeine Einstellungen",

View File

@ -348,7 +348,8 @@
"wiz_cc_summary" : "A conclusion of your settings. During video playback, you could change or test values again. If you are done, click on save.", "wiz_cc_summary" : "A conclusion of your settings. During video playback, you could change or test values again. If you are done, click on save.",
"edt_dev_auth_key_title" : "Aurora API Key", "edt_dev_auth_key_title" : "Aurora API Key",
"edt_dev_enum_subtract_minimum" : "Substract minimum", "edt_dev_enum_subtract_minimum" : "Substract minimum",
"edt_dev_enum_sub_min_warm_adjust" : "Min warm adjust", "edt_dev_enum_sub_min_cool_adjust" : "Subtract cool white",
"edt_dev_enum_sub_min_warm_adjust" : "Subtract warm white",
"edt_dev_enum_white_off" : "White off", "edt_dev_enum_white_off" : "White off",
"edt_dev_general_heading_title" : "General Settings", "edt_dev_general_heading_title" : "General Settings",
"edt_dev_general_name_title" : "Configuration name", "edt_dev_general_name_title" : "Configuration name",

View File

@ -294,6 +294,7 @@
"wiz_cc_btn_stop": "Parar vídeo", "wiz_cc_btn_stop": "Parar vídeo",
"wiz_cc_summary": "Una conclusión de su configuración. Durante la reproducción de vídeo, puede cambiar o probar valores de nuevo. Si está hecho, haga clic en guardar.", "wiz_cc_summary": "Una conclusión de su configuración. Durante la reproducción de vídeo, puede cambiar o probar valores de nuevo. Si está hecho, haga clic en guardar.",
"edt_dev_enum_subtract_minimum": "Restar mínimo", "edt_dev_enum_subtract_minimum": "Restar mínimo",
"edt_dev_enum_sub_min_cool_adjust": "Min. Ajuste fresco",
"edt_dev_enum_sub_min_warm_adjust": "Min. Ajuste caliente", "edt_dev_enum_sub_min_warm_adjust": "Min. Ajuste caliente",
"edt_dev_enum_white_off": "Blanco apagado", "edt_dev_enum_white_off": "Blanco apagado",
"edt_dev_general_heading_title": "Configuración general", "edt_dev_general_heading_title": "Configuración general",
@ -753,4 +754,4 @@
"edt_conf_enum_SECAM": "SECAM", "edt_conf_enum_SECAM": "SECAM",
"general_speech_it": "Italiano", "general_speech_it": "Italiano",
"general_speech_cs": "Czech" "general_speech_cs": "Czech"
} }

View File

@ -294,6 +294,7 @@
"wiz_cc_btn_stop": "Interrompi video", "wiz_cc_btn_stop": "Interrompi video",
"wiz_cc_summary": "Conclusione delle tue impostazioni. Durante la riproduzione video puoi cambiare nuovamente i valori. Se hai finito clicca su salva.", "wiz_cc_summary": "Conclusione delle tue impostazioni. Durante la riproduzione video puoi cambiare nuovamente i valori. Se hai finito clicca su salva.",
"edt_dev_enum_subtract_minimum": "Sottrai minimo", "edt_dev_enum_subtract_minimum": "Sottrai minimo",
"edt_dev_enum_sub_min_cool_adjust": "Regolazione freddo min",
"edt_dev_enum_sub_min_warm_adjust": "Regolazione calore min", "edt_dev_enum_sub_min_warm_adjust": "Regolazione calore min",
"edt_dev_enum_white_off": "Bianco off", "edt_dev_enum_white_off": "Bianco off",
"edt_dev_general_heading_title": "Impostazioni Generali", "edt_dev_general_heading_title": "Impostazioni Generali",

View File

@ -6,7 +6,13 @@
namespace RGBW { 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); WhiteAlgorithm stringToWhiteAlgorithm(QString str);
void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm); void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algorithm);

View File

@ -36,9 +36,10 @@ CiColor CiColor::rgbToCiColor(float red, float green, float blue, CiColorTriangl
{ {
cy = 0.0f; cy = 0.0f;
} }
// Brightness is simply Y in the XYZ space. // RGB to HSV/B Conversion after gamma correction use V for brightness, not Y from XYZ Space.
float bri = fmax(fmax(r, g), b);
CiColor xy = CiColor xy =
{ cx, cy, Y }; { cx, cy, bri };
// Check if the given XY value is within the color reach of our lamps. // Check if the given XY value is within the color reach of our lamps.
if (!isPointInLampsReach(xy, colorSpace)) if (!isPointInLampsReach(xy, colorSpace))
{ {
@ -212,7 +213,7 @@ const std::set<QString> PhilipsHueLight::GAMUT_A_MODEL_IDS =
const std::set<QString> PhilipsHueLight::GAMUT_B_MODEL_IDS = const std::set<QString> PhilipsHueLight::GAMUT_B_MODEL_IDS =
{ "LCT001", "LCT002", "LCT003", "LCT007", "LLM001" }; { "LCT001", "LCT002", "LCT003", "LCT007", "LLM001" };
const std::set<QString> PhilipsHueLight::GAMUT_C_MODEL_IDS = const std::set<QString> PhilipsHueLight::GAMUT_C_MODEL_IDS =
{ "LLC020", "LST002", "LCT011", "LCT012", "LCT010", "LCT014" }; { "LLC020", "LST002", "LCT011", "LCT012", "LCT010", "LCT014", "LCT015", "LCT016", "LCT024" };
PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned int id, QJsonObject values) PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned int id, QJsonObject values)
: log(log) : log(log)
@ -249,7 +250,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
{ {
Debug(log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id); Debug(log, "Recognized model id %s of light ID %d as gamut A", modelId.toStdString().c_str(), id);
colorSpace.red = colorSpace.red =
{ 0.703f, 0.296f}; { 0.704f, 0.296f};
colorSpace.green = colorSpace.green =
{ 0.2151f, 0.7106f}; { 0.2151f, 0.7106f};
colorSpace.blue = colorSpace.blue =
@ -261,7 +262,7 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
colorSpace.red = colorSpace.red =
{ 0.675f, 0.322f}; { 0.675f, 0.322f};
colorSpace.green = colorSpace.green =
{ 0.4091f, 0.518f}; { 0.409f, 0.518f};
colorSpace.blue = colorSpace.blue =
{ 0.167f, 0.04f}; { 0.167f, 0.04f};
} }
@ -269,11 +270,11 @@ PhilipsHueLight::PhilipsHueLight(Logger* log, PhilipsHueBridge* bridge, unsigned
{ {
Debug(log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id); Debug(log, "Recognized model id %s of light ID %d as gamut C", modelId.toStdString().c_str(), id);
colorSpace.red = colorSpace.red =
{ 0.675f, 0.322f}; { 0.6915f, 0.3083f};
colorSpace.green = colorSpace.green =
{ 0.2151f, 0.7106f}; { 0.17f, 0.7f};
colorSpace.blue = colorSpace.blue =
{ 0.167f, 0.04f}; { 0.1532f, 0.0475f};
} }
else else
{ {

View File

@ -20,9 +20,10 @@ bool LedDeviceWS281x::init(const QJsonObject &deviceConfig)
{ {
LedDevice::init(deviceConfig); LedDevice::init(deviceConfig);
QString whiteAlgorithm = deviceConfig["white_algorithm"].toString("white_off"); QString whiteAlgorithm = deviceConfig["whiteAlgorithm"].toString("white_off");
_whiteAlgorithm = RGBW::stringToWhiteAlgorithm(whiteAlgorithm); _whiteAlgorithm = RGBW::stringToWhiteAlgorithm(whiteAlgorithm);
Debug( _log, "whiteAlgorithm : %s", QSTRING_CSTR(whiteAlgorithm)); Debug( _log, "whiteAlgorithm : %s", QSTRING_CSTR(whiteAlgorithm));
Debug( _log, "rgbw : %d", deviceConfig["rgbw"].toBool(false) );
if (_whiteAlgorithm == RGBW::INVALID) if (_whiteAlgorithm == RGBW::INVALID)
{ {
Error(_log, "unknown whiteAlgorithm %s", QSTRING_CSTR(whiteAlgorithm)); Error(_log, "unknown whiteAlgorithm %s", QSTRING_CSTR(whiteAlgorithm));
@ -40,7 +41,7 @@ bool LedDeviceWS281x::init(const QJsonObject &deviceConfig)
_led_string.channel[_channel].gpionum = deviceConfig["gpio"].toInt(18); _led_string.channel[_channel].gpionum = deviceConfig["gpio"].toInt(18);
_led_string.channel[_channel].count = deviceConfig["leds"].toInt(256); _led_string.channel[_channel].count = deviceConfig["leds"].toInt(256);
_led_string.channel[_channel].invert = deviceConfig["invert"].toInt(0); _led_string.channel[_channel].invert = deviceConfig["invert"].toInt(0);
_led_string.channel[_channel].strip_type = ((deviceConfig["rgbw"].toInt(0) == 1) ? SK6812_STRIP_GRBW : WS2811_STRIP_RGB); _led_string.channel[_channel].strip_type = (deviceConfig["rgbw"].toBool(false) ? SK6812_STRIP_GRBW : WS2811_STRIP_RGB);
_led_string.channel[_channel].brightness = 255; _led_string.channel[_channel].brightness = 255;
_led_string.channel[!_channel].gpionum = 0; _led_string.channel[!_channel].gpionum = 0;
@ -49,6 +50,7 @@ bool LedDeviceWS281x::init(const QJsonObject &deviceConfig)
_led_string.channel[!_channel].brightness = 0; _led_string.channel[!_channel].brightness = 0;
_led_string.channel[!_channel].strip_type = WS2811_STRIP_RGB; _led_string.channel[!_channel].strip_type = WS2811_STRIP_RGB;
Debug( _log, "ws281x strip type : %d", _led_string.channel[_channel].strip_type );
if (ws2811_init(&_led_string) < 0) if (ws2811_init(&_led_string) < 0)
{ {

View File

@ -21,7 +21,7 @@ LedDevice* LedDeviceSk6812SPI::construct(const QJsonObject &deviceConfig)
bool LedDeviceSk6812SPI::init(const QJsonObject &deviceConfig) bool LedDeviceSk6812SPI::init(const QJsonObject &deviceConfig)
{ {
QString whiteAlgorithm = deviceConfig["white_algorithm"].toString("white_off"); QString whiteAlgorithm = deviceConfig["whiteAlgorithm"].toString("white_off");
_whiteAlgorithm = RGBW::stringToWhiteAlgorithm(whiteAlgorithm); _whiteAlgorithm = RGBW::stringToWhiteAlgorithm(whiteAlgorithm);
if (_whiteAlgorithm == RGBW::INVALID) if (_whiteAlgorithm == RGBW::INVALID)

View File

@ -23,10 +23,10 @@
"whiteAlgorithm": { "whiteAlgorithm": {
"type": "string", "type": "string",
"title":"edt_dev_spec_whiteLedAlgor_title", "title":"edt_dev_spec_whiteLedAlgor_title",
"enum" : ["subtract_minimum","sub_min_warm_adjust","white_off"], "enum" : ["subtract_minimum","sub_min_cool_adjust","sub_min_warm_adjust","white_off"],
"default": "subtract_minimum", "default": "subtract_minimum",
"options" : { "options" : {
"enum_titles" : ["edt_dev_enum_subtract_minimum", "edt_dev_enum_sub_min_warm_adjust", "edt_dev_enum_white_off"] "enum_titles" : ["edt_dev_enum_subtract_minimum", "edt_dev_enum_sub_min_cool_adjust","edt_dev_enum_sub_min_warm_adjust", "edt_dev_enum_white_off"]
}, },
"propertyOrder" : 4 "propertyOrder" : 4
}, },

View File

@ -35,10 +35,10 @@
"whiteAlgorithm": { "whiteAlgorithm": {
"type": "string", "type": "string",
"title":"edt_dev_spec_whiteLedAlgor_title", "title":"edt_dev_spec_whiteLedAlgor_title",
"enum" : ["subtract_minimum","sub_min_warm_adjust","white_off"], "enum" : ["subtract_minimum","sub_min_cool_adjust","sub_min_warm_adjust","white_off"],
"default": "subtract_minimum", "default": "subtract_minimum",
"options" : { "options" : {
"enum_titles" : ["edt_dev_enum_subtract_minimum", "edt_dev_enum_sub_min_warm_adjust", "edt_dev_enum_white_off"] "enum_titles" : ["edt_dev_enum_subtract_minimum", "edt_dev_enum_sub_min_cool_adjust","edt_dev_enum_sub_min_warm_adjust", "edt_dev_enum_white_off"]
}, },
"propertyOrder" : 6 "propertyOrder" : 6
}, },

View File

@ -9,6 +9,7 @@ WhiteAlgorithm stringToWhiteAlgorithm(QString str)
{ {
if (str == "subtract_minimum") return SUBTRACT_MINIMUM; if (str == "subtract_minimum") return SUBTRACT_MINIMUM;
if (str == "sub_min_warm_adjust") return SUB_MIN_WARM_ADJUST; 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; if (str.isEmpty() || str == "white_off") return WHITE_OFF;
return INVALID; return INVALID;
} }
@ -28,7 +29,31 @@ void Rgb_to_Rgbw(ColorRgb input, ColorRgbw * output, const WhiteAlgorithm algori
case SUB_MIN_WARM_ADJUST: 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; break;
} }