mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Add Temperature adjustment
This commit is contained in:
@@ -146,6 +146,13 @@
|
||||
"required" : false,
|
||||
"minimum" : 0.1,
|
||||
"maximum": 10.0
|
||||
},
|
||||
"temperature" :
|
||||
{
|
||||
"type" : "integer",
|
||||
"required" : false,
|
||||
"minimum" : 1000,
|
||||
"maximum": 40000
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user