Add Temperature adjustment

This commit is contained in:
LordGrey
2022-12-22 20:10:44 +01:00
parent 1189f86c1a
commit 30b1a1b25f
18 changed files with 666 additions and 12 deletions

View File

@@ -146,6 +146,13 @@
"required" : false,
"minimum" : 0.1,
"maximum": 10.0
},
"temperature" :
{
"type" : "integer",
"required" : false,
"minimum" : 1000,
"maximum": 40000
}
},
"additionalProperties": false

View File

@@ -60,6 +60,7 @@
#include <HyperionConfig.h>
#include <utils/SysInfo.h>
#include <utils/ColorSys.h>
#include <utils/KelvinToRgb.h>
#include <utils/Process.h>
#include <utils/JsonUtils.h>
@@ -519,6 +520,8 @@ void JsonAPI::handleServerInfoCommand(const QJsonObject &message, const QString
adjustment["saturationGain"] = colorAdjustment->_okhsvTransform.getSaturationGain();
adjustment["brightnessGain"] = colorAdjustment->_okhsvTransform.getBrightnessGain();
adjustment["temperature"] = 6600;
adjustmentArray.append(adjustment);
}
@@ -936,6 +939,17 @@ void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const QString
if (adjustment.contains("brightnessGain"))
{
colorAdjustment->_okhsvTransform.setBrightnessGain(adjustment["brightnessGain"].toDouble());
}
if (adjustment.contains("temperature"))
{
int temperature = adjustment["temperature"].toInt(6500);
ColorRgb rgb = getRgbFromTemperature(temperature);
ColorCorrection *colorCorrection = _hyperion->getTemperature(adjustmentId);
colorCorrection->_rgbCorrection.setcorrectionR(rgb.red);
colorCorrection->_rgbCorrection.setcorrectionG(rgb.green);
colorCorrection->_rgbCorrection.setcorrectionB(rgb.blue);
}
// commit the changes