mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Provide a lowest permissible interval time to effects and limit the update rate of selected effects
This commit is contained in:
@@ -13,6 +13,11 @@
|
||||
// python utils
|
||||
#include <python/PythonProgram.h>
|
||||
|
||||
// Constants
|
||||
namespace {
|
||||
int DEFAULT_MAX_UPDATE_RATE_HZ { 200 };
|
||||
} //End of constants
|
||||
|
||||
Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &script, const QString &name, const QJsonObject &args, const QString &imageData)
|
||||
: QThread()
|
||||
, _hyperion(hyperion)
|
||||
@@ -27,6 +32,7 @@ Effect::Effect(Hyperion *hyperion, int priority, int timeout, const QString &scr
|
||||
, _interupt(false)
|
||||
, _imageSize(hyperion->getLedGridSize())
|
||||
, _image(_imageSize,QImage::Format_ARGB32_Premultiplied)
|
||||
, _lowestUpdateIntervalInSeconds(1/static_cast<double>(DEFAULT_MAX_UPDATE_RATE_HZ))
|
||||
{
|
||||
_colors.resize(_hyperion->getLedCount());
|
||||
_colors.fill(ColorRgb::BLACK);
|
||||
|
@@ -123,6 +123,7 @@ PyMethodDef EffectModule::effectMethods[] = {
|
||||
{"imageCOffset" , EffectModule::wrapImageCOffset , METH_VARARGS, "Add offset to the coordinate system"},
|
||||
{"imageCShear" , EffectModule::wrapImageCShear , METH_VARARGS, "Shear of coordinate system by the given horizontal/vertical axis"},
|
||||
{"imageResetT" , EffectModule::wrapImageResetT , METH_NOARGS, "Resets all coords modifications (rotate,offset,shear)"},
|
||||
{"lowestUpdateInterval" , EffectModule::wrapLowestUpdateInterval , METH_NOARGS, "Gets the lowest permissible interval time in seconds"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -1045,3 +1046,10 @@ PyObject* EffectModule::wrapImageResetT(PyObject *self, PyObject *args)
|
||||
getEffect()->_painter->resetTransform();
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject* EffectModule::wrapLowestUpdateInterval(PyObject* self, PyObject* args)
|
||||
{
|
||||
qDebug() << "_lowestUpdateIntervalInSeconds: " << getEffect()->_lowestUpdateIntervalInSeconds;
|
||||
|
||||
return Py_BuildValue("d", getEffect()->_lowestUpdateIntervalInSeconds);
|
||||
}
|
||||
|
Reference in New Issue
Block a user