mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
ledConfig in config, report creation and upload (#398)
* update effects * fix * try * . * Update clock.py * Update clock.py * upd * impl ledConfig * upd * fix * update * update js * fix pacman * change order of priorities
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name" : "Clock",
|
||||
"script" : "clock.py",
|
||||
"args" :
|
||||
{
|
||||
"offset" : 0,
|
||||
"hour-margin" : 2,
|
||||
"minute-margin" : 1,
|
||||
"second-margin" : 0,
|
||||
"hour-color" : [255, 0, 0],
|
||||
"minute-color" : [0, 255, 0],
|
||||
"second-color" : [0, 0, 255]
|
||||
}
|
||||
}
|
@@ -7,11 +7,10 @@ def myRange(index, margin):
|
||||
|
||||
""" Define some variables """
|
||||
sleepTime = 1
|
||||
markers = [0, 13, 25, 38]
|
||||
|
||||
ledCount = hyperion.ledCount
|
||||
|
||||
offset = hyperion.args.get('offset', 0)
|
||||
direction = bool(hyperion.args.get('direction', False))
|
||||
|
||||
hourMargin = hyperion.args.get('hour-margin', 2)
|
||||
minuteMargin = hyperion.args.get('minute-margin', 1)
|
||||
@@ -21,6 +20,11 @@ hourColor = hyperion.args.get('hour-color', (255,0,0))
|
||||
minuteColor = hyperion.args.get('minute-color', (0,255,0))
|
||||
secondColor = hyperion.args.get('second-color', (0,0,255))
|
||||
|
||||
markerColor = hyperion.args.get('marker-color', (255,255,255))
|
||||
|
||||
marker = ledCount/4
|
||||
markers = (0+offset, int(marker + offset) % ledCount, int(2*marker + offset) % ledCount, int(3*marker + offset) % ledCount)
|
||||
|
||||
""" The effect loop """
|
||||
while not hyperion.abort():
|
||||
|
||||
@@ -32,17 +36,18 @@ while not hyperion.abort():
|
||||
m = now.minute
|
||||
s = now.second
|
||||
|
||||
led_hour = ((h*4 + h//3%2 + h//6) + offset) % ledCount
|
||||
led_minute = ((m*ledCount)/60 + offset) % ledCount
|
||||
hmin = float(h+(1/60*m))
|
||||
|
||||
if hmin > 12:
|
||||
hmin -= 12
|
||||
|
||||
hour = float(hmin/12 * ledCount)
|
||||
led_hour = int(hour + offset) % ledCount
|
||||
|
||||
minute = m/60. * ledCount
|
||||
minute_low = int(minute)
|
||||
g1 = round((1-(minute-minute_low))*255)
|
||||
led_minute = int(minute + offset) % ledCount
|
||||
|
||||
second = s/60. * ledCount
|
||||
second_low = int(second)
|
||||
b1 = round((1-(second-second_low))*255)
|
||||
led_second = int(second + offset) % ledCount
|
||||
|
||||
hourRange = myRange(led_hour, hourMargin)
|
||||
@@ -53,7 +58,7 @@ while not hyperion.abort():
|
||||
blend = [0, 0, 0]
|
||||
|
||||
if i in markers:
|
||||
blend = [255, 255, 255]
|
||||
blend = markerColor
|
||||
|
||||
if i in hourRange:
|
||||
blend = hourColor
|
||||
|
@@ -3,6 +3,7 @@
|
||||
"script" : "pacman.py",
|
||||
"args" :
|
||||
{
|
||||
"sleep-time" : 0.3
|
||||
"margin-pos" : 2.0,
|
||||
"rotationTime" : 8
|
||||
}
|
||||
}
|
||||
|
@@ -4,10 +4,11 @@ import colorsys
|
||||
from random import randint
|
||||
|
||||
#get args
|
||||
sleepTime = float(hyperion.args.get('sleep-time', 0.3))
|
||||
rotationTime = int(hyperion.args.get('rotationTime', 8))
|
||||
marginPos = float(hyperion.args.get('margin-pos', 1.5))
|
||||
|
||||
# define pacman
|
||||
pacman = bytearray((255, 255, 1))
|
||||
pacman = bytearray((255, 255, 0))
|
||||
|
||||
# define ghosts
|
||||
redGuy = bytearray((255, 0, 0))
|
||||
@@ -18,18 +19,29 @@ slowGuy = bytearray((255, 184, 81))
|
||||
light = bytearray((255, 184, 174))
|
||||
background = bytearray((0, 0, 0))
|
||||
|
||||
#helper
|
||||
posPac = 1
|
||||
diffPac = 6*marginPos
|
||||
diffGuys = 3*marginPos
|
||||
sleepTime = rotationTime/ledCount
|
||||
|
||||
posPinkGuy = posPac + diffPac
|
||||
posBlueGuy = posPinkGuy + diffGuys
|
||||
posSlowGuy = posBlueGuy + diffGuys
|
||||
posRedGuy = posSlowGuy + diffGuys
|
||||
|
||||
# initialize the led data
|
||||
ledDataEscape = bytearray()
|
||||
for i in range(hyperion.ledCount):
|
||||
if i == 1:
|
||||
ledDataEscape += pacman
|
||||
elif i == 7:
|
||||
elif i == posPinkGuy:
|
||||
ledDataEscape += pinkGuy
|
||||
elif i == 10:
|
||||
elif i == posBlueGuy:
|
||||
ledDataEscape += blueGuy
|
||||
elif i == 13:
|
||||
elif i == posSlowGuy:
|
||||
ledDataEscape += slowGuy
|
||||
elif i == 16:
|
||||
elif i == posRedGuy:
|
||||
ledDataEscape += redGuy
|
||||
else:
|
||||
ledDataEscape += background
|
||||
@@ -38,7 +50,7 @@ ledDataChase = bytearray()
|
||||
for i in range(hyperion.ledCount):
|
||||
if i == 1:
|
||||
ledDataChase += pacman
|
||||
elif i in [7, 10, 13, 16]:
|
||||
elif i in [posPinkGuy, posBlueGuy, posSlowGuy, posRedGuy]:
|
||||
ledDataChase += bytearray((33, 33, 255))
|
||||
else:
|
||||
ledDataChase += background
|
||||
|
@@ -5,7 +5,7 @@
|
||||
"required": true,
|
||||
"properties": {
|
||||
"offset": {
|
||||
"type": "number",
|
||||
"type": "integer",
|
||||
"title": "edt_eff_offset_title",
|
||||
"default": 0,
|
||||
"append": "edt_append_leds",
|
||||
@@ -54,25 +54,36 @@
|
||||
"propertyOrder": 4
|
||||
},
|
||||
"hour-margin": {
|
||||
"type": "number",
|
||||
"type": "integer",
|
||||
"title": "edt_eff_hourMargin_title",
|
||||
"default": 2,
|
||||
"append": "edt_append_leds",
|
||||
"propertyOrder": 5
|
||||
"propertyOrder" : 5
|
||||
},
|
||||
"minute-margin": {
|
||||
"type": "number",
|
||||
"type": "integer",
|
||||
"title": "edt_eff_minuteMargin_title",
|
||||
"default": 1,
|
||||
"append": "edt_append_leds",
|
||||
"propertyOrder": 6
|
||||
"propertyOrder" : 6
|
||||
},
|
||||
"second-margin": {
|
||||
"type": "number",
|
||||
"type": "integer",
|
||||
"title": "edt_eff_secondMargin_title",
|
||||
"default": 0,
|
||||
"append": "edt_append_leds",
|
||||
"propertyOrder": 7
|
||||
"propertyOrder" : 7
|
||||
},
|
||||
"marker-color": {
|
||||
"type": "array",
|
||||
"title":"edt_eff_colorMarker_title",
|
||||
"format":"colorpicker",
|
||||
"default": [255,255,255],
|
||||
"items" : {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 255
|
||||
},
|
||||
"minItems": 3,
|
||||
"maxItems": 3,
|
||||
"propertyOrder" : 8
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
@@ -4,14 +4,22 @@
|
||||
"title":"edt_eff_pacman_header_title",
|
||||
"required":true,
|
||||
"properties":{
|
||||
"sleep-time": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_sleeptime_title",
|
||||
"default": 0.3,
|
||||
"rotationTime": {
|
||||
"type": "integer",
|
||||
"title":"edt_eff_rotationtime_title",
|
||||
"default": 5,
|
||||
"step" : 0.1,
|
||||
"minimum": 0.01,
|
||||
"minimum": 1,
|
||||
"append" : "edt_append_s",
|
||||
"propertyOrder" : 1
|
||||
},
|
||||
"margin-pos": {
|
||||
"type": "number",
|
||||
"title":"edt_eff_margin_title",
|
||||
"default": 1.0,
|
||||
"step" : 0.1,
|
||||
"minimum": 1.0,
|
||||
"propertyOrder" : 2
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
Reference in New Issue
Block a user