Compare commits

..

No commits in common. "9f319a5b21668043e7efc3eb49b101f51aa9a37a" and "fa4387a18778b01f17be5357ae125a4eadb6028e" have entirely different histories.

2 changed files with 16 additions and 39 deletions

View file

@ -3,7 +3,7 @@ import os
import sys
base = 'https://cdosea.0x2620.org/static/render/'
lang = ''
lang = '1080p'
start = ''
lights = False
lanbox = False
@ -14,8 +14,6 @@ font_size = 28
letter_offset = False
lights_brightness = 255
led_lights = 24
letter_base_light = 25
conf = os.path.expanduser('~/.config/cdosea.json')
if os.path.exists(conf):

View file

@ -55,7 +55,7 @@ CURRENT_STATE = [0] * 16
# 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
steps = int(duration * 10)
if not steps:
@ -79,45 +79,33 @@ def fade_to(sender, start, end, duration, channels=16, universe=1, lights=[]):
else:
a = old
b = target
channel_data = [a[x] if x % 2 else b[x] for x in range(channels)]
sender[universe].dmx_data = channel_data + lights[channels:]
sender[universe].dmx_data = [a[x] if x % 2 else b[x] for x in range(channels)]
time.sleep(step)
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
flash_duration = 0.02
base = 0
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
while flashes:
lights = dmx_base(letter)
fade_to(sender, base, brightness, flash_duration, channels, universe, lights)
fade_to(sender, base, brightness, flash_duration, channels, universe)
time.sleep(step)
lights = dmx_base(None)
channel_data = [0] * channels
sender[universe].dmx_data = channel_data + lights[channels:]
sender[1].dmx_data = [0] * channels
time.sleep(step)
flashes -= 1
lights = dmx_base(None)
channel_data = [0] * channels
sender[universe].dmx_data = channel_data + lights[channels:]
sender[universe].dmx_data = [0] * channels
time.sleep(step)
sender.stop()
def switch(state, seq):
@ -140,14 +128,7 @@ if __name__ == '__main__':
letter_offset = 0
letter = path.split('/')[-1][0].lower()
if config.letter_offset:
if config.lanbox:
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
letter_offset = 11 + string.ascii_lowercase.index(letter) * 10
while pos < duration - 15:
sleep = seq() + 15
light = seq()
@ -159,7 +140,5 @@ if __name__ == '__main__':
if config.lanbox:
switch(light + letter_offset, seq)
else:
flash(sender, universe, light + 1, letter)
flash(light + 1)
pos += sleep
if not config.lanbox:
sender.stop()