mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Reapply temperature on JSONAPI
This commit is contained in:
parent
2f128e766f
commit
07dfce68f6
@ -281,6 +281,7 @@ private:
|
||||
void applyColorAdjustments(const QJsonObject &adjustment, ColorAdjustment *colorAdjustment);
|
||||
void applyColorAdjustment(const QString &colorName, const QJsonObject &adjustment, RgbChannelAdjustment &rgbAdjustment);
|
||||
void applyGammaTransform(const QString &transformName, const QJsonObject &adjustment, RgbTransform &rgbTransform, char channel);
|
||||
void applyTemperatureAdjustment(const QJsonObject &adjustment, ColorCorrection *colorCorrection);
|
||||
|
||||
void applyTransforms(const QJsonObject &adjustment, ColorAdjustment *colorAdjustment);
|
||||
template<typename T>
|
||||
|
@ -598,8 +598,16 @@ void JsonAPI::handleAdjustmentCommand(const QJsonObject &message, const JsonApiC
|
||||
return;
|
||||
}
|
||||
|
||||
ColorCorrection *temperatureColorCorrection = _hyperion->getTemperature(adjustmentId);
|
||||
if (temperatureColorCorrection == nullptr) {
|
||||
Warning(_log, "Incorrect temperature adjustment identifier: %s", adjustmentId.toStdString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
applyColorAdjustments(adjustment, colorAdjustment);
|
||||
applyTransforms(adjustment, colorAdjustment);
|
||||
applyTemperatureAdjustment(adjustment, temperatureColorCorrection);
|
||||
_hyperion->adjustmentsUpdated();
|
||||
sendSuccessReply(cmd);
|
||||
}
|
||||
@ -673,6 +681,19 @@ void JsonAPI::applyTransform(const QString &transformName, const QJsonObject &ad
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::applyTemperatureAdjustment(const QJsonObject &adjustment, ColorCorrection *colorCorrection)
|
||||
{
|
||||
if (adjustment.contains("temperature"))
|
||||
{
|
||||
int temperature = adjustment["temperature"].toInt(6500);
|
||||
ColorRgb rgb = getRgbFromTemperature(temperature);
|
||||
|
||||
colorCorrection->_rgbCorrection.setcorrectionR(rgb.red);
|
||||
colorCorrection->_rgbCorrection.setcorrectionG(rgb.green);
|
||||
colorCorrection->_rgbCorrection.setcorrectionB(rgb.blue);
|
||||
}
|
||||
}
|
||||
|
||||
void JsonAPI::handleSourceSelectCommand(const QJsonObject &message, const JsonApiCommand& cmd)
|
||||
{
|
||||
if (message.contains("auto"))
|
||||
|
@ -83,6 +83,16 @@ QJsonArray JsonInfo::getAdjustmentInfo(const Hyperion* hyperion, Logger* log)
|
||||
adjustment["saturationGain"] = colorAdjustment->_okhsvTransform.getSaturationGain();
|
||||
adjustment["brightnessGain"] = colorAdjustment->_okhsvTransform.getBrightnessGain();
|
||||
|
||||
|
||||
ColorCorrection *temperatureColorCorrection = hyperion->getTemperature(adjustmentId);
|
||||
if (temperatureColorCorrection == nullptr) {
|
||||
Error(log, "Incorrect temperature adjustment id: %s", QSTRING_CSTR(adjustmentId));
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: Return current Temperature in Kelvin
|
||||
adjustment["temperature"] = 6600;
|
||||
|
||||
adjustmentArray.append(adjustment);
|
||||
}
|
||||
return adjustmentArray;
|
||||
|
Loading…
x
Reference in New Issue
Block a user