Compare commits
No commits in common. "9f319a5b21668043e7efc3eb49b101f51aa9a37a" and "fa4387a18778b01f17be5357ae125a4eadb6028e" have entirely different histories.
9f319a5b21
...
fa4387a187
2 changed files with 16 additions and 39 deletions
|
@ -3,7 +3,7 @@ import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
base = 'https://cdosea.0x2620.org/static/render/'
|
base = 'https://cdosea.0x2620.org/static/render/'
|
||||||
lang = ''
|
lang = '1080p'
|
||||||
start = ''
|
start = ''
|
||||||
lights = False
|
lights = False
|
||||||
lanbox = False
|
lanbox = False
|
||||||
|
@ -14,8 +14,6 @@ font_size = 28
|
||||||
|
|
||||||
letter_offset = False
|
letter_offset = False
|
||||||
lights_brightness = 255
|
lights_brightness = 255
|
||||||
led_lights = 24
|
|
||||||
letter_base_light = 25
|
|
||||||
|
|
||||||
conf = os.path.expanduser('~/.config/cdosea.json')
|
conf = os.path.expanduser('~/.config/cdosea.json')
|
||||||
if os.path.exists(conf):
|
if os.path.exists(conf):
|
||||||
|
|
|
@ -55,7 +55,7 @@ CURRENT_STATE = [0] * 16
|
||||||
|
|
||||||
|
|
||||||
# avoid overload and turn light on with a fade
|
# avoid overload and turn light on with a fade
|
||||||
def fade_to(sender, start, end, duration, channels=16, universe=1, lights=[]):
|
def fade_to(sender, start, end, duration, channels=16, universe=1):
|
||||||
distance = end - start
|
distance = end - start
|
||||||
steps = int(duration * 10)
|
steps = int(duration * 10)
|
||||||
if not steps:
|
if not steps:
|
||||||
|
@ -79,45 +79,33 @@ def fade_to(sender, start, end, duration, channels=16, universe=1, lights=[]):
|
||||||
else:
|
else:
|
||||||
a = old
|
a = old
|
||||||
b = target
|
b = target
|
||||||
channel_data = [a[x] if x % 2 else b[x] for x in range(channels)]
|
sender[universe].dmx_data = [a[x] if x % 2 else b[x] for x in range(channels)]
|
||||||
sender[universe].dmx_data = channel_data + lights[channels:]
|
|
||||||
time.sleep(step)
|
time.sleep(step)
|
||||||
steps -= 1
|
steps -= 1
|
||||||
channel_data = [end] * channels
|
|
||||||
sender[universe].dmx_data = channel_data + lights[channels:]
|
|
||||||
|
|
||||||
def dmx_base(letter):
|
|
||||||
lights = [0] * 512
|
|
||||||
letter_offset = 101 - 1
|
|
||||||
for offset in range(letter_offset, letter_offset+27):
|
|
||||||
lights[offset] = config.letter_base_light
|
|
||||||
if letter:
|
|
||||||
lights[letter_offset + string.ascii_lowercase.index(letter.lower())] = 255
|
|
||||||
lights[letter_offset + 26] = 255
|
|
||||||
return lights
|
|
||||||
|
|
||||||
|
|
||||||
def flash(sender, universe, flashes, letter):
|
def flash(flashes):
|
||||||
step = 0.2
|
step = 0.2
|
||||||
flash_duration = 0.02
|
flash_duration = 0.02
|
||||||
base = 0
|
base = 0
|
||||||
brightness = config.lights_brightness
|
brightness = config.lights_brightness
|
||||||
channels = config.led_lights
|
universe = 1
|
||||||
|
channels = 16
|
||||||
|
|
||||||
|
sender = sacn.sACNsender()
|
||||||
|
sender.start()
|
||||||
|
sender.activate_output(universe)
|
||||||
|
sender[universe].multicast = True
|
||||||
sender[universe].dmx_data = [0] * channels
|
sender[universe].dmx_data = [0] * channels
|
||||||
while flashes:
|
while flashes:
|
||||||
lights = dmx_base(letter)
|
fade_to(sender, base, brightness, flash_duration, channels, universe)
|
||||||
fade_to(sender, base, brightness, flash_duration, channels, universe, lights)
|
|
||||||
time.sleep(step)
|
time.sleep(step)
|
||||||
lights = dmx_base(None)
|
sender[1].dmx_data = [0] * channels
|
||||||
channel_data = [0] * channels
|
|
||||||
sender[universe].dmx_data = channel_data + lights[channels:]
|
|
||||||
time.sleep(step)
|
time.sleep(step)
|
||||||
flashes -= 1
|
flashes -= 1
|
||||||
lights = dmx_base(None)
|
sender[universe].dmx_data = [0] * channels
|
||||||
channel_data = [0] * channels
|
|
||||||
sender[universe].dmx_data = channel_data + lights[channels:]
|
|
||||||
time.sleep(step)
|
time.sleep(step)
|
||||||
|
sender.stop()
|
||||||
|
|
||||||
|
|
||||||
def switch(state, seq):
|
def switch(state, seq):
|
||||||
|
@ -140,14 +128,7 @@ if __name__ == '__main__':
|
||||||
letter_offset = 0
|
letter_offset = 0
|
||||||
letter = path.split('/')[-1][0].lower()
|
letter = path.split('/')[-1][0].lower()
|
||||||
if config.letter_offset:
|
if config.letter_offset:
|
||||||
if config.lanbox:
|
letter_offset = 11 + string.ascii_lowercase.index(letter) * 10
|
||||||
letter_offset = 11 + string.ascii_lowercase.index(letter) * 10
|
|
||||||
if not config.lanbox:
|
|
||||||
universe = 1
|
|
||||||
sender = sacn.sACNsender()
|
|
||||||
sender.start()
|
|
||||||
sender.activate_output(universe)
|
|
||||||
sender[universe].multicast = True
|
|
||||||
while pos < duration - 15:
|
while pos < duration - 15:
|
||||||
sleep = seq() + 15
|
sleep = seq() + 15
|
||||||
light = seq()
|
light = seq()
|
||||||
|
@ -159,7 +140,5 @@ if __name__ == '__main__':
|
||||||
if config.lanbox:
|
if config.lanbox:
|
||||||
switch(light + letter_offset, seq)
|
switch(light + letter_offset, seq)
|
||||||
else:
|
else:
|
||||||
flash(sender, universe, light + 1, letter)
|
flash(light + 1)
|
||||||
pos += sleep
|
pos += sleep
|
||||||
if not config.lanbox:
|
|
||||||
sender.stop()
|
|
||||||
|
|
Loading…
Reference in a new issue