make blackboder component enable/disable at runtime (#228)

* make enable/disable of bborder work

* fix typo

* smoothing can be disabled via config again

* fix smoothing
This commit is contained in:
redPanther
2016-09-08 16:32:42 +02:00
committed by GitHub
parent f23178c770
commit 36124c9afb
11 changed files with 95 additions and 70 deletions

View File

@@ -62,7 +62,11 @@ namespace hyperion
BlackBorder imageBorder;
if (!enabled())
{
return false;
imageBorder.horizontalSize = 0;
imageBorder.verticalSize = 0;
imageBorder.unknown=true;
_currentBorder = imageBorder;
return true;
}
if (_detectionMode == "default") {

View File

@@ -32,6 +32,7 @@
// Forward class declaration
class LedDevice;
class LinearColorSmoothing;
class ColorTransform;
class EffectEngine;
class HsvTransform;
@@ -287,7 +288,7 @@ public:
static RgbChannelAdjustment * createRgbChannelCorrection(const Json::Value& colorConfig);
static RgbChannelAdjustment * createRgbChannelAdjustment(const Json::Value& colorConfig, const RgbChannel color);
static LedDevice * createColorSmoothing(const Json::Value & smoothingConfig, LedDevice * ledDevice);
static LinearColorSmoothing * createColorSmoothing(const Json::Value & smoothingConfig, LedDevice* leddevice);
static MessageForwarder * createMessageForwarder(const Json::Value & forwarderConfig);
signals:
@@ -339,6 +340,9 @@ private:
/// The actual LedDevice
LedDevice * _device;
/// The smoothing LedDevice
LinearColorSmoothing * _deviceSmooth;
/// Effect engine
EffectEngine * _effectEngine;

View File

@@ -119,6 +119,14 @@ private:
template <typename Pixel_T>
void verifyBorder(const Image<Pixel_T> & image)
{
if (!_borderProcessor->enabled() && ( _imageToLeds->horizontalBorder()!=0 || _imageToLeds->verticalBorder()!=0 ))
{
Debug(Logger::getInstance("BLACKBORDER"), "disabled, reset border");
_borderProcessor->process(image);
delete _imageToLeds;
_imageToLeds = new hyperion::ImageToLedsMap(image.width(), image.height(), 0, 0, _ledString.leds());
}
if(_borderProcessor->enabled() && _borderProcessor->process(image))
{
Debug(Logger::getInstance("BLACKBORDER"), "BORDER SWITCH REQUIRED!!");

View File

@@ -56,6 +56,9 @@ namespace hyperion
///
unsigned height() const;
const unsigned horizontalBorder() const { return _horizontalBorder; };
const unsigned verticalBorder() const { return _verticalBorder; };
///
/// Determines the mean-color for each led using the mapping the image given
/// at construction.
@@ -99,6 +102,11 @@ namespace hyperion
const unsigned _width;
/// The height of the indexed image
const unsigned _height;
const unsigned _horizontalBorder;
const unsigned _verticalBorder;
/// The absolute indices into the image for each led
std::vector<std::vector<unsigned>> mColorsMap;