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
parent
8f8d9ac3fa
commit
2dbc58f4e1
|
|
@ -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()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue