Skip to content

fix(ledmatrix-flights): give the Vegas map the same features as the rotation - #231

Merged
ChuckBuilds merged 3 commits into
mainfrom
fix/flights-vegas-map-parity
Jul 31, 2026
Merged

fix(ledmatrix-flights): give the Vegas map the same features as the rotation#231
ChuckBuilds merged 3 commits into
mainfrom
fix/flights-vegas-map-parity

Conversation

@ChuckBuilds

@ChuckBuilds ChuckBuilds commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Problem

Aircraft trails never appeared on the map in Vegas scroll mode, even with show_trails enabled.

get_vegas_content() reimplemented a cut-down version of the map view rather than sharing it. Its copy drew two things; _display_map drew five. Missing from the ticker:

  • aircraft trails, with their fading effect
  • the white centre-position marker — the map's only reference point, so without it the aircraft positions are much harder to read
  • the aircraft count and airplane icon

The trail data was always being collected: aircraft_trails is populated in update() regardless of which display path runs. This was purely a rendering gap.

It's duplication drift rather than a deliberate simplification — _display_map accumulated features over time and the Vegas copy didn't track them.

Fix

Extracted _render_map_image() as the single source of truth, called by both _display_map and get_vegas_content.

I deliberately did not just add the three missing pieces to the copy: that leaves the identical trap for the next feature added to the map view. There is now one renderer and one call site for _get_map_background.

Sizing needs no extra plumbing

Worth noting for review, since it looks like it should: display_width/display_height are properties over matrix, and the core narrows the display manager while requesting Vegas content, so _latlon_to_pixel already scales its projection to whatever width the ticker asked for. Verified from 64×32 up to 512×64, including an explicit 64px-wide render.

On the test rig flights renders at 256px (it has vegas_width_pct: 50), and the log confirms the shared path producing 256x64.

Testing

test_vegas_map_parity.py (17 cases). The load-bearing one asserts the Vegas image is byte-identical to what the rotation pushes to the display — that's what stops the two drifting again, rather than testing for the three features individually and missing the fourth next time. Plus direct coverage of trails on/off, the centre marker, the untracked-trail skip, and rendering at every panel size.

  • Safety harness: all sizes PASS.
  • check_module_collisions.py: OK across 41 plugins.
  • On hardware: renders through the shared path with no errors, 107–113 aircraft flowing from SkyAware.

Also drops two locals in get_vegas_content that the refactor left unused.

Context

Part of a set of Vegas scroll mode changes; the core-side companion is ChuckBuilds/LEDMatrix#423.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ

Summary by CodeRabbit

  • Bug Fixes

    • Fixed the Vegas scroll map so trails, the center marker, aircraft, and aircraft count display correctly.
    • Ensured Vegas map visuals match the standard rotating map display across different screen sizes.
    • Improved consistency between scrolling map views and regular map displays.
  • Release

    • Updated the ledmatrix-flights plugin to version 1.12.6, including the latest release notes.

…otation

get_vegas_content() reimplemented a cut-down version of the map view rather
than sharing it. Its copy drew only the map background and the aircraft dots,
so three things were silently missing from the ticker:

- aircraft trails, even with show_trails enabled
- the white centre-position marker, which is the map's only reference point
- the aircraft count and airplane icon

The trail data was always there — aircraft_trails is populated in update()
regardless of which display path runs — so this was purely a rendering gap.
It is duplication drift rather than a deliberate simplification: _display_map
gained features over time and the Vegas copy did not track them.

Extracted _render_map_image() as the single source of truth, called by both
_display_map and get_vegas_content. Fixing the copy in place would have left
the same trap for the next feature added to the map view.

Sizing needs no extra plumbing: display_width/display_height are properties
over matrix, and Vegas narrows the display manager while requesting content, so
_latlon_to_pixel already scales its projection to whatever width the ticker
asked for. Verified at 64x32 through 512x64, including a 64px-wide render.

test_vegas_map_parity.py asserts the Vegas image is byte-identical to what the
rotation pushes to the display, so the two cannot diverge again, plus direct
coverage of the trails, the centre marker and the untracked-trail skip.

Also drops two now-unused locals from get_vegas_content.

Safety harness: all sizes PASS. Module collisions: OK.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The Vegas map renderer is centralized in _render_map_image(), reused by ticker and rotation paths, and covered by pixel-level regression tests. Plugin metadata and release documentation are updated to version 1.12.6.

Changes

Vegas map parity

Layer / File(s) Summary
Shared Vegas map rendering
plugins/ledmatrix-flights/manager.py
get_vegas_content() and _display_map() now use _render_map_image(), which renders backgrounds, center markers, trails, aircraft, counts, and icons at the display dimensions.
Renderer regression coverage
plugins/ledmatrix-flights/test_vegas_map_parity.py
Adds deterministic tests for map elements, trail behavior, Vegas-to-rotation pixel parity, display updates, and narrowed dimensions.
Version 1.12.6 release metadata
plugins.json, plugins/ledmatrix-flights/manifest.json, plugins/ledmatrix-flights/CHANGELOG.md
Updates registry and manifest versions to 1.12.6 and documents the Vegas map rendering fix dated 2026-07-29.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: aligning Vegas map features with the rotation view.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/flights-vegas-map-parity

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

codacy-production Bot commented Jul 29, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 38 complexity

