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:
@@ -5,7 +5,7 @@
|
||||
{
|
||||
"color-end": [ 255, 255, 255 ],
|
||||
"color-start": [ 50, 50, 50 ],
|
||||
"fade-in-time" : 4000,
|
||||
"fade-in-time" : 3000,
|
||||
"fade-out-time" : 1000,
|
||||
"color-start-time" : 50,
|
||||
"color-end-time" : 250,
|
||||
|
@@ -9,31 +9,32 @@ colorStartTime = float(hyperion.args.get('color-start-time', 1000)) / 1000
|
||||
colorEndTime = float(hyperion.args.get('color-end-time', 1000)) / 1000
|
||||
repeat = hyperion.args.get('repeat-count', 0)
|
||||
maintainEndCol = hyperion.args.get('maintain-end-color', True)
|
||||
minStepTime = 0.03
|
||||
minStepTime = float(hyperion.latchTime)/1000.0
|
||||
currentR = currentG = currentB = 0
|
||||
|
||||
# create color table for fading from start to end color
|
||||
steps = float(abs(max((colorEnd[0] - colorStart[0]),max((colorEnd[1] - colorStart[1]),(colorEnd[2] - colorStart[2])))))
|
||||
color_step = (
|
||||
(colorEnd[0] - colorStart[0]) / 256.0,
|
||||
(colorEnd[1] - colorStart[1]) / 256.0,
|
||||
(colorEnd[2] - colorStart[2]) / 256.0
|
||||
(colorEnd[0] - colorStart[0]) / steps,
|
||||
(colorEnd[1] - colorStart[1]) / steps,
|
||||
(colorEnd[2] - colorStart[2]) / steps
|
||||
)
|
||||
|
||||
calcChannel = lambda i: min(max(int(colorStart[i] + color_step[i]*step),0),255)
|
||||
calcChannel = lambda i: min(max(int(round(colorStart[i] + color_step[i]*step)),0), colorEnd[i] if colorStart[i] < colorEnd[i] else colorStart[i])
|
||||
colors = []
|
||||
for step in range(256):
|
||||
for step in range(int(steps)+1):
|
||||
colors.append( (calcChannel(0),calcChannel(1),calcChannel(2)) )
|
||||
|
||||
# calculate timings
|
||||
if fadeInTime>0:
|
||||
incrementIn = max(1,int(round(256.0 / (fadeInTime / minStepTime) )))
|
||||
sleepTimeIn = fadeInTime / (256.0 / incrementIn)
|
||||
incrementIn = max(1,int(round(steps / (fadeInTime / minStepTime) )))
|
||||
sleepTimeIn = fadeInTime / (steps / incrementIn)
|
||||
else:
|
||||
incrementIn = sleepTimeIn = 1
|
||||
|
||||
if fadeOutTime>0:
|
||||
incrementOut = max(1,int(round(256.0 / (fadeOutTime / minStepTime) )))
|
||||
sleepTimeOut = fadeOutTime / (256.0 / incrementOut)
|
||||
incrementOut = max(1,int(round(steps / (fadeOutTime / minStepTime) )))
|
||||
sleepTimeOut = fadeOutTime / (steps / incrementOut)
|
||||
else:
|
||||
incrementOut = sleepTimeOut = 1
|
||||
|
||||
@@ -50,7 +51,8 @@ repeatCounter = 1
|
||||
while not hyperion.abort():
|
||||
# fade in
|
||||
if fadeInTime > 0:
|
||||
for step in range(0,256,incrementIn):
|
||||
setColor( colors[0][0],colors[0][1],colors[0][2] )
|
||||
for step in range(0,int(steps)+1,incrementIn):
|
||||
if hyperion.abort(): break
|
||||
setColor( colors[step][0],colors[step][1],colors[step][2] )
|
||||
time.sleep(sleepTimeIn)
|
||||
@@ -58,29 +60,31 @@ while not hyperion.abort():
|
||||
# end color
|
||||
t = 0.0
|
||||
while t<colorStartTime and not hyperion.abort():
|
||||
setColor( colors[255][0],colors[255][1],colors[255][2] )
|
||||
time.sleep(0.01)
|
||||
t += 0.01
|
||||
setColor( colors[int(steps)][0],colors[int(steps)][1],colors[int(steps)][2] )
|
||||
time.sleep(minStepTime)
|
||||
t += minStepTime
|
||||
|
||||
# fade out
|
||||
if fadeOutTime > 0:
|
||||
for step in range(255,-1,-incrementOut):
|
||||
setColor( colors[int(steps)][0],colors[int(steps)][1],colors[int(steps)][2] )
|
||||
for step in range(int(steps),-1,-incrementOut):
|
||||
if hyperion.abort(): break
|
||||
hyperion.setColor( colors[step][0],colors[step][1],colors[step][2] )
|
||||
setColor( colors[step][0],colors[step][1],colors[step][2] )
|
||||
time.sleep(sleepTimeOut)
|
||||
|
||||
# start color
|
||||
t = 0.0
|
||||
while t<colorEndTime and not hyperion.abort():
|
||||
setColor( colors[0][0],colors[0][1],colors[0][2] )
|
||||
time.sleep(0.01)
|
||||
t += 0.01
|
||||
time.sleep(minStepTime)
|
||||
t += minStepTime
|
||||
|
||||
# repeat
|
||||
if repeat > 0 and repeatCounter >= repeat : break
|
||||
repeatCounter += 1
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
# maintain end color until effect end
|
||||
while not hyperion.abort() and maintainEndCol:
|
||||
hyperion.setColor( currentR, currentG, currentB )
|
||||
|
@@ -51,4 +51,4 @@ while not hyperion.abort():
|
||||
hyperion.imageCanonicalGradient(centerX, centerY, angleS, colorsSecond)
|
||||
|
||||
hyperion.imageShow()
|
||||
time.sleep(0.01 )
|
||||
time.sleep(0.5 )
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import hyperion, time
|
||||
import hyperion, time, math
|
||||
|
||||
# Get the parameters
|
||||
rotationTime = float(hyperion.args.get('rotation-time', 3.0))
|
||||
@@ -6,12 +6,18 @@ reverse = bool(hyperion.args.get('reverse', False))
|
||||
centerX = float(hyperion.args.get('center_x', 0.5))
|
||||
centerY = float(hyperion.args.get('center_y', 0.5))
|
||||
|
||||
minStepTime = float(hyperion.latchTime)/1000.0
|
||||
sleepTime = max(0.1, rotationTime) / 360
|
||||
angle = 0
|
||||
centerX = int(round(float(hyperion.imageWidth)*centerX))
|
||||
centerY = int(round(float(hyperion.imageHeight)*centerY))
|
||||
increment = -1 if reverse else 1
|
||||
|
||||
# adapt sleeptime to hardware
|
||||
if minStepTime > sleepTime:
|
||||
increment *= int(math.ceil(minStepTime / sleepTime))
|
||||
sleepTime = minStepTime
|
||||
|
||||
# table of stop colors for rainbow gradient, first is the position, next rgb, all values 0-255
|
||||
rainbowColors = bytearray([
|
||||
0 ,255,0 ,0, 255,
|
||||
|
@@ -3,7 +3,7 @@
|
||||
"script" : "random.py",
|
||||
"args" :
|
||||
{
|
||||
"speed" : 1.0,
|
||||
"speed" : 750,
|
||||
"saturation" : 1.0
|
||||
}
|
||||
}
|
||||
|
@@ -1,21 +1,46 @@
|
||||
import hyperion, time, colorsys, random
|
||||
import hyperion, time, colorsys, random, math
|
||||
|
||||
# get args
|
||||
sleepTime = float(hyperion.args.get('speed', 1.0))
|
||||
sleepTime = float(hyperion.args.get('speed', 1.0))/1000.0
|
||||
saturation = float(hyperion.args.get('saturation', 1.0))
|
||||
ledData = bytearray()
|
||||
ledDataBuf = bytearray()
|
||||
color_step = []
|
||||
minStepTime= float(hyperion.latchTime)/1000.0
|
||||
fadeSteps = min(256.0, math.floor(sleepTime/minStepTime))
|
||||
|
||||
# Initialize the led data
|
||||
for i in range(hyperion.ledCount):
|
||||
ledData += bytearray((0,0,0))
|
||||
ledDataBuf += bytearray((0,0,0))
|
||||
color_step.append((0.0,0.0,0.0))
|
||||
|
||||
# Start the write data loop
|
||||
while not hyperion.abort():
|
||||
hyperion.setColor(ledData)
|
||||
for i in range(len(ledData)):
|
||||
ledDataBuf[i] = ledData[i]
|
||||
|
||||
for i in range(hyperion.ledCount):
|
||||
if random.randrange(10) == 1:
|
||||
rgb = colorsys.hsv_to_rgb(random.random(), saturation, random.random())
|
||||
ledData[i*3 ] = int(255*rgb[0])
|
||||
ledData[i*3+1] = int(255*rgb[1])
|
||||
ledData[i*3+2] = int(255*rgb[2])
|
||||
time.sleep(sleepTime)
|
||||
|
||||
color_step[i] = (
|
||||
(ledData[i*3 ]-ledDataBuf[i*3 ])/fadeSteps,
|
||||
(ledData[i*3+1]-ledDataBuf[i*3+1])/fadeSteps,
|
||||
(ledData[i*3+2]-ledDataBuf[i*3+2])/fadeSteps)
|
||||
else:
|
||||
color_step[i] = (0.0,0.0,0.0)
|
||||
|
||||
for step in range(int(fadeSteps)):
|
||||
for i in range(hyperion.ledCount):
|
||||
ledDataBuf[i*3 ] = min(max(int(ledDataBuf[i*3 ] + color_step[i][0]*float(step)),0),ledData[i*3 ])
|
||||
ledDataBuf[i*3+1] = min(max(int(ledDataBuf[i*3+1] + color_step[i][1]*float(step)),0),ledData[i*3+1])
|
||||
ledDataBuf[i*3+2] = min(max(int(ledDataBuf[i*3+2] + color_step[i][2]*float(step)),0),ledData[i*3+2])
|
||||
|
||||
hyperion.setColor(ledDataBuf)
|
||||
time.sleep(sleepTime/fadeSteps)
|
||||
hyperion.setColor(ledData)
|
||||
|
||||
|
@@ -7,8 +7,9 @@
|
||||
"speed": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_speed_title",
|
||||
"default": 1.0,
|
||||
"minimum" : 0.0,
|
||||
"default": 1000,
|
||||
"minimum" : 10,
|
||||
"append" : "edt_append_ms",
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"saturation": {
|
||||
|
@@ -33,10 +33,11 @@
|
||||
"propertyOrder" : 4
|
||||
},
|
||||
"speed": {
|
||||
"type": "number",
|
||||
"type": "integer",
|
||||
"title":"edt_eff_speed_title",
|
||||
"default": 1.0,
|
||||
"minimum" : 0.1,
|
||||
"default": 100,
|
||||
"minimum" : 10,
|
||||
"append" : "edt_append_ms",
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"random": {
|
||||
|
@@ -5,11 +5,47 @@
|
||||
"required":true,
|
||||
"properties":{
|
||||
"sleepTime": {
|
||||
"type": "number",
|
||||
"type": "integer",
|
||||
"title":"edt_eff_sleeptime_title",
|
||||
"default": 1.0,
|
||||
"minimum" : 0.1,
|
||||
"default": 1000,
|
||||
"minimum" : 100,
|
||||
"append" : "edt_append_ms",
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"length": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_length_title",
|
||||
"default": 1,
|
||||
"minimum" : 1,
|
||||
"propertyOrder" : 2
|
||||
},
|
||||
"color1": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"format":"colorpicker",
|
||||
"default": [255,255,255],
|
||||
"items" : {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder" : 3
|
||||
},
|
||||
"color2": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_color_title",
|
||||
"format":"colorpicker",
|
||||
"default": [255,0,0],
|
||||
"items" : {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder" : 4
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
@@ -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)
|
||||
|
@@ -7,7 +7,7 @@
|
||||
"max_len" : 7,
|
||||
"height" : 8,
|
||||
"trails": 3,
|
||||
"speed" : 1.0,
|
||||
"speed" : 30,
|
||||
"random" : false,
|
||||
"color" : [255, 255, 255]
|
||||
}
|
||||
|
@@ -7,93 +7,91 @@ min_len = int(hyperion.args.get('min_len', 3))
|
||||
max_len = int(hyperion.args.get('max_len', 3))
|
||||
height = int(hyperion.args.get('height', 8))
|
||||
trails = int(hyperion.args.get('int', 8))
|
||||
sleepTime = float(hyperion.args.get('speed', 1.0)) * 0.01
|
||||
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))
|
||||
whidth = hyperion.ledCount / height
|
||||
|
||||
class trail:
|
||||
def __init__(self):
|
||||
return
|
||||
def __init__(self):
|
||||
return
|
||||
|
||||
def start(self, x, y, step, color, _len, _h):
|
||||
self.pos = 0.0
|
||||
self.step = step
|
||||
self.h = _h
|
||||
self.x = x
|
||||
self.data = []
|
||||
brigtness = color[2]
|
||||
step_brigtness = color[2] / _len
|
||||
for i in range(0, _len):
|
||||
rgb = colorsys.hsv_to_rgb(color[0], color[1], brigtness)
|
||||
self.data.insert(0, (int(255*rgb[0]), int(255*rgb[1]), int(255*rgb[2])))
|
||||
brigtness -= step_brigtness
|
||||
def start(self, x, y, step, color, _len, _h):
|
||||
self.pos = 0.0
|
||||
self.step = step
|
||||
self.h = _h
|
||||
self.x = x
|
||||
self.data = []
|
||||
brigtness = color[2]
|
||||
step_brigtness = color[2] / _len
|
||||
for i in range(0, _len):
|
||||
rgb = colorsys.hsv_to_rgb(color[0], color[1], brigtness)
|
||||
self.data.insert(0, (int(255*rgb[0]), int(255*rgb[1]), int(255*rgb[2])))
|
||||
brigtness -= step_brigtness
|
||||
|
||||
self.data.extend([(0,0,0)]*(_h-y))
|
||||
if len(self.data) < _h:
|
||||
for i in range (_h-len(self.data)):
|
||||
self.data.insert(0, (0,0,0))
|
||||
self.data.extend([(0,0,0)]*(_h-y))
|
||||
if len(self.data) < _h:
|
||||
for i in range (_h-len(self.data)):
|
||||
self.data.insert(0, (0,0,0))
|
||||
|
||||
def getdata(self):
|
||||
self.pos += self.step
|
||||
if self.pos > 1.0:
|
||||
self.pos = 0.0
|
||||
self.data.pop()
|
||||
self.data.insert(0, (0,0,0))
|
||||
return self.x, self.data[-self.h:], all(x == self.data[0] for x in self.data)
|
||||
def getdata(self):
|
||||
self.pos += self.step
|
||||
if self.pos > 1.0:
|
||||
self.pos = 0.0
|
||||
self.data.pop()
|
||||
self.data.insert(0, (0,0,0))
|
||||
return self.x, self.data[-self.h:], all(x == self.data[0] for x in self.data)
|
||||
|
||||
tr = []
|
||||
|
||||
for i in range(trails):
|
||||
r = {
|
||||
'exec': trail()
|
||||
}
|
||||
r = {'exec': trail()}
|
||||
|
||||
if randomise:
|
||||
col = (random.uniform(0.1, 1.0), random.uniform(0.1, 1.0), random.uniform(0.1, 1.0))
|
||||
else:
|
||||
col = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
|
||||
if randomise:
|
||||
col = (random.uniform(0.1, 1.0), random.uniform(0.1, 1.0), random.uniform(0.1, 1.0))
|
||||
else:
|
||||
col = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
|
||||
|
||||
r['exec'].start(
|
||||
random.randint(0, whidth),
|
||||
random.randint(0, height),
|
||||
random.uniform(0.2, 0.8),
|
||||
col,
|
||||
random.randint(min_len, max_len),
|
||||
height
|
||||
)
|
||||
tr.append(r)
|
||||
r['exec'].start(
|
||||
random.randint(0, whidth),
|
||||
random.randint(0, height),
|
||||
random.uniform(0.2, 0.8),
|
||||
col,
|
||||
random.randint(min_len, max_len),
|
||||
height
|
||||
)
|
||||
tr.append(r)
|
||||
|
||||
# Start the write data loop
|
||||
while not hyperion.abort():
|
||||
ledData = bytearray()
|
||||
ledData = bytearray()
|
||||
|
||||
for r in tr:
|
||||
r['x'], r['data'], c = r['exec'].getdata()
|
||||
if c:
|
||||
if randomise:
|
||||
col = (random.uniform(0.1, 1.0), random.uniform(0.1, 1.0), random.uniform(0.1, 1.0))
|
||||
else:
|
||||
col = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
|
||||
for r in tr:
|
||||
r['x'], r['data'], c = r['exec'].getdata()
|
||||
if c:
|
||||
if randomise:
|
||||
col = (random.uniform(0.1, 1.0), random.uniform(0.1, 1.0), random.uniform(0.1, 1.0))
|
||||
else:
|
||||
col = colorsys.rgb_to_hsv(color[0]/255.0, color[1]/255.0, color[2]/255.0)
|
||||
|
||||
r['exec'].start(
|
||||
random.randint(0, whidth),
|
||||
random.randint(0, height),
|
||||
random.uniform(0.2, 0.8),
|
||||
col,
|
||||
random.randint(min_len, max_len),
|
||||
height
|
||||
)
|
||||
r['exec'].start(
|
||||
random.randint(0, whidth),
|
||||
random.randint(0, height),
|
||||
random.uniform(0.2, 0.8),
|
||||
col,
|
||||
random.randint(min_len, max_len),
|
||||
height
|
||||
)
|
||||
|
||||
for y in range(0, height):
|
||||
for x in range(0, whidth):
|
||||
for r in tr:
|
||||
if x == r['x']:
|
||||
led = bytearray(r['data'][y])
|
||||
break
|
||||
led = bytearray((0,0,0))
|
||||
ledData += led
|
||||
for y in range(0, height):
|
||||
for x in range(0, whidth):
|
||||
for r in tr:
|
||||
if x == r['x']:
|
||||
led = bytearray(r['data'][y])
|
||||
break
|
||||
led = bytearray((0,0,0))
|
||||
ledData += led
|
||||
|
||||
hyperion.setImage(whidth,height,ledData)
|
||||
time.sleep(sleepTime)
|
||||
hyperion.setImage(whidth,height,ledData)
|
||||
time.sleep(sleepTime)
|
||||
|
||||
|
@@ -7,7 +7,7 @@
|
||||
"max_len" : 6,
|
||||
"height" : 8,
|
||||
"trails": 16,
|
||||
"speed" : 8.0,
|
||||
"speed" : 50,
|
||||
"random" : true,
|
||||
"color" : [255, 255, 255]
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@
|
||||
"script" : "x-mas.py",
|
||||
"args" :
|
||||
{
|
||||
"sleepTime" : 0.75
|
||||
"sleepTime" : 750,
|
||||
"color1" : [255,255,255],
|
||||
"color2" : [255,0,0],
|
||||
"length" : 1
|
||||
}
|
||||
}
|
||||
|
@@ -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