mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
add limit for write to leddevice (#432)
* add limit for write to leddevice * add to default config * add i18n * extend xmas effect * fix indention * add check for minimum brightness * adapt effects to fading and new minWriteTime * remove old latchTime rename minimumWriteTime to latchTime make it as dev specific option * set default for rewriteTime to 1s pause smoothing on color too * reenable smoothing for color - it looks nicer :-) * fix timeout timer
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
import hyperion
|
||||
import time
|
||||
import colorsys
|
||||
import random
|
||||
import hyperion, time, random, math
|
||||
|
||||
# Initialize the led data
|
||||
ledData = bytearray()
|
||||
for i in range(hyperion.ledCount):
|
||||
ledData += bytearray((0,0,0))
|
||||
|
||||
sleepTime = float(hyperion.args.get('speed', 1.0)) * 0.004
|
||||
sleepTime = float(hyperion.args.get('speed', 1.0)) * 0.004
|
||||
minStepTime = float(hyperion.latchTime)/1000.0
|
||||
factor = 1 if sleepTime > minStepTime else int(math.ceil(minStepTime/sleepTime))
|
||||
|
||||
runners = [
|
||||
{ "i":0, "pos":0, "c":0, "step":9 , "lvl":255},
|
||||
{ "i":1, "pos":0, "c":0, "step":8 , "lvl":255},
|
||||
{ "i":2, "pos":0, "c":0, "step":7 , "lvl":255},
|
||||
{ "i":0, "pos":0, "c":0, "step":6 , "lvl":100},
|
||||
{ "i":1, "pos":0, "c":0, "step":5 , "lvl":100},
|
||||
{ "i":2, "pos":0, "c":0, "step":4, "lvl":100},
|
||||
{ "i":0, "pos":0, "c":0, "step":9, "lvl":255},
|
||||
{ "i":1, "pos":0, "c":0, "step":8, "lvl":255},
|
||||
{ "i":2, "pos":0, "c":0, "step":7, "lvl":255},
|
||||
{ "i":0, "pos":0, "c":0, "step":6, "lvl":100},
|
||||
{ "i":1, "pos":0, "c":0, "step":5, "lvl":100},
|
||||
{ "i":2, "pos":0, "c":0, "step":4, "lvl":100},
|
||||
]
|
||||
|
||||
# Start the write data loop
|
||||
i = 0
|
||||
while not hyperion.abort():
|
||||
for r in runners:
|
||||
if r["c"] == 0:
|
||||
@@ -30,5 +30,9 @@ while not hyperion.abort():
|
||||
else:
|
||||
r["c"] -= 1
|
||||
|
||||
hyperion.setColor(ledData)
|
||||
i += 1
|
||||
if i % factor == 0:
|
||||
hyperion.setColor(ledData)
|
||||
i = 0
|
||||
|
||||
time.sleep(sleepTime)
|
||||
|
Reference in New Issue
Block a user