Metric Results
Complexity 38

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
plugins/ledmatrix-flights/test_vegas_map_parity.py (1)

221-225: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Cover every supported panel size.

This omits required 128×64 and 256×32 coverage while testing unsupported 256×64 and 512×64 dimensions.

Proposed test matrix
-    `@pytest.mark.parametrize`("width,height", [(64, 32), (128, 32), (256, 64), (512, 64)])
+    `@pytest.mark.parametrize`(
+        "width,height",
+        [(64, 32), (128, 32), (128, 64), (256, 32)],
+    )

As per coding guidelines, “Every plugin must render correctly on all supported matrix sizes: 64×32, 128×32, 128×64, and 256×32.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@plugins/ledmatrix-flights/test_vegas_map_parity.py` around lines 221 - 225,
Update the width,height parameter matrix in
test_renders_without_error_at_any_size to cover exactly the supported sizes
64×32, 128×32, 128×64, and 256×32; remove the unsupported 256×64 and 512×64
cases while preserving the existing render and image-size assertions.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/ledmatrix-flights/manager.py`:
- Around line 2902-2903: Move map background retrieval out of the render path:
update() should refresh tile/background data through self.cache_manager, while
display() and get_vegas_content() should only read the cached background and
retain the existing black fallback when unavailable. Ensure
_get_map_background() is no longer invoked synchronously by either render
method.

---

Nitpick comments:
In `@plugins/ledmatrix-flights/test_vegas_map_parity.py`:
- Around line 221-225: Update the width,height parameter matrix in
test_renders_without_error_at_any_size to cover exactly the supported sizes
64×32, 128×32, 128×64, and 256×32; remove the unsupported 256×64 and 512×64
cases while preserving the existing render and image-size assertions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 05a8f722-73c6-4dd4-bda7-ee98ff7ff369

📥 Commits

Reviewing files that changed from the base of the PR and between 3f7c90e and 154c858.

📒 Files selected for processing (5)
  • plugins.json
  • plugins/ledmatrix-flights/CHANGELOG.md
  • plugins/ledmatrix-flights/manager.py
  • plugins/ledmatrix-flights/manifest.json
  • plugins/ledmatrix-flights/test_vegas_map_parity.py

Comment thread plugins/ledmatrix-flights/manager.py
claude and others added 2 commits July 29, 2026 10:38
Drops an unused ImageDraw import, and replaces Cls.__new__(Cls) with a
no-op-__init__ subclass for building the test shell. The __new__ form is valid
Python but Codacy's Pylint reports it as a missing-cls call; the subclass reads
better anyway and states the intent — bypass the real __init__, which builds
fetchers, threads and caches the map renderer does not need.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KEZK1P1Q1fu5pcuVrkrCFZ

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@plugins/ledmatrix-flights/test_vegas_map_parity.py`:
- Around line 63-76: Update _plugin_shell and all sibling imports in this test
to load plugins/ledmatrix-flights modules under a plugin-unique module name
instead of bare top-level names such as manager. Preserve the existing
FlightTrackerPlugin behavior while ensuring imports cannot resolve modules from
another plugin; apply the same naming convention consistently to every sibling
module import in the file.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f66f2c74-c2e1-4d4c-8883-803680f6cc2c

📥 Commits

Reviewing files that changed from the base of the PR and between 154c858 and 63d8d90.

📒 Files selected for processing (2)
  • plugins.json
  • plugins/ledmatrix-flights/test_vegas_map_parity.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins.json

Comment thread plugins/ledmatrix-flights/test_vegas_map_parity.py
@ChuckBuilds
ChuckBuilds merged commit 2cb68bd into main Jul 31, 2026
4 checks passed
@ChuckBuilds
ChuckBuilds deleted the fix/flights-vegas-map-parity branch July 31, 2026 19:32
ChuckBuilds added a commit that referenced this pull request Aug 3, 2026
…243)

The cached map composite is already cropped to the display aspect ratio
and resized to the panel before it is stored, but the memo was keyed on
centre and zoom alone. Vegas narrows the display manager while it
requests content, so the rotation and the ticker ask for the same view at
different widths — and whichever rendered second was handed the other
one's image.

_render_map_image() copies that background, so the symptom is a whole
frame at the wrong size, with aircraft and trails projected for the size
it didn't get. This is why #231's "sizing needs no extra plumbing" only
held for _latlon_to_pixel: the projection follows the display, the cached
background didn't.

The cache now holds one entry per size and clears them all when the
centre or zoom moves. Keeping every size rather than a single slot keyed
on size matters because the two paths alternate: a single slot would
re-crop and re-resize on every Vegas/rotation swap.

Also renames cached_map_bg -> cached_map_bgs, updating the config-reload
test that asserts the cache is invalidated on change.

Tests: three cases in test_vegas_map_parity.py covering the size after a
narrower render, per-size cache retention, and the end-to-end frame size
across a size switch. All three fail against the old memo. The existing
parity tests can't catch this — they set map_bg_enabled = False, so the
tile path never runs. Full suite: 21 passed, plus test_config_reload.py
(15) and test_overhead_radius.py green.

check_module_collisions.py: OK across 42 plugins.


Claude-Session: https://claude.ai/code/session_016ZQZi3TiR77t2k5QjPix3E

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants