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.
main
Sean Doran 2026-02-27 21:25:21 -05:00
parent 8f8d9ac3fa
commit 2dbc58f4e1
No known key found for this signature in database
GPG Key ID: A9D7D25CD95E8579
1 changed files with 3 additions and 1 deletions

View File

@ -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()