color filter config additions (#142)

* add ability to disably specific color corrections
update protobuf external
move smoothing out of color section

* update config

* update schema

* update schema
This commit is contained in:
redPanther
2016-07-30 13:07:53 +02:00
committed by GitHub
parent f1a4672a93
commit 04ab2f05f7
6 changed files with 111 additions and 85 deletions

View File

@@ -501,7 +501,7 @@ LedDevice * Hyperion::createColorSmoothing(const Json::Value & smoothingConfig,
smoothingConfig.get("updateFrequency", 25.0).asDouble(),
smoothingConfig.get("time_ms", 200).asInt(),
smoothingConfig.get("updateDelay", 0).asUInt(),
smoothingConfig.get("continuousOutput", false).asBool()
smoothingConfig.get("continuousOutput", true).asBool()
);
}
@@ -568,6 +568,15 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile)
{
throw std::runtime_error("Color transformation incorrectly set");
}
// set color correction activity state
_transformEnabled = jsonConfig["color"].get("transform_enable",true).asBool();
_adjustmentEnabled = jsonConfig["color"].get("channelAdjustment_enable",true).asBool();
_temperatureEnabled = jsonConfig["color"].get("temperature_enable",true).asBool();
InfoIf(!_transformEnabled , _log, "Color transformation disabled" );
InfoIf(!_adjustmentEnabled , _log, "Color adjustment disabled" );
InfoIf(!_temperatureEnabled, _log, "Color temperature disabled" );
// initialize the image processor factory
ImageProcessorFactory::getInstance().init(
_ledString,
@@ -575,7 +584,8 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile)
);
// initialize the color smoothing filter
_device = createColorSmoothing(jsonConfig["color"]["smoothing"], _device);
_device = createColorSmoothing(jsonConfig["smoothing"], _device);
// setup the timer
_timer.setSingleShot(true);
@@ -796,9 +806,9 @@ void Hyperion::update()
// Apply the correction and the transform to each led and color-channel
// Avoid applying correction, the same task is performed by adjustment
_raw2ledTransform->applyTransform(_ledBuffer);
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
_raw2ledTemperature->applyCorrection(_ledBuffer);
if (_transformEnabled) _raw2ledTransform->applyTransform(_ledBuffer);
if (_adjustmentEnabled) _raw2ledAdjustment->applyAdjustment(_ledBuffer);
if (_temperatureEnabled) _raw2ledTemperature->applyCorrection(_ledBuffer);
const std::vector<Led>& leds = _ledString.leds();

View File

@@ -58,6 +58,7 @@
"required" : true,
"properties":
{
"channelAdjustment_enable" : "boolean",
"channelAdjustment" :
{
"type" : "array",
@@ -172,6 +173,7 @@
"additionalProperties" : false
}
},
"temperature_enable" : "boolean",
"temperature" :
{
"type" : "array",
@@ -226,6 +228,7 @@
"additionalProperties" : false
}
},
"transform_enable" : "boolean",
"transform" :
{
"type" : "array",
@@ -345,51 +348,51 @@
},
"additionalProperties" : false
}
}
},
"additionalProperties" : false
},
"smoothing":
{
"type" : "object",
"required" : true,
"properties" :
{
"enable" :
{
"type" : "boolean",
"required" : true
},
"smoothing":
{
"type" : "object",
"required" : true,
"properties" :
{
"enable" :
{
"type" : "boolean",
"required" : true
},
"type" :
{
"enum" : ["none", "linear"],
"required" : true
},
"time_ms" :
{
"type" : "integer",
"required" : false,
"minimum" : 25,
"maximum": 600
},
"updateFrequency" :
{
"type" : "number",
"required" : false,
"minimum" : 1.000,
"maximum": 100.000
},
"updateDelay" :
{
"type" : "integer",
"required" : false,
"minimum" : 0,
"maximum": 2048
},
"continuousOutput" :
{
"type" : "boolean",
"required" : false
}
},
"additionalProperties" : false
"type" :
{
"enum" : ["none", "linear"],
"required" : true
},
"time_ms" :
{
"type" : "integer",
"required" : false,
"minimum" : 25,
"maximum": 600
},
"updateFrequency" :
{
"type" : "number",
"required" : false,
"minimum" : 1.000,
"maximum": 100.000
},
"updateDelay" :
{
"type" : "integer",
"required" : false,
"minimum" : 0,
"maximum": 2048
},
"continuousOutput" :
{
"type" : "boolean",
"required" : false
}
},
"additionalProperties" : false