Fix 1181 - Effects were not started from tray (#1199)

* Fix 1181, add constants and defaults

* Include #1195 changes
This commit is contained in:
LordGrey
2021-03-19 22:52:41 +01:00
committed by GitHub
parent 41af5c1b9e
commit 94d9b02734
12 changed files with 40 additions and 98 deletions

View File

@@ -3,6 +3,7 @@
#include <utils/Logger.h>
#include <hyperion/Hyperion.h>
#include <utils/settings.h>
#include <effectengine/Effect.h>
///
/// @brief Handle the background Effect settings, reacts on runtime to settings changes
@@ -37,7 +38,7 @@ private slots:
#define BGCONFIG_ARRAY bgColorConfig.toArray()
// clear background priority
_hyperion->clear(254);
_hyperion->clear(PriorityMuxer::BG_PRIORITY);
// initial background effect/color
if (BGEffectConfig["enable"].toBool(true))
{
@@ -53,12 +54,12 @@ private slots:
static_cast<uint8_t>(BGCONFIG_ARRAY.at(2).toInt(0))
}
};
_hyperion->setColor(254, bg_color);
_hyperion->setColor(PriorityMuxer::BG_PRIORITY, bg_color);
Info(Logger::getInstance("HYPERION"),"Initial background color set (%d %d %d)",bg_color.at(0).red, bg_color.at(0).green, bg_color.at(0).blue);
}
else
{
int result = _hyperion->setEffect(bgEffectConfig, 254);
int result = _hyperion->setEffect(bgEffectConfig, PriorityMuxer::BG_PRIORITY, Effect::ENDLESS);
Info(Logger::getInstance("HYPERION"),"Initial background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ? "started" : "failed"));
}
}

View File

@@ -26,6 +26,7 @@
// Effect engine includes
#include <effectengine/EffectDefinition.h>
#include <effectengine/Effect.h>
#include <effectengine/ActiveEffectDefinition.h>
#include <effectengine/EffectSchema.h>
@@ -217,7 +218,7 @@ public slots:
/// @param effectName Name of the effec to run
/// @param priority The priority channel of the effect
/// @param timeout The timeout of the effect (after the timout, the effect will be cleared)
int setEffect(const QString & effectName, int priority, int timeout = -1, const QString & origin="System");
int setEffect(const QString & effectName, int priority, int timeout = Effect::ENDLESS, const QString & origin="System");
/// Run the specified effect on the given priority channel and optionally specify a timeout
/// @param effectName Name of the effec to run
@@ -227,7 +228,7 @@ public slots:
int setEffect(const QString &effectName
, const QJsonObject &args
, int priority
, int timeout = -1
, int timeout = Effect::ENDLESS
, const QString &pythonScript = ""
, const QString &origin="System"
, const QString &imageData = ""

View File

@@ -54,6 +54,9 @@ public:
QString owner;
};
//Foreground and Background priorities
const static int FG_PRIORITY;
const static int BG_PRIORITY;
/// The lowest possible priority, which is used when no priority channels are active
const static int LOWEST_PRIORITY;