Skip to content

fix: carry LED segment mask to GUI preview via FrameSent#180

Open
kali-urs wants to merge 1 commit into
Lexonight1:mainfrom
kali-urs:fix/macos-led-segment-mask-preview
Open

fix: carry LED segment mask to GUI preview via FrameSent#180
kali-urs wants to merge 1 commit into
Lexonight1:mainfrom
kali-urs:fix/macos-led-segment-mask-preview

Conversation

@kali-urs

Copy link
Copy Markdown

Problem

The GUI simulated LED segment display was showing all segments lit regardless of mode. This happened because FrameSent only carried display_colors but not the mask (on/off boolean list) computed by compute_mask(). For segment-display styles like TEMP_LINKED, LOAD_LINKED, etc., the preview would show all segments illuminated even though only specific segments should be lit.

Fix

  • Add mask: list field to FrameSent event (default empty, backward compatible)
  • Pass mask from RenderLed.execute() when publishing FrameSent
  • Wire mask through TRCCApp._on_bus_frame_sentLEDHandler.handle_frame
  • Add optional mask parameter to UCLedControl.set_led_colors()
  • Add UCScreenLED.set_mask() to update on/off state per tick
  • Check _is_on in _paint_led_rects() so masked-off segments stay dim (grey underlay only)

Files changed

  • src/trcc/core/events.py — add mask field
  • src/trcc/core/commands/led.py — publish mask with FrameSent
  • src/trcc/ui/gui/trcc_app.py — bridge mask from event
  • src/trcc/ui/gui/led_handler.py — extract and forward mask
  • src/trcc/ui/gui/uc_led_control.py — accept optional mask
  • src/trcc/ui/gui/uc_screen_led.py — set_mask() + render check

Testing

Tested on macOS 26.6 (Intel x86_64) with PA120 Digital (0416:8001):

  • TEMP_LINKED mode now shows only temperature-digit segments lit
  • Other modes (COLORFUL, BREATHING, etc.) unaffected
  • No regression on LCD FrameSent path (mask default empty)

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant