From 267bca1f86efcfeee62f6bf780d2d1d3049692c4 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sun, 13 Aug 2023 23:28:14 +0200 Subject: [PATCH] make info less annoying --- dmx_queue.py | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/dmx_queue.py b/dmx_queue.py index 87a9225..521b382 100644 --- a/dmx_queue.py +++ b/dmx_queue.py @@ -66,11 +66,11 @@ class DMXQueue: level, component, text = self.queue.get_nowait() LOG.info(f'Got queue item: {level} {component} : {text}') - self._update_all(0, 0, 0, 0) - sleep(0.2) # effect duration should be between 1s and 1.5s if level == 'error': + self._update_all(0, 0, 0, 0) + sleep(0.2) # three instances of two flashes each for i in range(3): for j in range(2): @@ -82,6 +82,8 @@ class DMXQueue: sleep(0.1) sleep(0.2) elif level == 'warn': + self._update_all(0, 0, 0, 0) + sleep(0.2) # warning: blink alternate, but slow for i in range(6): for idx, light in enumerate(self.lights): @@ -103,15 +105,27 @@ class DMXQueue: reverse = list(range(15)) reverse.reverse() - # info: two times slow fade - intensity_multiplier = self.config.alerts.brightness / 15 - for i in range(2): - for idx in forward + reverse: - self._update_all( - int(intensity_multiplier * idx), 0, 50, 255 - ) - sleep(0.025) - sleep(0.2) + if self.config.rainbow.enable: + diff = ( + self.config.alerts.brightness + - self.config.rainbow.brightness + ) + LOG.debug(diff) + + if diff >= 50: + for idx in forward + reverse: + LOG.debug(idx) + LOG.debug(diff * idx) + self._update_all( + int( + self.config.rainbow.brightness + + ((diff / len(forward + reverse)) * idx) + ), + 0, + 50, + 255, + ) + sleep(0.025) self.queue.task_done() except Empty: if self.config.rainbow.enable: