mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Added rgbOrder config for each led
Former-commit-id: 9c9f49d61b24267fe9ebe566600cdc42c78c1ab6
This commit is contained in:
parent
c5151e497d
commit
b86e08cf0a
@ -52,12 +52,6 @@ public:
|
||||
SATURATION_GAIN, VALUE_GAIN, THRESHOLD, GAMMA, BLACKLEVEL, WHITELEVEL
|
||||
};
|
||||
|
||||
/// Enumeration containing the possible orders of device color byte data
|
||||
enum ColorOrder
|
||||
{
|
||||
ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR
|
||||
};
|
||||
|
||||
///
|
||||
/// Constructs the Hyperion instance based on the given Json configuration
|
||||
///
|
||||
|
@ -12,6 +12,12 @@
|
||||
// Forward class declarations
|
||||
namespace Json { class Value; }
|
||||
|
||||
/// Enumeration containing the possible orders of device color byte data
|
||||
enum ColorOrder
|
||||
{
|
||||
ORDER_RGB, ORDER_RBG, ORDER_GRB, ORDER_BRG, ORDER_GBR, ORDER_BGR, ORDER_DEFAULT
|
||||
};
|
||||
|
||||
///
|
||||
/// The Led structure contains the definition of the image portion used to determine a single led's
|
||||
/// color.
|
||||
@ -40,6 +46,8 @@ struct Led
|
||||
double minY_frac;
|
||||
/// The maximum horizontal scan line included for this leds color
|
||||
double maxY_frac;
|
||||
/// the color order
|
||||
ColorOrder colorOrder;
|
||||
};
|
||||
|
||||
///
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <effectengine/EffectEngine.h>
|
||||
|
||||
|
||||
Hyperion::ColorOrder Hyperion::createColorOrder(const Json::Value &deviceConfig)
|
||||
ColorOrder Hyperion::createColorOrder(const Json::Value &deviceConfig)
|
||||
{
|
||||
// deprecated: force BGR when the deprecated flag is present and set to true
|
||||
if (deviceConfig.get("bgr-output", false).asBool())
|
||||
@ -201,6 +201,12 @@ LedString Hyperion::createLedString(const Json::Value& ledsConfig)
|
||||
led.maxX_frac = std::max(0.0, std::min(1.0, hscanConfig["maximum"].asDouble()));
|
||||
led.minY_frac = std::max(0.0, std::min(1.0, vscanConfig["minimum"].asDouble()));
|
||||
led.maxY_frac = std::max(0.0, std::min(1.0, vscanConfig["maximum"].asDouble()));
|
||||
if (ledConfig.get("colorOrder", false).asBool()) {
|
||||
led.colorOrder = createColorOrder(ledConfig);
|
||||
} else {
|
||||
led.colorOrder = ORDER_DEFAULT;
|
||||
}
|
||||
|
||||
|
||||
// Fix if the user swapped min and max
|
||||
if (led.minX_frac > led.maxX_frac)
|
||||
@ -429,10 +435,16 @@ void Hyperion::update()
|
||||
|
||||
// Apply the transform to each led and color-channel
|
||||
std::vector<ColorRgb> ledColors = _raw2ledTransform->applyTransform(priorityInfo.ledColors);
|
||||
const std::vector<Led>& leds = _ledString.leds();
|
||||
int i = 0;
|
||||
for (ColorRgb& color : ledColors)
|
||||
{
|
||||
ColorOrder ledColorOrder = leds.at(i).colorOrder;
|
||||
if(ledColorOrder == ORDER_DEFAULT) {
|
||||
ledColorOrder = _colorOrder;
|
||||
}
|
||||
// correct the color byte order
|
||||
switch (_colorOrder)
|
||||
switch (ledColorOrder)
|
||||
{
|
||||
case ORDER_RGB:
|
||||
// leave as it is
|
||||
@ -463,6 +475,7 @@ void Hyperion::update()
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// Write the data to the device
|
||||
|
@ -195,6 +195,10 @@
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
},
|
||||
"colorOrder" : {
|
||||
"type" : "string",
|
||||
"required" : false
|
||||
}
|
||||
},
|
||||
"additionalProperties" : false
|
||||
|
Loading…
Reference in New Issue
Block a user