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,26 +1,30 @@
|
||||
import hyperion, time, colorsys
|
||||
|
||||
# Get the parameters
|
||||
sleepTime = float(hyperion.args.get('sleepTime', 1.0))
|
||||
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))
|
||||
|
||||
# Initialize the led data
|
||||
i = 0
|
||||
ledDataOdd = bytearray()
|
||||
for i in range(hyperion.ledCount):
|
||||
if i%2 == 0:
|
||||
ledDataOdd += bytearray((int(255), int(0), int(0)))
|
||||
else:
|
||||
ledDataOdd += bytearray((int(255), int(255), int(255)))
|
||||
|
||||
ledDataEven = bytearray()
|
||||
for i in range(hyperion.ledCount):
|
||||
if i%2 == 0:
|
||||
ledDataEven += bytearray((int(255), int(255), int(255)))
|
||||
else:
|
||||
ledDataEven += bytearray((int(255), int(0), int(0)))
|
||||
while i < hyperion.ledCount:
|
||||
for l in range(length):
|
||||
if i<hyperion.ledCount:
|
||||
ledDataOdd += bytearray((int(color1[0]), int(color1[1]), int(color1[2])))
|
||||
i += 1
|
||||
|
||||
for l in range(length):
|
||||
if i<hyperion.ledCount:
|
||||
ledDataOdd += bytearray((int(color2[0]), int(color2[1]), int(color2[2])))
|
||||
i += 1
|
||||
|
||||
ledDataEven = ledDataOdd[3*length:] + ledDataOdd[0:3*length]
|
||||
|
||||
# Start the write data loop
|
||||
while not hyperion.abort():
|
||||
hyperion.setColor(ledDataOdd)
|
||||
time.sleep(sleepTime)
|
||||
hyperion.setColor(ledDataEven)
|
||||
time.sleep(sleepTime)
|
||||
time.sleep(sleepTime)
|
||||
|
Reference in New Issue
Block a user