Skip to content

Make the focus strip resolution-flexible (fix 176x176 layout)#454

Merged
brickbots merged 1 commit into
mainfrom
fix/focus-strip-resolution-independent
Jun 5, 2026
Merged

Make the focus strip resolution-flexible (fix 176x176 layout)#454
brickbots merged 1 commit into
mainfrom
fix/focus-strip-resolution-independent

Conversation

@brickbots
Copy link
Copy Markdown
Owner

Problem

The focus-quality (HFD) focus strip is not fully resolution-independent. It was added in #449 before the resolution-flexible UI work in #453. #453 converted the camera preview's image resize and star selectors to derive from the display resolution, but never touched draw_focus_strip(), which kept 128-only pixel literals:

strip_top = 90        # bottom-band top edge
plot_top  = strip_top + 9
plot_bottom = res_y - 10
# bottom "det N" label at res_y - 9

On the 176×176 SSD1333 panel, strip_top = 90 lands mid-screen (~51% down) instead of as a bottom band: the exposure / matched-star labels are stranded high up with a large empty gap above the readout, and the bottom detected-star label clips at the screen edge.

Before / after (headless render)

128 (unchanged) 176 before 176 after
clean bottom band labels stranded mid-screen, big gap, det clipped proper proportional bottom band

On 176 before the fix, the dim band started ~halfway up the screen with 0.4s/ labels floating far above the big readout. After the fix it's a tidy bottom band matching the 128 proportions.

Fix

Derive the geometry instead of hardcoding it (per ADR 0009):

  • strip_top — a fixed fraction of screen height (res_y - round(res_y * 38 / 128)), so the band stays ~30% of the screen on any panel.
  • label-row clearances — derived from self.fonts.small.height, so the rows track the larger small font on the 176 panel and never collide with the V-curve.

Because the 128 small font is 9 px, strip_top + 9 == strip_top + small_h, res_y - 10 == res_y - small_h - 1, and res_y - 9 == res_y - small_hthe 128 layout is reproduced pixel-for-pixel (zero regression) while the 176 layout becomes a correct proportional bottom band.

Verification

  • Rendered the Focus screen headless on both DisplayHeadless (128×128) and DisplayHeadless176 (176×176) and confirmed the strip is a clean bottom band on each, with no stranded labels or clipping.
  • nox -s lint / format / type_hints (158 files) all pass.
  • nox -s smoke_tests (5) and nox -s unit_tests (280, incl. test_focus.py) all pass.

Docs

Updates the docs/ax/ui/CONTEXT.md focus strip glossary entry, which described a fixed "~38 px" band, to note it scales with the display.

🤖 Generated with Claude Code

The focus-quality (HFD) strip was added in #449 before the
resolution-flexible UI work in #453. #453 converted the camera preview's
image resize and star selectors to derive from the display resolution but
never touched draw_focus_strip(), which kept 128-only literals:

  strip_top = 90      # bottom-band top
  plot_top  = +9      # V-curve top clearance
  plot_bottom = -10   # V-curve bottom clearance
  bottom label = -9

On the 176x176 SSD1333 panel strip_top=90 lands mid-screen (~51% down)
instead of as a bottom band, stranding the exposure/matched-star labels
high up with a large empty gap above the readout, and the bottom
detected-star label clips at the screen edge.

Derive the geometry instead (ADR 0009):

  - strip_top: a fixed fraction of screen height (res_y - res_y*38/128),
    so the band stays ~30% of the screen on any panel.
  - label-row clearances: from self.fonts.small.height, so the rows track
    the (larger) small font on the 176 panel and never collide with the
    V-curve.

The 128 small font is 9 px, so strip_top+9 == strip_top+small_h,
res_y-10 == res_y-small_h-1, and res_y-9 == res_y-small_h: the 128 layout
is reproduced pixel-for-pixel (zero regression), while the 176 layout
becomes a correct proportional bottom band. Verified headless on both
DisplayHeadless (128) and DisplayHeadless176 (176).

Docs: update the CONTEXT.md focus-strip glossary entry, which described a
fixed "~38 px" band, to note it scales with the display.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@brickbots brickbots merged commit a90b0ce into main Jun 5, 2026
1 check passed
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