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.
This commit is contained in:
Sean Doran committed 2026-02-27 21:25:21 -05:00
1 parent 8f8d9ac3fa
commit 2dbc58f4e1
1 file changed
+3 -1
+3 -1
View File
@@ -397,7 +397,9 @@ def main() -> None:
msg["id"], msg["action"], config, pulse msg["id"], msg["action"], config, pulse
) )
elif msg["type"] == "heartbeat": 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). # Check for config changes every 2 s (serial read timeout = 0.1 s).
now = time.monotonic() now = time.monotonic()