Add LED test effect lightening up LEDs in sequence

This commit is contained in:
LordGrey 2023-10-13 23:36:41 +02:00
parent e954f2a12b
commit 3257879c22
4 changed files with 108 additions and 0 deletions

View File

@ -760,6 +760,8 @@
"edt_eff_ledlist": "LED List",
"edt_eff_ledtest_header": "LED Test",
"edt_eff_ledtest_header_desc": "Rotating output: Red, Green, Blue, White, Black",
"edt_eff_ledtest_seq_header": "LED Test - Sequence",
"edt_eff_ledtest_seq_header_desc": "Light up the LEDs in sequence",
"edt_eff_length": "Length",
"edt_eff_lightclock_header": "Light Clock",
"edt_eff_lightclock_header_desc": "A real clock as light! Adjust the colors of hours, minute, seconds. A optional 3/6/9/12 o'clock marker is also available. In case the clock is wrong, you need to check your system clock.",

11
effects/ledtest-seq.json Normal file
View File

@ -0,0 +1,11 @@
{
"name" : "Led Test - Sequence",
"script" : "ledtest-seq.py",
"args" :
{
"sleepTime" : 0.5,
"smoothing-custom-settings" : false,
"smoothing-time_ms" : 500,
"smoothing-updateFrequency" : 20.0
}
}

39
effects/ledtest-seq.py Normal file
View File

@ -0,0 +1,39 @@
import hyperion
import time
# Get parameters
sleepTime = float(hyperion.args.get('sleepTime', 0.5))
def TestRgb( iteration ):
switcher = {
0: (255, 0, 0),
1: (0, 255, 0),
2: (0, 0, 255),
}
return switcher.get(iteration, (127,127,127) )
ledData = bytearray(hyperion.ledCount * (0,0,0) )
i = 0
while not hyperion.abort():
if i < hyperion.ledCount:
j = i % 3
rgb = TestRgb( j )
ledData[3*i+0] = rgb[0]
ledData[3*i+1] = rgb[1]
ledData[3*i+2] = rgb[2]
i += 1
else:
if i == hyperion.ledCount:
ledData = bytearray(hyperion.ledCount * (0,0,0) )
i += 1
else:
i = 0
hyperion.setColor (ledData)
time.sleep(sleepTime)

View File

@ -0,0 +1,56 @@
{
"type":"object",
"script" : "ledtest-seq.py",
"title":"edt_eff_ledtest_seq_header",
"required":true,
"properties":{
"sleepTime": {
"type": "number",
"title":"edt_eff_sleeptime",
"default": 0.5,
"minimum" : 0.01,
"maximum": 1,
"step": 0.01,
"append" : "edt_append_s",
"propertyOrder" : 1
},
"smoothing-custom-settings" :
{
"type" : "boolean",
"title" : "edt_eff_smooth_custom",
"default" : false,
"propertyOrder" : 2
},
"smoothing-time_ms" :
{
"type" : "integer",
"title" : "edt_eff_smooth_time_ms",
"minimum" : 25,
"maximum": 600,
"default" : 200,
"append" : "edt_append_ms",
"options": {
"dependencies": {
"smoothing-custom-settings": true
}
},
"propertyOrder" : 3
},
"smoothing-updateFrequency" :
{
"type" : "number",
"title" : "edt_eff_smooth_updateFrequency",
"minimum" : 1.0,
"maximum" : 100.0,
"default" : 25.0,
"append" : "edt_append_hz",
"options": {
"dependencies": {
"smoothing-custom-settings": true
}
},
"propertyOrder" : 4
}
},
"additionalProperties": false
}