From a428fdfb6ef4039b562cef4270fd5f792ee42c27 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 3 Dec 2018 14:53:03 +0100 Subject: [PATCH 1/2] set white value to zero when setting rgb color --- elgato/aveabulb.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/elgato/aveabulb.cpp b/elgato/aveabulb.cpp index 1ab4bd16..a39bba7b 100644 --- a/elgato/aveabulb.cpp +++ b/elgato/aveabulb.cpp @@ -106,6 +106,7 @@ bool AveaBulb::setColor(const QColor &color) m_red = scaleColorValueUp(color.red()); m_green = scaleColorValueUp(color.green()); m_blue = scaleColorValueUp(color.blue()); + m_white = 0; m_color = color; From f4dd8b838ed1a6f75943c9923148cb2ce0880c83 Mon Sep 17 00:00:00 2001 From: Michael Zanetti Date: Mon, 3 Dec 2018 19:48:21 +0100 Subject: [PATCH 2/2] don't hardcode white to 0 but instead encode it in the QColor alpha channel --- elgato/aveabulb.cpp | 2 +- elgato/devicepluginelgato.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/elgato/aveabulb.cpp b/elgato/aveabulb.cpp index a39bba7b..ed1b0369 100644 --- a/elgato/aveabulb.cpp +++ b/elgato/aveabulb.cpp @@ -106,7 +106,7 @@ bool AveaBulb::setColor(const QColor &color) m_red = scaleColorValueUp(color.red()); m_green = scaleColorValueUp(color.green()); m_blue = scaleColorValueUp(color.blue()); - m_white = 0; + m_white = scaleColorValueUp(color.alpha()); m_color = color; diff --git a/elgato/devicepluginelgato.cpp b/elgato/devicepluginelgato.cpp index 559a0903..cdbaf2f6 100644 --- a/elgato/devicepluginelgato.cpp +++ b/elgato/devicepluginelgato.cpp @@ -493,6 +493,7 @@ DeviceManager::DeviceError DevicePluginElgato::executeAction(Device *device, con return DeviceManager::DeviceErrorNoError; } else if (action.actionTypeId() == aveaColorActionTypeId) { QColor color = action.param(aveaColorActionColorParamTypeId).value().value(); + color.setAlpha(0); // Alpha is white if (!bulb->setColor(color)) return DeviceManager::DeviceErrorHardwareNotAvailable; @@ -513,7 +514,8 @@ DeviceManager::DeviceError DevicePluginElgato::executeAction(Device *device, con color.setRed(red); color.setGreen(0); color.setBlue(blue); - if (!bulb->setWhite(4095) || !bulb->setColor(color)) { + color.setAlpha(255); // Alpha is white + if (!bulb->setColor(color)) { return DeviceManager::DeviceErrorHardwareNotAvailable; } device->setStateValue(aveaColorStateTypeId, color);