mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
refactor: Led layout, clearAll (#703)
* add SSDP name field * YALL - yet another led layout * led layout migration * add initial vscode config * merge clearAll with clear, rename Hyperion::compStateChange * simpler components api * Corrected code formatting + triggered PR build * fix: regression from #636 * Support for color patterns Co-authored-by: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
@@ -58,14 +58,10 @@ signals:
|
||||
|
||||
///
|
||||
/// @brief PIPE the clear command for the global priority channel over HyperionDaemon to Hyperion class
|
||||
/// @param[in] priority The priority channel
|
||||
/// @param[in] priority The priority channel (-1 to clear all possible priorities)
|
||||
/// @param[in] forceclearAll Force the clear
|
||||
///
|
||||
void clearGlobalInput(int priority);
|
||||
|
||||
///
|
||||
/// @brief PIPE the clearAll command over HyperionDaemon to Hyperion class
|
||||
///
|
||||
void clearAllGlobalInput(bool forceClearAll=false);
|
||||
void clearGlobalInput(int priority, bool forceClearAll=false);
|
||||
|
||||
///
|
||||
/// @brief PIPE external images over HyperionDaemon to Hyperion class
|
||||
@@ -84,7 +80,7 @@ signals:
|
||||
/// @param[in] origin The setter
|
||||
/// @param clearEffect Should be true when NOT called from an effect
|
||||
///
|
||||
void setGlobalColor(const int priority, const ColorRgb &ledColor, const int timeout_ms, const QString& origin = "External" ,bool clearEffects = true);
|
||||
void setGlobalColor(const int priority, const std::vector<ColorRgb> &ledColor, const int timeout_ms, const QString& origin = "External" ,bool clearEffects = true);
|
||||
|
||||
///////////////////////////////////////
|
||||
//////////// FROM HYPERION ////////////
|
||||
|
@@ -34,13 +34,15 @@ namespace hyperion {
|
||||
}
|
||||
if ( fgTypeConfig.contains("color") )
|
||||
{
|
||||
ColorRgb fg_color = {
|
||||
(uint8_t)FGCONFIG_ARRAY.at(0).toInt(0),
|
||||
(uint8_t)FGCONFIG_ARRAY.at(1).toInt(0),
|
||||
(uint8_t)FGCONFIG_ARRAY.at(2).toInt(0)
|
||||
std::vector<ColorRgb> fg_color = {
|
||||
ColorRgb {
|
||||
(uint8_t)FGCONFIG_ARRAY.at(0).toInt(0),
|
||||
(uint8_t)FGCONFIG_ARRAY.at(1).toInt(0),
|
||||
(uint8_t)FGCONFIG_ARRAY.at(2).toInt(0)
|
||||
}
|
||||
};
|
||||
hyperion->setColor(FG_PRIORITY, fg_color, fg_duration_ms);
|
||||
Info(Logger::getInstance("HYPERION"),"Initial foreground color set (%d %d %d)",fg_color.red,fg_color.green,fg_color.blue);
|
||||
Info(Logger::getInstance("HYPERION"),"Initial foreground color set (%d %d %d)",fg_color.at(0).red,fg_color.at(0).green,fg_color.at(0).blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -195,15 +197,13 @@ namespace hyperion {
|
||||
|
||||
for (signed i = 0; i < ledConfigArray.size(); ++i)
|
||||
{
|
||||
const QJsonObject& index = ledConfigArray[i].toObject();
|
||||
const QJsonObject& ledConfig = ledConfigArray[i].toObject();
|
||||
Led led;
|
||||
|
||||
const QJsonObject& hscanConfig = ledConfigArray[i].toObject()["h"].toObject();
|
||||
const QJsonObject& vscanConfig = ledConfigArray[i].toObject()["v"].toObject();
|
||||
led.minX_frac = qMax(0.0, qMin(1.0, hscanConfig["min"].toDouble()));
|
||||
led.maxX_frac = qMax(0.0, qMin(1.0, hscanConfig["max"].toDouble()));
|
||||
led.minY_frac = qMax(0.0, qMin(1.0, vscanConfig["min"].toDouble()));
|
||||
led.maxY_frac = qMax(0.0, qMin(1.0, vscanConfig["max"].toDouble()));
|
||||
led.minX_frac = qMax(0.0, qMin(1.0, ledConfig["hmin"].toDouble()));
|
||||
led.maxX_frac = qMax(0.0, qMin(1.0, ledConfig["hmax"].toDouble()));
|
||||
led.minY_frac = qMax(0.0, qMin(1.0, ledConfig["vmin"].toDouble()));
|
||||
led.maxY_frac = qMax(0.0, qMin(1.0, ledConfig["vmax"].toDouble()));
|
||||
// Fix if the user swapped min and max
|
||||
if (led.minX_frac > led.maxX_frac)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ namespace hyperion {
|
||||
}
|
||||
|
||||
// Get the order of the rgb channels for this led (default is device order)
|
||||
led.colorOrder = stringToColorOrder(index["colorOrder"].toString(deviceOrderStr));
|
||||
led.colorOrder = stringToColorOrder(ledConfig["colorOrder"].toString(deviceOrderStr));
|
||||
ledString.leds().push_back(led);
|
||||
}
|
||||
return ledString;
|
||||
@@ -228,12 +228,12 @@ namespace hyperion {
|
||||
|
||||
for (signed i = 0; i < ledConfigArray.size(); ++i)
|
||||
{
|
||||
const QJsonObject& hscanConfig = ledConfigArray[i].toObject()["h"].toObject();
|
||||
const QJsonObject& vscanConfig = ledConfigArray[i].toObject()["v"].toObject();
|
||||
double minX_frac = qMax(0.0, qMin(1.0, hscanConfig["min"].toDouble()));
|
||||
double maxX_frac = qMax(0.0, qMin(1.0, hscanConfig["max"].toDouble()));
|
||||
double minY_frac = qMax(0.0, qMin(1.0, vscanConfig["min"].toDouble()));
|
||||
double maxY_frac = qMax(0.0, qMin(1.0, vscanConfig["max"].toDouble()));
|
||||
const QJsonObject& ledConfig = ledConfigArray[i].toObject();
|
||||
|
||||
double minX_frac = qMax(0.0, qMin(1.0, ledConfig["hmin"].toDouble()));
|
||||
double maxX_frac = qMax(0.0, qMin(1.0, ledConfig["hmax"].toDouble()));
|
||||
double minY_frac = qMax(0.0, qMin(1.0, ledConfig["vmin"].toDouble()));
|
||||
double maxY_frac = qMax(0.0, qMin(1.0, ledConfig["vmax"].toDouble()));
|
||||
// Fix if the user swapped min and max
|
||||
if (minX_frac > maxX_frac)
|
||||
{
|
||||
|
Reference in New Issue
Block a user