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:
parent
ee48f0c9b3
commit
fb434dc492
@ -20,6 +20,9 @@ brightness = float(hyperion.args.get('brightness', 100))/100.0
|
||||
|
||||
sleepTime = float(hyperion.args.get('sleepTime', 0.14))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
candles = hyperion.args.get('candles', "all")
|
||||
ledlist = hyperion.args.get('ledlist', "1")
|
||||
|
||||
|
@ -11,6 +11,10 @@ cropBottom = int(hyperion.args.get('cropBottom', 0))
|
||||
grayscale = bool(hyperion.args.get('grayscale', False))
|
||||
|
||||
sleepTime = 1./framesPerSecond
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
imageFrameList = []
|
||||
|
||||
if imageData:
|
||||
|
@ -4,6 +4,9 @@ import time
|
||||
# Get parameters
|
||||
sleepTime = float(hyperion.args.get('sleepTime', 0.5))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
def TestRgb( iteration ):
|
||||
|
||||
switcher = {
|
||||
|
@ -11,6 +11,9 @@ sleepTime = float(hyperion.args.get('sleepTime', 0.5))
|
||||
testleds = hyperion.args.get('testleds', "all")
|
||||
ledlist = hyperion.args.get('ledlist', "1")
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
testlist = ()
|
||||
if (testleds == "list") and (type(ledlist) is str):
|
||||
for s in ledlist.split(','):
|
||||
|
@ -6,6 +6,9 @@ width = hyperion.imageWidth()
|
||||
height = hyperion.imageHeight()
|
||||
sleepTime = float(hyperion.args.get('sleepTime', 0.2))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
def mapto(x, in_min, in_max, out_min, out_max):
|
||||
return float((x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min)
|
||||
|
||||
|
@ -4,8 +4,11 @@ import hyperion, time
|
||||
sleepTime = float(hyperion.args.get('speed', 1.5)) * 0.005
|
||||
whiteLevel = int(hyperion.args.get('whiteLevel', 0))
|
||||
lvl = int(hyperion.args.get('colorLevel', 220))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
# check value
|
||||
# check value
|
||||
whiteLevel = min( whiteLevel, 254 )
|
||||
lvl = min( lvl, 255 )
|
||||
|
||||
|
@ -21,6 +21,9 @@ height = 10
|
||||
|
||||
imageData = bytearray(height * width * (0,0,0))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
# Start the write data loop
|
||||
if initialBlink:
|
||||
for i in range(6):
|
||||
|
@ -8,6 +8,9 @@ saturation = float(hyperion.args.get('saturation', 100))/100.0
|
||||
color = list(hyperion.args.get('color', (255,255,255)))
|
||||
randomColor = bool(hyperion.args.get('random-color', False))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
# Check parameters
|
||||
rotationTime = max(0.1, rotationTime)
|
||||
|
||||
|
@ -22,7 +22,10 @@ def getPoint(rand = True ,x = 0.5, y = 0.5):
|
||||
def getSTime(rt, steps = 360):
|
||||
rt = float(rt)
|
||||
sleepTime = max(0.1, rt) / steps
|
||||
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
# adapt sleeptime to hardware
|
||||
minStepTime= float(hyperion.latchTime)/1000.0
|
||||
if minStepTime == 0: minStepTime = 0.001
|
||||
|
@ -10,6 +10,9 @@ minStepTime = float(hyperion.latchTime)/1000.0
|
||||
if minStepTime == 0: minStepTime = 0.001
|
||||
factor = 1 if sleepTime > minStepTime else int(math.ceil(minStepTime/sleepTime))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
runners = [
|
||||
{ "i":0, "pos":0, "c":0, "step":9, "lvl":255},
|
||||
{ "i":1, "pos":0, "c":0, "step":8, "lvl":255},
|
||||
|
@ -11,7 +11,10 @@ sleepTime = float(hyperion.args.get('speed', 1)) / 1000.0
|
||||
color = list(hyperion.args.get('color', (255,255,255)))
|
||||
randomise = bool(hyperion.args.get('random', False))
|
||||
iWidth = hyperion.imageWidth()
|
||||
iHeight = hyperion.imageHeight()
|
||||
iHeight = hyperion.imageHeight()
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
class trail:
|
||||
def __init__(self):
|
||||
|
@ -4,7 +4,10 @@ import hyperion, time
|
||||
sleepTime = float(hyperion.args.get('sleepTime', 1000))/1000.0
|
||||
length = hyperion.args.get('length', 1)
|
||||
color1 = hyperion.args.get('color1', (255,255,255))
|
||||
color2 = hyperion.args.get('color2', (255,0,0))
|
||||
color2 = hyperion.args.get('color2', (255,0,0))
|
||||
|
||||
# Limit update rate
|
||||
sleepTime = max(hyperion.lowestUpdateInterval(), sleepTime)
|
||||
|
||||
# Initialize the led data
|
||||
i = 0
|
||||
|
@ -103,4 +103,6 @@ private:
|
||||
QImage _image;
|
||||
QPainter *_painter;
|
||||
QVector<QImage> _imageStack;
|
||||
|
||||
double _lowestUpdateIntervalInSeconds;
|
||||
};
|
||||
|
@ -51,4 +51,5 @@ public:
|
||||
static PyObject* wrapImageCOffset (PyObject *self, PyObject *args);
|
||||
static PyObject* wrapImageCShear (PyObject *self, PyObject *args);
|
||||
static PyObject* wrapImageResetT (PyObject *self, PyObject *args);
|
||||
static PyObject* wrapLowestUpdateInterval (PyObject* self, PyObject* args);
|
||||
};
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user