Skip to content

fix(weather): stop the Vegas ticker spending a display width on current conditions - #257

Merged
ChuckBuilds merged 6 commits into
mainfrom
fix/weather-vegas-compact-current
Aug 5, 2026
Merged

fix(weather): stop the Vegas ticker spending a display width on current conditions#257
ChuckBuilds merged 6 commits into
mainfrom
fix/weather-vegas-compact-current

Conversation

@ChuckBuilds

@ChuckBuilds ChuckBuilds commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Reported as: the ticker scrolls with tight spacing, then current conditions takes a full display width.

What's happening

get_vegas_content() handed the ticker the same image the full-screen renderer produces. That layout anchors the condition, temperature and high/low to the right edge of the panel and distributes the metrics bar evenly across the whole width. Correct for a screen you look at; wrong for a tile that scrolls past.

Measured on a live 512x64 device — the three weather modes contributed 1536px on every rebuild, and auto_trim reclaimed only 14%, because the ink genuinely reaches both edges. There is no blank margin to crop:

[ledmatrix-weather] Native: SUCCESS - 3 images, 1536px total width
[ledmatrix-weather] Trimmed native content: 1536px -> 1318px (14% reclaimed), 3 kept, 0 blank dropped

For contrast, other plugins hand the ticker tiles of 110–145px each (11 image(s), 1581px total; 2 image(s), 220px total). Weather is the only plugin padding each tile to the panel width — which is exactly the "tight elsewhere, full width here" contrast in the report.

The change

All three renderers now take an optional width, defaulting to the panel exactly as before. The Vegas path passes one measured from the content. That's the whole change — no second layout:

  • the condition/temperature/high-low stack right-aligns to whatever width it's handed
  • the metrics bar divides that width instead of the panel
  • the forecast columns are width // count, so they pack rather than spread

So the tile stays the familiar screen — icon left, condition over temperature over high/low, metrics along the bottom — just drawn closer together.

