diff --git a/cdoseaplay/lights.py b/cdoseaplay/lights.py index 008433e..7e1743a 100755 --- a/cdoseaplay/lights.py +++ b/cdoseaplay/lights.py @@ -77,12 +77,22 @@ def fade_to(target, duration): step = duration/steps delta = distance/steps value = current + switch = 0 while steps: + switch += 1 value += delta n = int(round(value)) if n != current: current = n - sender[1].dmx_data = [n] * 16 + old = sender[1].dmx_data[:16] + target = [n] * 16 + if switch % 2: + a = target + b = old + else: + a = old + b = target + sender[1].dmx_data = [a[x] if x % 2 else b[x] for x in range(16)] CURRENT_STATE = sender[1].dmx_data[:16] time.sleep(step) steps -= 1 @@ -98,7 +108,7 @@ def switch(state): #lb.fadeTo(lights, fade) lb.layerGo(state) else: - brightness = round(lights['7'] / 255 * 50) + brightness = lights['7'] fade_to(brightness, duration) if __name__ == '__main__':