b9cdc6a9b721c1a598ad9bf1da7fbbd9d2ab0f9f
User reports periodic clicks and LED color changes on the controller "between races". Theory: out-of-race, the run loop was calling reset_triggers(controller) AND apply_lightbar(controller, ...) on every Forza packet (60Hz). Even though both call sites land in library code that nominally dedupes "same state" writes, in practice any state change anywhere — including the lightbar dropping a green channel value as RPM coasts down to idle — triggers a full HID OUT report rewrite. The OUT report carries the trigger configuration too; the controller firmware reacts on receipt and produces an audible click each time. Fix: out-of-race path becomes edge-triggered. On the in-race → menu transition we run state.reset() + reset_all() once (turning both triggers off and the lightbar to (0,0,0)). Subsequent menu packets make no controller calls at all until in_race flips back to True. First in-race packet then re-engages handlers and the RPM-driven lightbar. Side effect: the menu-mode car-class lightbar coloring is gone — the bar stays black between races. If we want it back later, it should be one-shot on the menu transition (NOT updated per-packet). For now keep it simple: in-race only. Build clean; tests unchanged (54/54 still pass — they exercise handlers directly, not the run loop).
My NixOS configs ✨
Hosts
- mreow: My personal Framework 13 laptop
- yarn: Machine I usually just play games on. Boots into SteamOS-like interface.
- muffin: Homeserver, runs various services.
Desktop/Laptop
What do I use?
Browser: Firefox 🦊 (actually Zen Browser :p)
Text Editor: Doom Emacs
Terminal: ghostty
Shell: fish with the pure prompt
WM: niri
Background
- Got my background from here and used the command
magick input.png -filter Point -resize 2880x1920! output.pngto upscale it bilinearly
Description
Languages
Nix
77.5%
Python
17.2%
Shell
3.5%
Emacs Lisp
1.8%