fix: carry LED segment mask to GUI preview via FrameSent#180
Conversation
The GUI simulated LED display was showing all segments lit because FrameSent only carried display_colors but not the on/off mask computed by compute_mask(). This meant the preview never knew which segments should actually be lit for segment-display styles (TEMP_LINKED, etc.). - Add field to FrameSent event (list of bool, default empty) - Pass mask from RenderLed.execute() when publishing FrameSent - Wire mask through TRCCApp._on_bus_frame_sent → LEDHandler.handle_frame - Add UCLedControl.set_led_colors() optional mask parameter - Add UCScreenLED.set_mask() to update on/off state per tick - Check _is_on in _paint_led_rects() so masked-off segments stay dim Fixes the GUI preview on macOS where all segments appeared lit regardless of the actual hardware mask.
|
Thank you for this, and for the clear diagnosis — you're exactly right that the segment preview was lighting every segment because the on/off mask wasn't reaching it. Nicely traced. It turns out this is already fixed in Since the preview already honors that, I'll close this as already-fixed — but your analysis was spot-on and I really appreciate you taking the time to write it up and PR it. If you're on v9.7.1 and any segment style's preview still looks wrong, please drop a note and I'll dig in. If this project helps you, consider buying me a beer 🍺 or Ko-fi ☕ |
Problem
The GUI simulated LED segment display was showing all segments lit regardless of mode. This happened because
FrameSentonly carrieddisplay_colorsbut not themask(on/off boolean list) computed bycompute_mask(). For segment-display styles likeTEMP_LINKED,LOAD_LINKED, etc., the preview would show all segments illuminated even though only specific segments should be lit.Fix
mask: listfield toFrameSentevent (default empty, backward compatible)maskfromRenderLed.execute()when publishingFrameSentTRCCApp._on_bus_frame_sent→LEDHandler.handle_framemaskparameter toUCLedControl.set_led_colors()UCScreenLED.set_mask()to update on/off state per tick_is_onin_paint_led_rects()so masked-off segments stay dim (grey underlay only)Files changed
src/trcc/core/events.py— add mask fieldsrc/trcc/core/commands/led.py— publish mask with FrameSentsrc/trcc/ui/gui/trcc_app.py— bridge mask from eventsrc/trcc/ui/gui/led_handler.py— extract and forward masksrc/trcc/ui/gui/uc_led_control.py— accept optional masksrc/trcc/ui/gui/uc_screen_led.py— set_mask() + render checkTesting
Tested on macOS 26.6 (Intel x86_64) with PA120 Digital (0416:8001):