tile compact full-screen reclaimed
current conditions (this device's metrics) 265px 512px 48%
current conditions (every metric on) 371px 512px 28%
hourly 272px 512px 47%
daily 204px 512px 60%

741px instead of 1536px for a full weather cycle on this device.

The metrics bar reserves a real gap between items rather than packing to the text. It centres each item in an equal section of the width, so sizing to the text alone left about 6px between them against 79px at full width — legible in a still image, tiring scrolling past. A 24px per-item floor brings that to 29px.

Metric items are also now built by one helper shared with the full-screen path, so the show_* toggles and the UV severity colour can't drift apart.

An earlier revision of this PR hand-built a separate compact layout. It was wrong twice — first dropping the optional metrics and flattening the UV colour, then simply being a parallel layout someone would have to keep in step. Reusing the real renderer deleted ~90 lines and packs better than my copy of it did.

The full-screen renderer still serves the normal rotation slot, unchanged in output.

The guard, and why it's there

The compact arrangement is not universally narrower. Fixed-size bitmap fonts don't shrink with the display, so on narrower panels the packed layout is no narrower than the screen it replaces. When the compact tile would be at least as wide as the panel, it falls back to the full-screen tile:

panel compact full-screen result
512x64 265px 512px 48% reclaimed
256x64 falls back 256px 0% — no regression
128x32 falls back 128px 0% — no regression

So a narrow display reclaims nothing rather than paying extra.

Verification

Core harness passes for all five weather modes at 128x32, 256x64 and 512x64, and all five render pixel-identical in the normal rotation path, verified by image diff — every change is confined to the Vegas path.

Two revisions of this were rejected on review, both usefully: the first wasn't the weather screen at all (it dropped the optional metrics and the UV colour), and the second was a faithful copy that still shouldn't have been a copy. The current version reuses the real renderer at a narrower width, which is both smaller and impossible to drift.

A note on how the numbers above were arrived at, since two earlier revisions of this PR quoted wrong ones. My offline harness stubbed extra_small_font as PressStart2P 6px; DisplayManager actually loads assets/fonts/4x6-font.ttf for it, which is ~40% narrower. That inflated every metrics-bar measurement and rendered the bottom row in the wrong typeface. The plugin code was never affected — it measures with self.display_manager.extra_small_font — but the reported figures were, and are now taken with the real font.

One pre-existing quirk left alone: the amber temperature slightly overlaps the tail of a long condition string. It does that at full width too, so fixing it would change the normal rotation render this PR deliberately leaves untouched.

Hourly and daily

I originally scoped these out, claiming they "genuinely fill their width". Rendering them showed the opposite — they are the worse offenders:

tile inked gap between columns reclaimable
current conditions 49% ~49px 43%
hourly 28% 91px 67%
daily 20% 136px 77%

Daily is 80% black. Both renderers lay columns out as width // count, so they inherit whatever width they're handed — three days across a 512px panel puts 136px of nothing between each column.

Both now take an optional width (defaulting to the panel, as before) and the Vegas path passes one sized to the columns: hourly 512px → 272px, daily 512px → 204px.

All three tiles together: 784px instead of 1536px on this device.

One part of the report I could not reproduce: the "tight the first time through, full width later" asymmetry. Weather's contribution is constant at 1536px on every single rebuild over hours of logs, so nothing in this plugin varies between passes. If the first-pass difference persists after this, it's in the ticker's composition rather than here.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5

…nt conditions

`get_vegas_content()` handed the ticker the same image the full-screen
renderer produces. That layout anchors the condition, temperature and
high/low to the *right edge of the panel* and distributes the metrics bar
evenly across the whole width — correct for a screen you look at, wrong
for a tile that scrolls past.

Measured on a live 512x64 device, the three weather modes contributed
1536px every rebuild and `auto_trim` reclaimed only 14% of it, because
the ink genuinely reaches both edges — there is no blank margin to crop.
For comparison, other plugins hand the ticker tiles of 110-145px:

    [ledmatrix-weather] Native: SUCCESS - 3 images, 1536px total width
    [ledmatrix-weather] Trimmed native content: 1536px -> 1318px (14% reclaimed)

The ticker now gets its own left-to-right layout for current conditions,
measured and sized to exactly what it draws: icon, then temperature over
high/low, then condition over the metrics. 250px instead of 512px on a
512-wide panel — half a display width per weather cycle.

With a guard, because the compact arrangement is not universally
narrower. Fixed-size bitmap fonts do not shrink with the display, so at
128x32 laying those columns side by side comes to 198px against a 128px
screen. When the compact tile would be at least as wide as the panel it
falls back to the full-screen tile, so a narrow display reclaims nothing
rather than paying extra.

The full-screen renderer is untouched and still serves the normal
rotation slot; only the Vegas path changed. Core harness passes for all
five weather modes at 128x32, 256x64 and 512x64.

Hourly and daily are left alone for now: they are genuinely multi-column
and fill their width, so the same treatment needs its own look.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The weather plugin now supports compact current, hourly, and daily weather tiles for Vegas layouts. Shared metric construction reduces duplicate formatting logic. Catalog and manifest metadata now identify release 2.6.3.

Changes

Compact weather rendering

Layer / File(s) Summary
Shared weather rendering
plugins/ledmatrix-weather/manager.py
Renderers accept optional widths. Current-weather metrics use the shared _build_metric_items helper.
Vegas compact integration
plugins/ledmatrix-weather/manager.py
Vegas content generation calculates content-based widths and passes them to the current, hourly, and daily renderers.
Release metadata
plugins.json, plugins/ledmatrix-weather/manifest.json
The plugin version and dates changed to 2.6.3 and 2026-08-05. The manifest includes the new release record and escaped Unicode em dash sequences in older notes.

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

Sequence Diagram(s)

sequenceDiagram
  participant VegasContent
  participant CompactWidthHelpers
  participant WeatherRenderers
  VegasContent->>CompactWidthHelpers: Calculate compact tile widths
  CompactWidthHelpers-->>VegasContent: Return content-based widths
  VegasContent->>WeatherRenderers: Render current, hourly, and daily tiles
  WeatherRenderers-->>VegasContent: Return compact weather images
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: reducing the Vegas ticker width used for current weather conditions.
✨ 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/weather-vegas-compact-current

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 Aug 5, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity

Metric Results
Complexity 15

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.

claude added 5 commits August 5, 2026 18:29
The first cut of the Vegas tile was not the weather screen, just smaller.
Two things were lost, both of which carry meaning:

- Every optional metric. It rendered a fixed "UV/H/W" string, so
  feels-like, dew point, visibility and pressure vanished from the ticker
  regardless of the show_* toggles that are supposed to control them.
- The per-item colors. Metrics were flattened into one dim string, which
  drops the UV severity grading -- the one colour on that row that means
  something.

The tile now uses the same three rows in the same order as the
full-screen layout (condition, temperature with high/low, metrics), and
the metric list is built by a helper both renderers share, so the toggles
and colours cannot drift apart again. That is the same failure the
odds-ticker fix just dealt with: a second table that had to be kept in
step by hand, and wasn't.

Being faithful costs width, and the honest numbers are lower than the
first pass claimed: 308px against 512px with dew point and visibility off
(this device's config), 408px with every metric enabled -- not the 250px
of the version that was quietly dropping them.

The full-screen renderer now calls the shared helper too; its output is
pixel-identical to before the refactor, verified by image diff.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
I scoped these out of the first pass with the claim that they are
"genuinely multi-column and fill their width". Rendering them showed the
opposite, and they are the worse offenders:

    current conditions   49% inked   ~49px gaps    43% reclaimable
    hourly               28% inked    91px gaps    67% reclaimable
    daily                20% inked   136px gaps    77% reclaimable

Daily is 80% black. Both renderers lay their columns out as
`width // count`, so they inherit whatever width they are handed: three
days across a 512px panel puts 136px of nothing between each column.

Both now take an optional width, defaulting to the panel as before, and
the Vegas path passes one sized to the columns: 512px -> 272px for
hourly, 512px -> 204px for daily. Together with the current-conditions
tile the three come to 784px instead of 1536px on this device.

Same guard as before — `_compact_forecast_width()` returns None when
packing would not actually be narrower, and the caller falls back to the
panel-width render. At 256x64 hourly already fits, so only daily packs;
at 128x32 hourly stays as-is and daily gains 11%.

Normal rotation is untouched: all five modes render pixel-identical at
128x32, 256x64 and 512x64, verified by image diff.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
… a copy

The Vegas tile was a second layout that resembled the weather screen.
Reviewing it against the original showed why that is the wrong shape: it
had already lost the optional metrics and the UV colour once, and a
parallel layout is something someone has to keep in step by hand.

`_render_current_weather_image()` now takes an optional width, like the
two forecast renderers already do, and the Vegas path simply calls it
with a measured one. The condition/temperature/high-low stack
right-aligns to whatever width it is given and the metrics bar divides
that width, so a narrower canvas is the entire change: same icon, same
three-line stack, same bottom bar, drawn closer together.

Deletes ~90 lines of duplicated layout, and comes out narrower than the
hand-built version because the real layout packs better: 270px against
308px with this device's metric config, 378px against 408px with every
metric on.

Normal rotation stays pixel-identical for all five modes at 128x32,
256x64 and 512x64, verified by image diff.

Pre-existing and untouched: the amber temperature slightly overlaps the
tail of a long condition string. It does that at full width too, so
fixing it would change the normal rotation render, which this PR
deliberately leaves alone.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
Reported as the bottom stats being harder to read. The font is unchanged
-- extra_small_font, PressStart2P at 6px, in both paths -- but the
spacing was not.

The metrics bar centres each item in an equal section of whatever width
it is given, so narrowing the tile squeezes the items together. Sizing
the tile to the text plus 6px left a 15px minimum gap against the 63px of
the full-width bar: four times tighter, which is fine in a still image
and tiring to read scrolling past.

The compact width now reserves a real gap per item instead. 24px, as a
readability floor rather than a packing minimum -- MIN_METRIC_ITEM_WIDTH_PX
is where items start to collide, which is a long way below where a moving
row is comfortable.

Current conditions goes 270px -> 360px, minimum gap 15px -> 33px. Still
30% narrower than the panel on this device's metric config. With every
metric enabled seven items cannot be spaced legibly under ~500px, so the
tile is 504px and reclaims almost nothing -- the honest answer at that
density rather than a tighter unreadable one.

Normal rotation stays pixel-identical for all five modes at three sizes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
No code change. The figures in the previous note were measured with the
wrong font: my offline harness stubbed extra_small_font as PressStart2P
at 6px, but DisplayManager loads assets/fonts/4x6-font.ttf for it. That
is roughly 40% narrower -- "W:11g15S" is 29px, not the 48px I measured --
so every metrics-bar number I reported was inflated, and the renders I
produced showed the bottom row in the wrong typeface entirely.

The code was always right: _compact_current_width() measures with
self.display_manager.extra_small_font, so on a real device it has been
computing the correct width throughout. Only the harness and the
documentation were wrong.

Corrected: current conditions is 265px, not 360px (48% reclaimed rather
than 30%), and the three tiles come to 741px against 1536px. The gap the
metrics bar had before the readability fix was ~6px against 79px at full
width, not 15px against 63px.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Udr6MfaFLUPhX5Fgo67Jf5
@ChuckBuilds
ChuckBuilds merged commit 7369463 into main Aug 5, 2026
4 checks passed
@ChuckBuilds
ChuckBuilds deleted the fix/weather-vegas-compact-current branch August 5, 2026 23:36
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