mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
fix coloradjustment via hyperion remote (#362)
* - fix coloradjustment via hyperion remote - several small cleanups/refactorings * fix color is shown as unknown in json serverinfo * fix active color is not shown when autoselect is reactivated
This commit is contained in:
parent
ef14eb08c9
commit
b2a6366176
@ -86,7 +86,7 @@
|
|||||||
"gammaGreen" : 1.0,
|
"gammaGreen" : 1.0,
|
||||||
"gammaBlue" : 1.0,
|
"gammaBlue" : 1.0,
|
||||||
"brightnessMin" : 0.0,
|
"brightnessMin" : 0.0,
|
||||||
"brightness" : 0.5
|
"brightness" : 0.75
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
"gammaGreen" : 1.0,
|
"gammaGreen" : 1.0,
|
||||||
"gammaBlue" : 1.0,
|
"gammaBlue" : 1.0,
|
||||||
"brightnessMin" : 0.0,
|
"brightnessMin" : 0.0,
|
||||||
"brightness" : 0.5
|
"brightness" : 0.75
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -270,7 +270,7 @@ public:
|
|||||||
static MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const QJsonObject & colorAdjustmentConfig);
|
static MultiColorAdjustment * createLedColorsAdjustment(const unsigned ledCnt, const QJsonObject & colorAdjustmentConfig);
|
||||||
static ColorAdjustment * createColorAdjustment(const QJsonObject & adjustmentConfig);
|
static ColorAdjustment * createColorAdjustment(const QJsonObject & adjustmentConfig);
|
||||||
static RgbTransform * createRgbTransform(const QJsonObject& colorConfig);
|
static RgbTransform * createRgbTransform(const QJsonObject& colorConfig);
|
||||||
static RgbChannelAdjustment * createRgbChannelAdjustment(const QJsonArray& colorConfig, const RgbChannel color);
|
static RgbChannelAdjustment * createRgbChannelAdjustment(const QJsonObject & colorConfig, const QString channelName, const int defaultR, const int defaultG, const int defaultB);
|
||||||
|
|
||||||
static LinearColorSmoothing * createColorSmoothing(const QJsonObject & smoothingConfig, LedDevice* leddevice);
|
static LinearColorSmoothing * createColorSmoothing(const QJsonObject & smoothingConfig, LedDevice* leddevice);
|
||||||
static MessageForwarder * createMessageForwarder(const QJsonObject & forwarderConfig);
|
static MessageForwarder * createMessageForwarder(const QJsonObject & forwarderConfig);
|
||||||
|
@ -33,8 +33,8 @@ inline const char* componentToString(Components c)
|
|||||||
case COMP_BOBLIGHTSERVER:return "Boblight server";
|
case COMP_BOBLIGHTSERVER:return "Boblight server";
|
||||||
case COMP_GRABBER: return "Framegrabber";
|
case COMP_GRABBER: return "Framegrabber";
|
||||||
case COMP_V4L: return "V4L capture device";
|
case COMP_V4L: return "V4L capture device";
|
||||||
case COMP_COLOR: return "solid color";
|
case COMP_COLOR: return "Solid color";
|
||||||
case COMP_EFFECT: return "effect";
|
case COMP_EFFECT: return "Effect";
|
||||||
default: return "";
|
default: return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public:
|
|||||||
QString levelString;
|
QString levelString;
|
||||||
} T_LOG_MESSAGE;
|
} T_LOG_MESSAGE;
|
||||||
|
|
||||||
static Logger* getInstance(std::string name="", LogLevel minLevel=Logger::INFO);
|
static Logger* getInstance(QString name="", LogLevel minLevel=Logger::INFO);
|
||||||
static void deleteInstance(std::string name="");
|
static void deleteInstance(std::string name="");
|
||||||
static void setLogLevel(LogLevel level,std::string name="");
|
static void setLogLevel(LogLevel level,std::string name="");
|
||||||
static LogLevel getLogLevel(std::string name="");
|
static LogLevel getLogLevel(std::string name="");
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
// STL includes
|
// STL includes
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <QString>
|
||||||
|
#include <utils/Logger.h>
|
||||||
|
|
||||||
/// Correction for a single color byte value
|
/// Correction for a single color byte value
|
||||||
/// All configuration values are unsigned int and assume the color value to be between 0 and 255
|
/// All configuration values are unsigned int and assume the color value to be between 0 and 255
|
||||||
@ -9,13 +11,13 @@ class RgbChannelAdjustment
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// Default constructor
|
/// Default constructor
|
||||||
RgbChannelAdjustment();
|
RgbChannelAdjustment(QString channelName="");
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
/// @param adjustR
|
/// @param adjustR
|
||||||
/// @param adjustG
|
/// @param adjustG
|
||||||
/// @param adjustB
|
/// @param adjustB
|
||||||
RgbChannelAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB);
|
RgbChannelAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB, QString channelName="");
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~RgbChannelAdjustment();
|
~RgbChannelAdjustment();
|
||||||
@ -64,4 +66,10 @@ private:
|
|||||||
|
|
||||||
/// The mapping from input color to output color
|
/// The mapping from input color to output color
|
||||||
uint8_t _mapping[3][256];
|
uint8_t _mapping[3][256];
|
||||||
|
|
||||||
|
/// Name of this channel, usefull for debug messages
|
||||||
|
QString _channelName;
|
||||||
|
|
||||||
|
/// Logger instance
|
||||||
|
Logger * _log;
|
||||||
};
|
};
|
||||||
|
@ -51,7 +51,7 @@ V4L2Grabber::V4L2Grabber(const std::string & device
|
|||||||
, _noSignalCounter(0)
|
, _noSignalCounter(0)
|
||||||
, _streamNotifier(nullptr)
|
, _streamNotifier(nullptr)
|
||||||
, _imageResampler()
|
, _imageResampler()
|
||||||
, _log(Logger::getInstance("V4L2:"+device))
|
, _log(Logger::getInstance("V4L2:"+QString::fromStdString(device)))
|
||||||
, _initialized(false)
|
, _initialized(false)
|
||||||
, _deviceAutoDiscoverEnabled(false)
|
, _deviceAutoDiscoverEnabled(false)
|
||||||
, _noSignalDetected(false)
|
, _noSignalDetected(false)
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
// effect engine includes
|
// effect engine includes
|
||||||
#include <effectengine/EffectEngine.h>
|
#include <effectengine/EffectEngine.h>
|
||||||
|
|
||||||
|
#define CORE_LOGGER Logger::getInstance("Core")
|
||||||
|
|
||||||
Hyperion* Hyperion::_hyperion = nullptr;
|
Hyperion* Hyperion::_hyperion = nullptr;
|
||||||
|
|
||||||
Hyperion* Hyperion::initInstance(const QJsonObject& qjsonConfig, const QString configFile) // REMOVE jsonConfig variable when the conversion from jsonCPP to QtJSON is finished
|
Hyperion* Hyperion::initInstance(const QJsonObject& qjsonConfig, const QString configFile) // REMOVE jsonConfig variable when the conversion from jsonCPP to QtJSON is finished
|
||||||
@ -57,25 +59,15 @@ ColorOrder Hyperion::createColorOrder(const QJsonObject &deviceConfig)
|
|||||||
ColorAdjustment * Hyperion::createColorAdjustment(const QJsonObject & adjustmentConfig)
|
ColorAdjustment * Hyperion::createColorAdjustment(const QJsonObject & adjustmentConfig)
|
||||||
{
|
{
|
||||||
const std::string id = adjustmentConfig["id"].toString("default").toStdString();
|
const std::string id = adjustmentConfig["id"].toString("default").toStdString();
|
||||||
|
|
||||||
// QT5.4 needed
|
RgbChannelAdjustment * blackAdjustment = createRgbChannelAdjustment(adjustmentConfig, "black" , 0, 0, 0);
|
||||||
//~ RgbChannelAdjustment * blackAdjustment = createRgbChannelAdjustment(adjustmentConfig["black"]. toArray(QJsonArray({"0","0","0" })));
|
RgbChannelAdjustment * whiteAdjustment = createRgbChannelAdjustment(adjustmentConfig, "white" , 255,255,255);
|
||||||
//~ RgbChannelAdjustment * whiteAdjustment = createRgbChannelAdjustment(adjustmentConfig["white"]. toArray(QJsonArray({"255","255","255"})));
|
RgbChannelAdjustment * redAdjustment = createRgbChannelAdjustment(adjustmentConfig, "red" , 255, 0, 0);
|
||||||
//~ RgbChannelAdjustment * redAdjustment = createRgbChannelAdjustment(adjustmentConfig["red"]. toArray(QJsonArray({"255","0","0" })));
|
RgbChannelAdjustment * greenAdjustment = createRgbChannelAdjustment(adjustmentConfig, "green" , 0,255, 0);
|
||||||
//~ RgbChannelAdjustment * greenAdjustment = createRgbChannelAdjustment(adjustmentConfig["green"]. toArray(QJsonArray({"0","255","0" })));
|
RgbChannelAdjustment * blueAdjustment = createRgbChannelAdjustment(adjustmentConfig, "blue" , 0, 0,255);
|
||||||
//~ RgbChannelAdjustment * blueAdjustment = createRgbChannelAdjustment(adjustmentConfig["blue"]. toArray(QJsonArray({"0","0","255" })));
|
RgbChannelAdjustment * cyanAdjustment = createRgbChannelAdjustment(adjustmentConfig, "cyan" , 0,255,255);
|
||||||
//~ RgbChannelAdjustment * cyanAdjustment = createRgbChannelAdjustment(adjustmentConfig["cyan"]. toArray(QJsonArray({"0","255","255" })));
|
RgbChannelAdjustment * magentaAdjustment = createRgbChannelAdjustment(adjustmentConfig, "magenta", 255, 0,255);
|
||||||
//~ RgbChannelAdjustment * magentaAdjustment = createRgbChannelAdjustment(adjustmentConfig["magenta"].toArray(QJsonArray({"255","0","255" })));
|
RgbChannelAdjustment * yellowAdjustment = createRgbChannelAdjustment(adjustmentConfig, "yellow" , 255,255, 0);
|
||||||
//~ RgbChannelAdjustment * yellowAdjustment = createRgbChannelAdjustment(adjustmentConfig["yellow"]. toArray(QJsonArray({"255","255","0" })));
|
|
||||||
|
|
||||||
RgbChannelAdjustment * blackAdjustment = createRgbChannelAdjustment(adjustmentConfig["black"].toArray(),BLACK);
|
|
||||||
RgbChannelAdjustment * whiteAdjustment = createRgbChannelAdjustment(adjustmentConfig["white"].toArray(),WHITE);
|
|
||||||
RgbChannelAdjustment * redAdjustment = createRgbChannelAdjustment(adjustmentConfig["red"].toArray(),RED);
|
|
||||||
RgbChannelAdjustment * greenAdjustment = createRgbChannelAdjustment(adjustmentConfig["green"].toArray(),GREEN);
|
|
||||||
RgbChannelAdjustment * blueAdjustment = createRgbChannelAdjustment(adjustmentConfig["blue"].toArray(),BLUE);
|
|
||||||
RgbChannelAdjustment * cyanAdjustment = createRgbChannelAdjustment(adjustmentConfig["cyan"].toArray(),CYAN);
|
|
||||||
RgbChannelAdjustment * magentaAdjustment = createRgbChannelAdjustment(adjustmentConfig["magenta"].toArray(),MAGENTA);
|
|
||||||
RgbChannelAdjustment * yellowAdjustment = createRgbChannelAdjustment(adjustmentConfig["yellow"].toArray(),YELLOW);
|
|
||||||
RgbTransform * rgbTransform = createRgbTransform(adjustmentConfig);
|
RgbTransform * rgbTransform = createRgbTransform(adjustmentConfig);
|
||||||
|
|
||||||
ColorAdjustment * adjustment = new ColorAdjustment();
|
ColorAdjustment * adjustment = new ColorAdjustment();
|
||||||
@ -109,7 +101,6 @@ MultiColorAdjustment * Hyperion::createLedColorsAdjustment(const unsigned ledCnt
|
|||||||
{
|
{
|
||||||
// Create the result, the transforms are added to this
|
// Create the result, the transforms are added to this
|
||||||
MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt);
|
MultiColorAdjustment * adjustment = new MultiColorAdjustment(ledCnt);
|
||||||
Logger * log = Logger::getInstance("Core");
|
|
||||||
|
|
||||||
const QJsonValue adjustmentConfig = colorConfig["channelAdjustment"];
|
const QJsonValue adjustmentConfig = colorConfig["channelAdjustment"];
|
||||||
if (adjustmentConfig.isNull())
|
if (adjustmentConfig.isNull())
|
||||||
@ -141,13 +132,13 @@ MultiColorAdjustment * Hyperion::createLedColorsAdjustment(const unsigned ledCnt
|
|||||||
{
|
{
|
||||||
// Special case for indices '*' => all leds
|
// Special case for indices '*' => all leds
|
||||||
adjustment->setAdjustmentForLed(colorAdjustment->_id, 0, ledCnt-1);
|
adjustment->setAdjustmentForLed(colorAdjustment->_id, 0, ledCnt-1);
|
||||||
Info(log, "ColorAdjustment '%s' => [0; %d]", colorAdjustment->_id.c_str(), ledCnt-1);
|
Info(CORE_LOGGER, "ColorAdjustment '%s' => [0; %d]", colorAdjustment->_id.c_str(), ledCnt-1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!overallExp.exactMatch(ledIndicesStr))
|
if (!overallExp.exactMatch(ledIndicesStr))
|
||||||
{
|
{
|
||||||
Error(log, "Given led indices %d not correct format: %s", i, ledIndicesStr.toStdString().c_str());
|
Error(CORE_LOGGER, "Given led indices %d not correct format: %s", i, ledIndicesStr.toStdString().c_str());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +165,7 @@ MultiColorAdjustment * Hyperion::createLedColorsAdjustment(const unsigned ledCnt
|
|||||||
ss << index;
|
ss << index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Info(log, "ColorAdjustment '%s' => [%s]", colorAdjustment->_id.c_str(), ss.str().c_str());
|
Info(CORE_LOGGER, "ColorAdjustment '%s' => [%s]", colorAdjustment->_id.c_str(), ss.str().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return adjustment;
|
return adjustment;
|
||||||
@ -192,59 +183,14 @@ RgbTransform* Hyperion::createRgbTransform(const QJsonObject& colorConfig)
|
|||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
RgbChannelAdjustment* Hyperion::createRgbChannelAdjustment(const QJsonArray& colorConfig, const RgbChannel color)
|
RgbChannelAdjustment* Hyperion::createRgbChannelAdjustment(const QJsonObject& colorConfig, const QString channelName, const int defaultR, const int defaultG, const int defaultB)
|
||||||
{
|
{
|
||||||
int varR=0, varG=0, varB=0;
|
const QJsonArray& channelConfig = colorConfig[channelName].toArray();
|
||||||
if (color == BLACK)
|
RgbChannelAdjustment* adjustment = new RgbChannelAdjustment(
|
||||||
{
|
channelConfig[0].toInt(defaultR),
|
||||||
varR = colorConfig[0].toInt(0);
|
channelConfig[1].toInt(defaultG),
|
||||||
varG = colorConfig[1].toInt(0);
|
channelConfig[2].toInt(defaultB),
|
||||||
varB = colorConfig[2].toInt(0);
|
"ChannelAdjust_"+channelName.toUpper());
|
||||||
}
|
|
||||||
else if (color == WHITE)
|
|
||||||
{
|
|
||||||
varR = colorConfig[0].toInt(255);
|
|
||||||
varG = colorConfig[1].toInt(255);
|
|
||||||
varB = colorConfig[2].toInt(255);
|
|
||||||
}
|
|
||||||
else if (color == RED)
|
|
||||||
{
|
|
||||||
varR = colorConfig[0].toInt(255);
|
|
||||||
varG = colorConfig[1].toInt(0);
|
|
||||||
varB = colorConfig[2].toInt(0);
|
|
||||||
}
|
|
||||||
else if (color == GREEN)
|
|
||||||
{
|
|
||||||
varR = colorConfig[0].toInt(0);
|
|
||||||
varG = colorConfig[1].toInt(255);
|
|
||||||
varB = colorConfig[2].toInt(0);
|
|
||||||
}
|
|
||||||
else if (color == BLUE)
|
|
||||||
{
|
|
||||||
varR = colorConfig[0].toInt(0);
|
|
||||||
varG = colorConfig[1].toInt(0);
|
|
||||||
varB = colorConfig[2].toInt(255);
|
|
||||||
}
|
|
||||||
else if (color == CYAN)
|
|
||||||
{
|
|
||||||
varR = colorConfig[0].toInt(0);
|
|
||||||
varG = colorConfig[1].toInt(255);
|
|
||||||
varB = colorConfig[2].toInt(255);
|
|
||||||
}
|
|
||||||
else if (color == MAGENTA)
|
|
||||||
{
|
|
||||||
varR = colorConfig[0].toInt(255);
|
|
||||||
varG = colorConfig[1].toInt(0);
|
|
||||||
varB = colorConfig[2].toInt(255);
|
|
||||||
}
|
|
||||||
else if (color == YELLOW)
|
|
||||||
{
|
|
||||||
varR = colorConfig[0].toInt(255);
|
|
||||||
varG = colorConfig[1].toInt(255);
|
|
||||||
varB = colorConfig[2].toInt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
RgbChannelAdjustment* adjustment = new RgbChannelAdjustment(varR, varG, varB);
|
|
||||||
return adjustment;
|
return adjustment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +210,7 @@ LedString Hyperion::createLedString(const QJsonValue& ledsConfig, const ColorOrd
|
|||||||
led.clone = index["clone"].toInt(-1);
|
led.clone = index["clone"].toInt(-1);
|
||||||
if ( led.clone < -1 || led.clone >= maxLedId )
|
if ( led.clone < -1 || led.clone >= maxLedId )
|
||||||
{
|
{
|
||||||
Warning(Logger::getInstance("Core"), "LED %d: clone index of %d is out of range, clone ignored", led.index, led.clone);
|
Warning(CORE_LOGGER, "LED %d: clone index of %d is out of range, clone ignored", led.index, led.clone);
|
||||||
led.clone = -1;
|
led.clone = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,13 +259,13 @@ LedString Hyperion::createLedStringClone(const QJsonValue& ledsConfig, const Col
|
|||||||
led.clone = index["clone"].toInt(-1);
|
led.clone = index["clone"].toInt(-1);
|
||||||
if ( led.clone < -1 || led.clone >= maxLedId )
|
if ( led.clone < -1 || led.clone >= maxLedId )
|
||||||
{
|
{
|
||||||
Warning(Logger::getInstance("Core"), "LED %d: clone index of %d is out of range, clone ignored", led.index, led.clone);
|
Warning(CORE_LOGGER, "LED %d: clone index of %d is out of range, clone ignored", led.index, led.clone);
|
||||||
led.clone = -1;
|
led.clone = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( led.clone >= 0 )
|
if ( led.clone >= 0 )
|
||||||
{
|
{
|
||||||
Debug(Logger::getInstance("Core"), "LED %d: clone from led %d", led.index, led.clone);
|
Debug(CORE_LOGGER, "LED %d: clone from led %d", led.index, led.clone);
|
||||||
led.minX_frac = 0;
|
led.minX_frac = 0;
|
||||||
led.maxX_frac = 0;
|
led.maxX_frac = 0;
|
||||||
led.minY_frac = 0;
|
led.minY_frac = 0;
|
||||||
@ -378,7 +324,7 @@ QSize Hyperion::getLedLayoutGridSize(const QJsonValue& ledsConfig)
|
|||||||
midPointsY.erase(std::unique(midPointsY.begin(), midPointsY.end()), midPointsY.end());
|
midPointsY.erase(std::unique(midPointsY.begin(), midPointsY.end()), midPointsY.end());
|
||||||
|
|
||||||
QSize gridSize( midPointsX.size(), midPointsY.size() );
|
QSize gridSize( midPointsX.size(), midPointsY.size() );
|
||||||
Debug(Logger::getInstance("Core"), "led layout grid: %dx%d", gridSize.width(), gridSize.height());
|
Debug(CORE_LOGGER, "led layout grid: %dx%d", gridSize.width(), gridSize.height());
|
||||||
|
|
||||||
return gridSize;
|
return gridSize;
|
||||||
}
|
}
|
||||||
@ -387,7 +333,6 @@ QSize Hyperion::getLedLayoutGridSize(const QJsonValue& ledsConfig)
|
|||||||
|
|
||||||
LinearColorSmoothing * Hyperion::createColorSmoothing(const QJsonObject & smoothingConfig, LedDevice* leddevice)
|
LinearColorSmoothing * Hyperion::createColorSmoothing(const QJsonObject & smoothingConfig, LedDevice* leddevice)
|
||||||
{
|
{
|
||||||
Logger * log = Logger::getInstance("Core");
|
|
||||||
std::string type = smoothingConfig["type"].toString("linear").toStdString();
|
std::string type = smoothingConfig["type"].toString("linear").toStdString();
|
||||||
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
|
std::transform(type.begin(), type.end(), type.begin(), ::tolower);
|
||||||
LinearColorSmoothing * device = nullptr;
|
LinearColorSmoothing * device = nullptr;
|
||||||
@ -395,7 +340,7 @@ LinearColorSmoothing * Hyperion::createColorSmoothing(const QJsonObject & smooth
|
|||||||
|
|
||||||
if (type == "linear")
|
if (type == "linear")
|
||||||
{
|
{
|
||||||
Info( log, "Creating linear smoothing");
|
Info( CORE_LOGGER, "Creating linear smoothing");
|
||||||
device = new LinearColorSmoothing(
|
device = new LinearColorSmoothing(
|
||||||
leddevice,
|
leddevice,
|
||||||
smoothingConfig["updateFrequency"].toDouble(25.0),
|
smoothingConfig["updateFrequency"].toDouble(25.0),
|
||||||
@ -406,11 +351,11 @@ LinearColorSmoothing * Hyperion::createColorSmoothing(const QJsonObject & smooth
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Error(log, "Smoothing disabled, because of unknown type '%s'.", type.c_str());
|
Error(CORE_LOGGER, "Smoothing disabled, because of unknown type '%s'.", type.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
device->setEnable(smoothingConfig["enable"].toBool(true));
|
device->setEnable(smoothingConfig["enable"].toBool(true));
|
||||||
InfoIf(!device->enabled(), log,"Smoothing disabled");
|
InfoIf(!device->enabled(), CORE_LOGGER,"Smoothing disabled");
|
||||||
|
|
||||||
assert(device != nullptr);
|
assert(device != nullptr);
|
||||||
return device;
|
return device;
|
||||||
@ -426,7 +371,7 @@ MessageForwarder * Hyperion::createMessageForwarder(const QJsonObject & forwarde
|
|||||||
const QJsonArray & addr = forwarderConfig["json"].toArray();
|
const QJsonArray & addr = forwarderConfig["json"].toArray();
|
||||||
for (signed i = 0; i < addr.size(); ++i)
|
for (signed i = 0; i < addr.size(); ++i)
|
||||||
{
|
{
|
||||||
Info(Logger::getInstance("Core"), "Json forward to %s", addr.at(i).toString().toStdString().c_str());
|
Info(CORE_LOGGER, "Json forward to %s", addr.at(i).toString().toStdString().c_str());
|
||||||
forwarder->addJsonSlave(addr[i].toString().toStdString());
|
forwarder->addJsonSlave(addr[i].toString().toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -436,7 +381,7 @@ MessageForwarder * Hyperion::createMessageForwarder(const QJsonObject & forwarde
|
|||||||
const QJsonArray & addr = forwarderConfig["proto"].toArray();
|
const QJsonArray & addr = forwarderConfig["proto"].toArray();
|
||||||
for (signed i = 0; i < addr.size(); ++i)
|
for (signed i = 0; i < addr.size(); ++i)
|
||||||
{
|
{
|
||||||
Info(Logger::getInstance("Core"), "Proto forward to %s", addr.at(i).toString().toStdString().c_str());
|
Info(CORE_LOGGER, "Proto forward to %s", addr.at(i).toString().toStdString().c_str());
|
||||||
forwarder->addProtoSlave(addr[i].toString().toStdString());
|
forwarder->addProtoSlave(addr[i].toString().toStdString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -460,7 +405,7 @@ Hyperion::Hyperion(const QJsonObject &qjsonConfig, const QString configFile)
|
|||||||
, _qjsonConfig(qjsonConfig)
|
, _qjsonConfig(qjsonConfig)
|
||||||
, _configFile(configFile)
|
, _configFile(configFile)
|
||||||
, _timer()
|
, _timer()
|
||||||
, _log(Logger::getInstance("Core"))
|
, _log(CORE_LOGGER)
|
||||||
, _hwLedCount(_ledString.leds().size())
|
, _hwLedCount(_ledString.leds().size())
|
||||||
, _colorAdjustmentV4Lonly(false)
|
, _colorAdjustmentV4Lonly(false)
|
||||||
, _sourceAutoSelectEnabled(true)
|
, _sourceAutoSelectEnabled(true)
|
||||||
@ -599,6 +544,7 @@ void Hyperion::setSourceAutoSelectEnabled(bool enabled)
|
|||||||
{
|
{
|
||||||
setCurrentSourcePriority(_muxer.getCurrentPriority());
|
setCurrentSourcePriority(_muxer.getCurrentPriority());
|
||||||
}
|
}
|
||||||
|
update();
|
||||||
DebugIf( !_sourceAutoSelectEnabled, _log, "source auto select is disabled");
|
DebugIf( !_sourceAutoSelectEnabled, _log, "source auto select is disabled");
|
||||||
InfoIf(_sourceAutoSelectEnabled, _log, "set current input source to auto select");
|
InfoIf(_sourceAutoSelectEnabled, _log, "set current input source to auto select");
|
||||||
}
|
}
|
||||||
@ -830,18 +776,15 @@ void Hyperion::update()
|
|||||||
std::swap(color.red, color.green);
|
std::swap(color.red, color.green);
|
||||||
break;
|
break;
|
||||||
case ORDER_GBR:
|
case ORDER_GBR:
|
||||||
{
|
|
||||||
std::swap(color.red, color.green);
|
std::swap(color.red, color.green);
|
||||||
std::swap(color.green, color.blue);
|
std::swap(color.green, color.blue);
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case ORDER_BRG:
|
case ORDER_BRG:
|
||||||
{
|
|
||||||
std::swap(color.red, color.blue);
|
std::swap(color.red, color.blue);
|
||||||
std::swap(color.green, color.blue);
|
std::swap(color.green, color.blue);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
MultiColorAdjustment::MultiColorAdjustment(const unsigned ledCnt)
|
MultiColorAdjustment::MultiColorAdjustment(const unsigned ledCnt)
|
||||||
: _ledAdjustments(ledCnt, nullptr)
|
: _ledAdjustments(ledCnt, nullptr)
|
||||||
|
, _log(Logger::getInstance("ColorAdjust"))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,14 +48,14 @@ bool MultiColorAdjustment::verifyAdjustments() const
|
|||||||
|
|
||||||
if (adjustment == nullptr)
|
if (adjustment == nullptr)
|
||||||
{
|
{
|
||||||
Error(Logger::getInstance("ColorAdjust"), "No adjustment set for %d", iLed);
|
Error(_log, "No adjustment set for %d", iLed);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (adjustment->_rgbTransform.getBrightness() <= adjustment->_rgbTransform.getBrightnessMin() )
|
if (adjustment->_rgbTransform.getBrightness() <= adjustment->_rgbTransform.getBrightnessMin() )
|
||||||
{
|
{
|
||||||
adjustment->_rgbTransform.setBrightnessMin(0);
|
adjustment->_rgbTransform.setBrightnessMin(0);
|
||||||
adjustment->_rgbTransform.setBrightness(0.5);
|
adjustment->_rgbTransform.setBrightness(0.5);
|
||||||
Warning(Logger::getInstance("ColorAdjust"), "Adjustment for %d has invalid Brightness values, values set to default. (brightnessMin is bigger then brightness)", iLed);
|
Warning(_log, "Adjustment for %d has invalid Brightness values, values set to default. (brightnessMin is bigger then brightness)", iLed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -144,7 +145,7 @@ void MultiColorAdjustment::applyAdjustment(std::vector<ColorRgb>& ledColors)
|
|||||||
uint8_t WR = adjustment->_rgbWhiteAdjustment.getAdjustmentR(white);
|
uint8_t WR = adjustment->_rgbWhiteAdjustment.getAdjustmentR(white);
|
||||||
uint8_t WG = adjustment->_rgbWhiteAdjustment.getAdjustmentG(white);
|
uint8_t WG = adjustment->_rgbWhiteAdjustment.getAdjustmentG(white);
|
||||||
uint8_t WB = adjustment->_rgbWhiteAdjustment.getAdjustmentB(white);
|
uint8_t WB = adjustment->_rgbWhiteAdjustment.getAdjustmentB(white);
|
||||||
|
|
||||||
color.red = OR + RR + GR + BR + CR + MR + YR + WR;
|
color.red = OR + RR + GR + BR + CR + MR + YR + WR;
|
||||||
color.green = OG + RG + GG + BG + CG + MG + YG + WG;
|
color.green = OG + RG + GG + BG + CG + MG + YG + WG;
|
||||||
color.blue = OB + RB + GB + BB + CB + MB + YB + WB;
|
color.blue = OB + RB + GB + BB + CB + MB + YB + WB;
|
||||||
|
@ -61,4 +61,7 @@ private:
|
|||||||
|
|
||||||
/// List with a pointer to the ColorAdjustment for each individual led
|
/// List with a pointer to the ColorAdjustment for each individual led
|
||||||
std::vector<ColorAdjustment*> _ledAdjustments;
|
std::vector<ColorAdjustment*> _ledAdjustments;
|
||||||
|
|
||||||
|
// logger instance
|
||||||
|
Logger * _log;
|
||||||
};
|
};
|
||||||
|
@ -50,12 +50,12 @@ const PriorityMuxer::InputInfo& PriorityMuxer::getInputInfo(const int priority)
|
|||||||
|
|
||||||
void PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& ledColors, const int64_t timeoutTime_ms, hyperion::Components component)
|
void PriorityMuxer::setInput(const int priority, const std::vector<ColorRgb>& ledColors, const int64_t timeoutTime_ms, hyperion::Components component)
|
||||||
{
|
{
|
||||||
InputInfo& input = _activeInputs[priority];
|
InputInfo& input = _activeInputs[priority];
|
||||||
input.priority = priority;
|
input.priority = priority;
|
||||||
input.timeoutTime_ms = timeoutTime_ms;
|
input.timeoutTime_ms = timeoutTime_ms;
|
||||||
input.ledColors = ledColors;
|
input.ledColors = ledColors;
|
||||||
input.componentId = component;
|
input.componentId = component;
|
||||||
_currentPriority = std::min(_currentPriority, priority);
|
_currentPriority = std::min(_currentPriority, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PriorityMuxer::clearInput(const int priority)
|
void PriorityMuxer::clearInput(const int priority)
|
||||||
|
@ -390,7 +390,7 @@ void JsonClientConnection::handleColorCommand(const QJsonObject& message, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set output
|
// set output
|
||||||
_hyperion->setColors(priority, colorData, duration);
|
_hyperion->setColors(priority, colorData, duration, true, hyperion::COMP_COLOR);
|
||||||
|
|
||||||
// send reply
|
// send reply
|
||||||
sendSuccessReply(command, tan);
|
sendSuccessReply(command, tan);
|
||||||
@ -595,7 +595,9 @@ void JsonClientConnection::handleServerInfoCommand(const QJsonObject&, const QSt
|
|||||||
item["duration_ms"] = int(priorityInfo.timeoutTime_ms - now);
|
item["duration_ms"] = int(priorityInfo.timeoutTime_ms - now);
|
||||||
}
|
}
|
||||||
|
|
||||||
item["owner"] = QString("unknown");
|
item["owner"] = QString(hyperion::componentToIdString(priorityInfo.componentId));
|
||||||
|
item["componentId"] = priorityInfo.componentId;
|
||||||
|
item["component"] = QString(hyperion::componentToString(priorityInfo.componentId));
|
||||||
item["active"] = true;
|
item["active"] = true;
|
||||||
item["visible"] = (priority == currentPriority);
|
item["visible"] = (priority == currentPriority);
|
||||||
foreach(auto const &entry, priorityRegister)
|
foreach(auto const &entry, priorityRegister)
|
||||||
|
@ -17,25 +17,25 @@ std::map<std::string,Logger*> *Logger::LoggerMap = nullptr;
|
|||||||
Logger::LogLevel Logger::GLOBAL_MIN_LOG_LEVEL = Logger::UNSET;
|
Logger::LogLevel Logger::GLOBAL_MIN_LOG_LEVEL = Logger::UNSET;
|
||||||
LoggerManager* LoggerManager::_instance = nullptr;
|
LoggerManager* LoggerManager::_instance = nullptr;
|
||||||
|
|
||||||
|
Logger* Logger::getInstance(QString name, Logger::LogLevel minLevel)
|
||||||
Logger* Logger::getInstance(std::string name, Logger::LogLevel minLevel)
|
|
||||||
{
|
{
|
||||||
|
std::string loggerName = name.toStdString();
|
||||||
Logger* log = nullptr;
|
Logger* log = nullptr;
|
||||||
if (LoggerMap == nullptr)
|
if (LoggerMap == nullptr)
|
||||||
{
|
{
|
||||||
LoggerMap = new std::map<std::string,Logger*>;
|
LoggerMap = new std::map<std::string,Logger*>;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( LoggerMap->find(name) == LoggerMap->end() )
|
if ( LoggerMap->find(loggerName) == LoggerMap->end() )
|
||||||
{
|
{
|
||||||
log = new Logger(name,minLevel);
|
log = new Logger(loggerName,minLevel);
|
||||||
LoggerMap->insert(std::pair<std::string,Logger*>(name,log)); // compat version, replace it with following line if we have 100% c++11
|
LoggerMap->insert(std::pair<std::string,Logger*>(loggerName,log)); // compat version, replace it with following line if we have 100% c++11
|
||||||
//LoggerMap->emplace(name,log); // not compat with older linux distro's e.g. wheezy
|
//LoggerMap->emplace(loggerName,log); // not compat with older linux distro's e.g. wheezy
|
||||||
connect(log, SIGNAL(newLogMessage(Logger::T_LOG_MESSAGE)), LoggerManager::getInstance(), SLOT(handleNewLogMessage(Logger::T_LOG_MESSAGE)));
|
connect(log, SIGNAL(newLogMessage(Logger::T_LOG_MESSAGE)), LoggerManager::getInstance(), SLOT(handleNewLogMessage(Logger::T_LOG_MESSAGE)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log = LoggerMap->at(name);
|
log = LoggerMap->at(loggerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return log;
|
return log;
|
||||||
@ -71,7 +71,7 @@ void Logger::setLogLevel(LogLevel level,std::string name)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger* log = Logger::getInstance(name,level);
|
Logger* log = Logger::getInstance(QString::fromStdString(name),level);
|
||||||
log->setMinLevel(level);
|
log->setMinLevel(level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ Logger::LogLevel Logger::getLogLevel(std::string name)
|
|||||||
return GLOBAL_MIN_LOG_LEVEL;
|
return GLOBAL_MIN_LOG_LEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger* log = Logger::getInstance(name);
|
Logger* log = Logger::getInstance(QString::fromStdString(name));
|
||||||
return log->getMinLevel();
|
return log->getMinLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,12 +6,16 @@
|
|||||||
// Utils includes
|
// Utils includes
|
||||||
#include <utils/RgbChannelAdjustment.h>
|
#include <utils/RgbChannelAdjustment.h>
|
||||||
|
|
||||||
RgbChannelAdjustment::RgbChannelAdjustment()
|
RgbChannelAdjustment::RgbChannelAdjustment(QString channelName)
|
||||||
|
: _channelName(channelName)
|
||||||
|
, _log(Logger::getInstance(channelName))
|
||||||
{
|
{
|
||||||
setAdjustment(UINT8_MAX, UINT8_MAX, UINT8_MAX);
|
//setAdjustment(UINT8_MAX, UINT8_MAX, UINT8_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
RgbChannelAdjustment::RgbChannelAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB)
|
RgbChannelAdjustment::RgbChannelAdjustment(uint8_t adjustR, uint8_t adjustG, uint8_t adjustB, QString channelName)
|
||||||
|
: _channelName(channelName)
|
||||||
|
, _log(Logger::getInstance(channelName))
|
||||||
{
|
{
|
||||||
setAdjustment(adjustR, adjustG, adjustB);
|
setAdjustment(adjustR, adjustG, adjustB);
|
||||||
}
|
}
|
||||||
@ -75,6 +79,7 @@ uint8_t RgbChannelAdjustment::getAdjustmentB(uint8_t inputB) const
|
|||||||
|
|
||||||
void RgbChannelAdjustment::initializeMapping()
|
void RgbChannelAdjustment::initializeMapping()
|
||||||
{
|
{
|
||||||
|
Debug(_log, "initialize mapping with %d,%d,%d", _adjust[RED], _adjust[GREEN], _adjust[BLUE]);
|
||||||
// initialize linear mapping
|
// initialize linear mapping
|
||||||
for (unsigned channel=0; channel<3; channel++)
|
for (unsigned channel=0; channel<3; channel++)
|
||||||
for (unsigned idx=0; idx<=UINT8_MAX; idx++)
|
for (unsigned idx=0; idx<=UINT8_MAX; idx++)
|
||||||
|
@ -478,6 +478,22 @@ void JsonConnection::setAdjustment(
|
|||||||
yellow.append(yellowAdjustment.blue());
|
yellow.append(yellowAdjustment.blue());
|
||||||
adjust["yellowAdjust"] = yellow;
|
adjust["yellowAdjust"] = yellow;
|
||||||
}
|
}
|
||||||
|
if (whiteAdjustment.isValid())
|
||||||
|
{
|
||||||
|
QJsonArray white;
|
||||||
|
white.append(whiteAdjustment.red());
|
||||||
|
white.append(whiteAdjustment.green());
|
||||||
|
white.append(whiteAdjustment.blue());
|
||||||
|
adjust["whiteAdjust"] = white;
|
||||||
|
}
|
||||||
|
if (blackAdjustment.isValid())
|
||||||
|
{
|
||||||
|
QJsonArray black;
|
||||||
|
black.append(blackAdjustment.red());
|
||||||
|
black.append(blackAdjustment.green());
|
||||||
|
black.append(blackAdjustment.blue());
|
||||||
|
adjust["blackAdjust"] = black;
|
||||||
|
}
|
||||||
if (brightnessMin != nullptr)
|
if (brightnessMin != nullptr)
|
||||||
{
|
{
|
||||||
adjust["brightnessMin"] = *brightnessMin;
|
adjust["brightnessMin"] = *brightnessMin;
|
||||||
|
Loading…
Reference in New Issue
Block a user