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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 40 additions and 98 deletions

View File

@ -21,6 +21,9 @@ class Effect : public QThread
Q_OBJECT Q_OBJECT
public: public:
static const int ENDLESS;
friend class EffectModule; friend class EffectModule;
Effect(Hyperion *hyperion Effect(Hyperion *hyperion
@ -53,12 +56,11 @@ public:
bool isInterruptionRequested(); bool isInterruptionRequested();
/// ///
/// @brief Get the remaining timeout, or 0 if there /// @brief Get the remaining timeout, or indication it is endless
/// is no timeout for this effect.
/// ///
/// @return The flag state /// @return The flag state
/// ///
int getRemaining(); int getRemaining() const;
QString getScript() const { return _script; } QString getScript() const { return _script; }
@ -88,7 +90,7 @@ private:
const QJsonObject _args; const QJsonObject _args;
const QString _imageData; const QString _imageData;
int64_t _endTime; qint64 _endTime;
/// Buffer for colorData /// Buffer for colorData
QVector<ColorRgb> _colors; QVector<ColorRgb> _colors;

View File

@ -13,6 +13,7 @@
// Effect engine includes // Effect engine includes
#include <effectengine/EffectDefinition.h> #include <effectengine/EffectDefinition.h>
#include <effectengine/Effect.h>
#include <effectengine/ActiveEffectDefinition.h> #include <effectengine/ActiveEffectDefinition.h>
#include <effectengine/EffectSchema.h> #include <effectengine/EffectSchema.h>
#include <utils/Logger.h> #include <utils/Logger.h>
@ -69,13 +70,13 @@ signals:
public slots: public slots:
/// Run the specified effect on the given priority channel and optionally specify a timeout /// Run the specified effect on the given priority channel and optionally specify a timeout
int runEffect(const QString &effectName, int priority, int timeout = -1, const QString &origin="System"); int runEffect(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 /// Run the specified effect on the given priority channel and optionally specify a timeout
int runEffect(const QString &effectName int runEffect(const QString &effectName
, const QJsonObject &args , const QJsonObject &args
, int priority , int priority
, int timeout = -1 , int timeout = Effect::ENDLESS
, const QString &pythonScript = "" , const QString &pythonScript = ""
, const QString &origin = "System" , const QString &origin = "System"
, unsigned smoothCfg=0 , unsigned smoothCfg=0
@ -102,7 +103,7 @@ private:
,const QString &name ,const QString &name
, const QJsonObject &args , const QJsonObject &args
, int priority , int priority
, int timeout = -1 , int timeout = Effect::ENDLESS
, const QString &origin="System" , const QString &origin="System"
, unsigned smoothCfg=0 , unsigned smoothCfg=0
, const QString &imageData = "" , const QString &imageData = ""

View File

@ -3,6 +3,7 @@
#include <utils/Logger.h> #include <utils/Logger.h>
#include <hyperion/Hyperion.h> #include <hyperion/Hyperion.h>
#include <utils/settings.h> #include <utils/settings.h>
#include <effectengine/Effect.h>
/// ///
/// @brief Handle the background Effect settings, reacts on runtime to settings changes /// @brief Handle the background Effect settings, reacts on runtime to settings changes
@ -37,7 +38,7 @@ private slots:
#define BGCONFIG_ARRAY bgColorConfig.toArray() #define BGCONFIG_ARRAY bgColorConfig.toArray()
// clear background priority // clear background priority
_hyperion->clear(254); _hyperion->clear(PriorityMuxer::BG_PRIORITY);
// initial background effect/color // initial background effect/color
if (BGEffectConfig["enable"].toBool(true)) if (BGEffectConfig["enable"].toBool(true))
{ {
@ -53,12 +54,12 @@ private slots:
static_cast<uint8_t>(BGCONFIG_ARRAY.at(2).toInt(0)) 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); 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 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")); 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 // Effect engine includes
#include <effectengine/EffectDefinition.h> #include <effectengine/EffectDefinition.h>
#include <effectengine/Effect.h>
#include <effectengine/ActiveEffectDefinition.h> #include <effectengine/ActiveEffectDefinition.h>
#include <effectengine/EffectSchema.h> #include <effectengine/EffectSchema.h>
@ -217,7 +218,7 @@ public slots:
/// @param effectName Name of the effec to run /// @param effectName Name of the effec to run
/// @param priority The priority channel of the effect /// @param priority The priority channel of the effect
/// @param timeout The timeout of the effect (after the timout, the effect will be cleared) /// @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 /// Run the specified effect on the given priority channel and optionally specify a timeout
/// @param effectName Name of the effec to run /// @param effectName Name of the effec to run
@ -227,7 +228,7 @@ public slots:
int setEffect(const QString &effectName int setEffect(const QString &effectName
, const QJsonObject &args , const QJsonObject &args
, int priority , int priority
, int timeout = -1 , int timeout = Effect::ENDLESS
, const QString &pythonScript = "" , const QString &pythonScript = ""
, const QString &origin="System" , const QString &origin="System"
, const QString &imageData = "" , const QString &imageData = ""

View File

@ -54,6 +54,9 @@ public:
QString owner; 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 /// The lowest possible priority, which is used when no priority channels are active
const static int LOWEST_PRIORITY; const static int LOWEST_PRIORITY;

View File

@ -7,6 +7,7 @@
#include <hyperion/LedString.h> #include <hyperion/LedString.h>
// fg effect // fg effect
#include <hyperion/Hyperion.h> #include <hyperion/Hyperion.h>
#include <hyperion/PriorityMuxer.h>
/// ///
/// @brief Provide utility methods for Hyperion class /// @brief Provide utility methods for Hyperion class
@ -16,7 +17,6 @@ namespace hyperion {
void handleInitialEffect(Hyperion* hyperion, const QJsonObject& FGEffectConfig) void handleInitialEffect(Hyperion* hyperion, const QJsonObject& FGEffectConfig)
{ {
#define FGCONFIG_ARRAY fgColorConfig.toArray() #define FGCONFIG_ARRAY fgColorConfig.toArray()
const int FG_PRIORITY = 0;
const int DURATION_INFINITY = 0; const int DURATION_INFINITY = 0;
// initial foreground effect/color // initial foreground effect/color
@ -41,12 +41,12 @@ namespace hyperion {
static_cast<uint8_t>(FGCONFIG_ARRAY.at(2).toInt(0)) static_cast<uint8_t>(FGCONFIG_ARRAY.at(2).toInt(0))
} }
}; };
hyperion->setColor(FG_PRIORITY, fg_color, fg_duration_ms); hyperion->setColor(PriorityMuxer::FG_PRIORITY, fg_color, fg_duration_ms);
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); 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 else
{ {
int result = hyperion->setEffect(fgEffectConfig, FG_PRIORITY, fg_duration_ms); int result = hyperion->setEffect(fgEffectConfig, PriorityMuxer::FG_PRIORITY, fg_duration_ms);
Info(Logger::getInstance("HYPERION"),"Initial foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed")); Info(Logger::getInstance("HYPERION"),"Initial foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed"));
} }
} }

View File

@ -12,6 +12,8 @@
// python utils // python utils
#include <python/PythonProgram.h> #include <python/PythonProgram.h>
const int Effect::ENDLESS = -1;
Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &script, const QString &name, const QJsonObject &args, const QString &imageData) Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &script, const QString &name, const QJsonObject &args, const QString &imageData)
: QThread() : QThread()
, _hyperion(hyperion) , _hyperion(hyperion)
@ -22,7 +24,7 @@ Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &scr
, _args(args) , _args(args)
, _imageData(imageData) , _imageData(imageData)
, _endTime(-1) , _endTime(-1)
, _colors() , _interupt(false)
, _imageSize(hyperion->getLedGridSize()) , _imageSize(hyperion->getLedGridSize())
, _image(_imageSize,QImage::Format_ARGB32_Premultiplied) , _image(_imageSize,QImage::Format_ARGB32_Premultiplied)
{ {
@ -49,21 +51,20 @@ Effect::~Effect()
bool Effect::isInterruptionRequested() bool Effect::isInterruptionRequested()
{ {
return _interupt || getRemaining() < 0; return _interupt || getRemaining() < ENDLESS;
} }
int Effect::getRemaining() int Effect::getRemaining() const
{ {
// determine the timeout // determine the timeout
int timeout = _timeout; int timeout = _timeout;
if (timeout > 0) if (timeout > 0)
{ {
timeout = _endTime - QDateTime::currentMSecsSinceEpoch(); timeout = static_cast<int>( _endTime - QDateTime::currentMSecsSinceEpoch());
return timeout; return timeout;
} }
return ENDLESS;
return timeout;
} }
void Effect::setModuleParameters() void Effect::setModuleParameters()

View File

@ -19,8 +19,6 @@
EffectEngine::EffectEngine(Hyperion * hyperion) EffectEngine::EffectEngine(Hyperion * hyperion)
: _hyperion(hyperion) : _hyperion(hyperion)
, _availableEffects()
, _activeEffects()
, _log(Logger::getInstance("EFFECTENGINE")) , _log(Logger::getInstance("EFFECTENGINE"))
, _effectFileHandler(EffectFileHandler::getInstance()) , _effectFileHandler(EffectFileHandler::getInstance())
{ {
@ -202,7 +200,7 @@ void EffectEngine::allChannelsCleared()
{ {
for (Effect * effect : _activeEffects) for (Effect * effect : _activeEffects)
{ {
if (effect->getPriority() != 254 && !effect->isInterruptionRequested()) if (effect->getPriority() != PriorityMuxer::BG_PRIORITY && !effect->isInterruptionRequested())
{ {
effect->requestInterruption(); effect->requestInterruption();
} }

View File

@ -121,9 +121,6 @@ PyMethodDef EffectModule::effectMethods[] = {
PyObject* EffectModule::wrapSetColor(PyObject *self, PyObject *args) PyObject* EffectModule::wrapSetColor(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
// check the number of arguments // check the number of arguments
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
if (argCount == 3) if (argCount == 3)
@ -182,9 +179,6 @@ PyObject* EffectModule::wrapSetColor(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapSetImage(PyObject *self, PyObject *args) PyObject* EffectModule::wrapSetImage(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
// bytearray of values // bytearray of values
int width, height; int width, height;
PyObject * bytearray = nullptr; PyObject * bytearray = nullptr;
@ -225,9 +219,6 @@ PyObject* EffectModule::wrapSetImage(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapGetImage(PyObject *self, PyObject *args) PyObject* EffectModule::wrapGetImage(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
QString file; QString file;
QBuffer buffer; QBuffer buffer;
QImageReader reader; QImageReader reader;
@ -309,9 +300,6 @@ PyObject* EffectModule::wrapAbort(PyObject *self, PyObject *)
PyObject* EffectModule::wrapImageShow(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageShow(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int imgId = -1; int imgId = -1;
bool argsOk = (argCount == 0); bool argsOk = (argCount == 0);
@ -352,9 +340,6 @@ PyObject* EffectModule::wrapImageShow(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageLinearGradient(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageLinearGradient(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
PyObject * bytearray = nullptr; PyObject * bytearray = nullptr;
int startRX = 0; int startRX = 0;
@ -422,9 +407,6 @@ PyObject* EffectModule::wrapImageLinearGradient(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageConicalGradient(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageConicalGradient(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
PyObject * bytearray = nullptr; PyObject * bytearray = nullptr;
int centerX, centerY, angle; int centerX, centerY, angle;
@ -491,9 +473,6 @@ PyObject* EffectModule::wrapImageConicalGradient(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageRadialGradient(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageRadialGradient(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
PyObject * bytearray = nullptr; PyObject * bytearray = nullptr;
int centerX, centerY, radius, focalX, focalY, focalRadius, spread; int centerX, centerY, radius, focalX, focalY, focalRadius, spread;
@ -572,9 +551,6 @@ PyObject* EffectModule::wrapImageRadialGradient(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageDrawPolygon(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageDrawPolygon(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
PyObject * bytearray = nullptr; PyObject * bytearray = nullptr;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
@ -633,9 +609,6 @@ PyObject* EffectModule::wrapImageDrawPolygon(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageDrawPie(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageDrawPie(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
PyObject * bytearray = nullptr; PyObject * bytearray = nullptr;
QString brush; QString brush;
@ -730,9 +703,6 @@ PyObject* EffectModule::wrapImageDrawPie(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageSolidFill(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageSolidFill(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int r, g, b; int r, g, b;
int a = 255; int a = 255;
@ -772,9 +742,6 @@ PyObject* EffectModule::wrapImageSolidFill(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageDrawLine(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageDrawLine(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int r, g, b; int r, g, b;
int a = 255; int a = 255;
@ -813,9 +780,6 @@ PyObject* EffectModule::wrapImageDrawLine(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageDrawPoint(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageDrawPoint(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int r, g, b, x, y; int r, g, b, x, y;
int a = 255; int a = 255;
@ -849,9 +813,6 @@ PyObject* EffectModule::wrapImageDrawPoint(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageDrawRect(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageDrawRect(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int r, g, b; int r, g, b;
int a = 255; int a = 255;
@ -891,9 +852,6 @@ PyObject* EffectModule::wrapImageDrawRect(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageSetPixel(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageSetPixel(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int r, g, b, x, y; int r, g, b, x, y;
@ -909,9 +867,6 @@ PyObject* EffectModule::wrapImageSetPixel(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageGetPixel(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageGetPixel(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int x, y; int x, y;
@ -925,9 +880,6 @@ PyObject* EffectModule::wrapImageGetPixel(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageSave(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageSave(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
QImage img(getEffect()->_image.copy()); QImage img(getEffect()->_image.copy());
getEffect()->_imageStack.append(img); getEffect()->_imageStack.append(img);
@ -936,9 +888,6 @@ PyObject* EffectModule::wrapImageSave(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageMinSize(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageMinSize(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int w, h; int w, h;
int width = getEffect()->_imageSize.width(); int width = getEffect()->_imageSize.width();
@ -961,25 +910,16 @@ PyObject* EffectModule::wrapImageMinSize(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageWidth(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageWidth(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
return Py_BuildValue("i", getEffect()->_imageSize.width()); return Py_BuildValue("i", getEffect()->_imageSize.width());
} }
PyObject* EffectModule::wrapImageHeight(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageHeight(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
return Py_BuildValue("i", getEffect()->_imageSize.height()); return Py_BuildValue("i", getEffect()->_imageSize.height());
} }
PyObject* EffectModule::wrapImageCRotate(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageCRotate(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
int angle; int angle;
@ -994,9 +934,6 @@ PyObject* EffectModule::wrapImageCRotate(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageCOffset(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageCOffset(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int offsetX = 0; int offsetX = 0;
int offsetY = 0; int offsetY = 0;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
@ -1012,9 +949,6 @@ PyObject* EffectModule::wrapImageCOffset(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageCShear(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageCShear(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
int sh,sv; int sh,sv;
int argCount = PyTuple_Size(args); int argCount = PyTuple_Size(args);
@ -1028,9 +962,6 @@ PyObject* EffectModule::wrapImageCShear(PyObject *self, PyObject *args)
PyObject* EffectModule::wrapImageResetT(PyObject *self, PyObject *args) PyObject* EffectModule::wrapImageResetT(PyObject *self, PyObject *args)
{ {
// check if we have aborted already
if (getEffect()->isInterruptionRequested()) Py_RETURN_NONE;
getEffect()->_painter->resetTransform(); getEffect()->_painter->resetTransform();
Py_RETURN_NONE; Py_RETURN_NONE;
} }

View File

@ -13,6 +13,8 @@
// utils // utils
#include <utils/Logger.h> #include <utils/Logger.h>
const int PriorityMuxer::FG_PRIORITY = 1;
const int PriorityMuxer::BG_PRIORITY = 254;
const int PriorityMuxer::LOWEST_PRIORITY = std::numeric_limits<uint8_t>::max(); const int PriorityMuxer::LOWEST_PRIORITY = std::numeric_limits<uint8_t>::max();
PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent) PriorityMuxer::PriorityMuxer(int ledCount, QObject * parent)
@ -322,7 +324,7 @@ void PriorityMuxer::setCurrentTime()
newPriority = qMin(newPriority, infoIt->priority); newPriority = qMin(newPriority, infoIt->priority);
// call timeTrigger when effect or color is running with timeout > 0, blacklist prio 255 // call timeTrigger when effect or color is running with timeout > 0, blacklist prio 255
if(infoIt->priority < 254 && infoIt->timeoutTime_ms > 0 && (infoIt->componentId == hyperion::COMP_EFFECT || infoIt->componentId == hyperion::COMP_COLOR || infoIt->componentId == hyperion::COMP_IMAGE)) if(infoIt->priority < BG_PRIORITY && infoIt->timeoutTime_ms > 0 && (infoIt->componentId == hyperion::COMP_EFFECT || infoIt->componentId == hyperion::COMP_COLOR || infoIt->componentId == hyperion::COMP_IMAGE))
emit signalTimeTrigger(); // as signal to prevent Threading issues emit signalTimeTrigger(); // as signal to prevent Threading issues
++infoIt; ++infoIt;

View File

@ -15,7 +15,9 @@
#include <utils/ColorRgb.h> #include <utils/ColorRgb.h>
#include <effectengine/EffectDefinition.h> #include <effectengine/EffectDefinition.h>
#include <effectengine/Effect.h>
#include <webserver/WebServer.h> #include <webserver/WebServer.h>
#include <hyperion/PriorityMuxer.h>
#include "hyperiond.h" #include "hyperiond.h"
#include "systray.h" #include "systray.h"
@ -165,7 +167,7 @@ void SysTray::closeEvent(QCloseEvent *event)
event->ignore(); event->ignore();
} }
void SysTray::settings() void SysTray::settings() const
{ {
#ifndef _WIN32 #ifndef _WIN32
// Hide error messages when opening webbrowser // Hide error messages when opening webbrowser
@ -201,7 +203,7 @@ void SysTray::settings()
void SysTray::setEffect() void SysTray::setEffect()
{ {
QString efxName = qobject_cast<QAction*>(sender())->text(); QString efxName = qobject_cast<QAction*>(sender())->text();
_hyperion->setEffect(efxName, 1); _hyperion->setEffect(efxName, PriorityMuxer::FG_PRIORITY, Effect::ENDLESS);
} }
void SysTray::clearEfxColor() void SysTray::clearEfxColor()
@ -209,7 +211,7 @@ void SysTray::clearEfxColor()
_hyperion->clear(1); _hyperion->clear(1);
} }
void SysTray::handleInstanceStateChange(InstanceState state, quint8 instance, const QString& name) void SysTray::handleInstanceStateChange(InstanceState state, quint8 instance, const QString& /*name*/)
{ {
switch(state){ switch(state){
case InstanceState::H_STARTED: case InstanceState::H_STARTED:

View File

@ -24,7 +24,7 @@ public slots:
void showColorDialog(); void showColorDialog();
void setColor(const QColor & color); void setColor(const QColor & color);
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
void settings(); void settings() const;
void setEffect(); void setEffect();
void clearEfxColor(); void clearEfxColor();
void setAutorunState(); void setAutorunState();