From 2dbc58f4e1654a1ee34e75e01138bbeb8eaf5468 Mon Sep 17 00:00:00 2001 From: Sean Doran Date: Fri, 27 Feb 2026 21:25:21 -0500 Subject: [PATCH] fix: update last_led_colors on heartbeat to prevent LED flicker The heartbeat path called send_leds but never updated last_led_colors, so the dedup guard in handle_knob had no visibility into what was last actually sent. Heartbeats arriving mid-knob-turn injected extra serial writes that bypassed the guard and overwhelmed the device's LED renderer, causing visible flicker. --- src/turnup/turnupd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/turnup/turnupd.py b/src/turnup/turnupd.py index 5e6efc4..112aed1 100755 --- a/src/turnup/turnupd.py +++ b/src/turnup/turnupd.py @@ -397,7 +397,9 @@ def main() -> None: msg["id"], msg["action"], config, pulse ) elif msg["type"] == "heartbeat": - send_leds(ser, all_led_colors(config, knob_norms)) + new_colors = all_led_colors(config, knob_norms) + send_leds(ser, new_colors) + last_led_colors[:] = new_colors # Check for config changes every 2 s (serial read timeout = 0.1 s). now = time.monotonic()