fix/refactor backlight stuff (#394)

* fix/refactor backlight stuff:
- fix colors dont turn of when backlight 0 and black is set
- add option to use not colored backlight
- fix colored backlight not colored on very low color values
- various code style tunings

* apply needed change to wizard

* backlight disabled on static color and efects

* fix warnings

* try fix udp compiler warnings
This commit is contained in:
redPanther
2017-02-11 22:52:47 +01:00
committed by GitHub
parent 199d266bc0
commit e1165e112f
33 changed files with 364 additions and 240 deletions

View File

@@ -158,13 +158,14 @@ MultiColorAdjustment * Hyperion::createLedColorsAdjustment(const unsigned ledCnt
RgbTransform* Hyperion::createRgbTransform(const QJsonObject& colorConfig)
{
const double brightnessMin = colorConfig["brightnessMin"].toDouble(0.0);
const double backlightThreshold = colorConfig["backlightThreshold"].toDouble(0.0);
const bool backlightColored = colorConfig["backlightColored"].toBool(false);
const double brightness = colorConfig["brightness"].toDouble(0.5);
const double gammaR = colorConfig["gammaRed"].toDouble(1.0);
const double gammaG = colorConfig["gammaGreen"].toDouble(1.0);
const double gammaB = colorConfig["gammaBlue"].toDouble(1.0);
RgbTransform* transform = new RgbTransform(gammaR, gammaG, gammaB, brightnessMin, brightness);
RgbTransform* transform = new RgbTransform(gammaR, gammaG, gammaB, backlightThreshold, backlightColored, brightness);
return transform;
}
@@ -392,10 +393,10 @@ Hyperion::Hyperion(const QJsonObject &qjsonConfig, const QString configFile)
, _timer()
, _log(CORE_LOGGER)
, _hwLedCount(_ledString.leds().size())
, _sourceAutoSelectEnabled(true)
, _configHash()
, _ledGridSize(getLedLayoutGridSize(qjsonConfig["leds"]))
, _prevCompId(hyperion::COMP_INVALID)
{
registerPriority("Off", PriorityMuxer::LOWEST_PRIORITY);
@@ -718,6 +719,12 @@ void Hyperion::update()
if ( priority < PriorityMuxer::LOWEST_PRIORITY)
{
if (priorityInfo.componentId != _prevCompId)
{
bool backlightEnabled = (priorityInfo.componentId != hyperion::COMP_COLOR && priorityInfo.componentId != hyperion::COMP_EFFECT);
_raw2ledAdjustment->setBacklightEnabled(backlightEnabled);
_prevCompId = priorityInfo.componentId;
}
_raw2ledAdjustment->applyAdjustment(_ledBuffer);
}