rework effects to be a bit shorter

This commit is contained in:
Franzi 2023-08-08 06:40:54 +02:00
parent 76f4f3f024
commit aa8f3ec805
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -66,15 +66,14 @@ class DMXQueue:
level, component, text = self.queue.get_nowait() level, component, text = self.queue.get_nowait()
LOG.info(f'Got queue item: {level} {component} : {text}') LOG.info(f'Got queue item: {level} {component} : {text}')
self._update_all(0, 0, 0, 0)
sleep(0.2)
forward = list(range(17)) # effect duration should be between 1s and 1.5s
reverse = list(range(17))
reverse.reverse()
if level == 'error': if level == 'error':
# three instances of two flashes each # three instances of two flashes each
for i in range(3): for i in range(3):
for j in range(4): for j in range(2):
self._update_all( self._update_all(
self.config.alerts.brightness, 255, 0, 0, 50 self.config.alerts.brightness, 255, 0, 0, 50
) )
@ -97,16 +96,22 @@ class DMXQueue:
light.intensity = 0 light.intensity = 0
self._bulk(*light.dump()) self._bulk(*light.dump())
sleep(0.5) sleep(0.2)
self._update_all(0, 0, 0, 0) self._update_all(0, 0, 0, 0)
elif level == 'info': elif level == 'info':
intensity_multiplier = self.config.alerts.brightness / 17 forward = list(range(15))
reverse = list(range(15))
reverse.reverse()
# info: two times slow fade
intensity_multiplier = self.config.alerts.brightness / 15
for i in range(2): for i in range(2):
for idx in forward + reverse: for idx in forward + reverse:
self._update_all( self._update_all(
int(intensity_multiplier * idx), 0, 50, 255 int(intensity_multiplier * idx), 0, 50, 255
) )
sleep(0.03) sleep(0.025)
sleep(0.2)
self.queue.task_done() self.queue.task_done()
except Empty: except Empty:
if self.config.rainbow.enable: if self.config.rainbow.enable: