Added parameter value checks to effects
This commit is contained in:
parent
4bc2920c04
commit
daf5d46862
|
@ -6,6 +6,10 @@ import colorsys
|
|||
speed = hyperion.args.get('speed', 1.0)
|
||||
fadeFactor = hyperion.args.get('fadeFactor', 0.7)
|
||||
|
||||
# Check parameters
|
||||
speed = max(0.0001, speed)
|
||||
fadeFactor = max(0.0, min(fadeFactor, 1.0))
|
||||
|
||||
# Initialize the led data
|
||||
width = 25
|
||||
imageData = bytearray(width * (0,0,0))
|
||||
|
|
|
@ -8,6 +8,11 @@ brightness = hyperion.args.get('brightness', 1.0)
|
|||
saturation = hyperion.args.get('saturation', 1.0)
|
||||
reverse = hyperion.args.get('reverse', False)
|
||||
|
||||
# Check parameters
|
||||
rotationTime = max(0.1, rotationTime)
|
||||
brightness = max(0.0, min(brightness, 1.0))
|
||||
saturation = max(0.0, min(saturation, 1.0))
|
||||
|
||||
# Calculate the sleep time and hue increment
|
||||
sleepTime = 0.1
|
||||
hueIncrement = sleepTime / rotationTime
|
||||
|
|
|
@ -8,6 +8,11 @@ brightness = hyperion.args.get('brightness', 1.0)
|
|||
saturation = hyperion.args.get('saturation', 1.0)
|
||||
reverse = hyperion.args.get('reverse', False)
|
||||
|
||||
# Check parameters
|
||||
rotationTime = max(0.1, rotationTime)
|
||||
brightness = max(0.0, min(brightness, 1.0))
|
||||
saturation = max(0.0, min(saturation, 1.0))
|
||||
|
||||
# Initialize the led data
|
||||
ledData = bytearray()
|
||||
for i in range(hyperion.ledCount):
|
||||
|
|
Loading…
Reference in New Issue