From 48a3a1c7ddd4d86403600898ba3297ee48abad90 Mon Sep 17 00:00:00 2001 From: Matt Edholm Date: Wed, 22 Apr 2026 23:29:22 -0400 Subject: [PATCH] =?UTF-8?q?review(2-5):=20code-review=20pass=20for=20per-a?= =?UTF-8?q?ircraft=20drawing=20=E2=80=94=20add=20heading=20guard,=20close?= =?UTF-8?q?=20story?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add `or 0.0` defensive guard on `aircraft.heading` in `draw_aircraft` per spec (task 1.6) - Story 2-5 status: review → done - Sprint status updated: 2-5-per-aircraft-drawing done - Deferred work: add [2-5] default font 8px readability risk and [2-5] inline arrow geometry constants Co-Authored-By: Claude Sonnet 4.6 --- .../2-5-per-aircraft-drawing.md | 2 +- .../implementation-artifacts/deferred-work.md | 14 ++++++++++++++ .../implementation-artifacts/sprint-status.yaml | 4 ++-- src/planemapper/renderer/aircraft.py | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/_bmad-output/implementation-artifacts/2-5-per-aircraft-drawing.md b/_bmad-output/implementation-artifacts/2-5-per-aircraft-drawing.md index 8969837..23fc7ec 100644 --- a/_bmad-output/implementation-artifacts/2-5-per-aircraft-drawing.md +++ b/_bmad-output/implementation-artifacts/2-5-per-aircraft-drawing.md @@ -1,6 +1,6 @@ # Story 2.5: Per-Aircraft Drawing (Arrow, Label, Trail, MLAT) -Status: review +Status: done ## Story diff --git a/_bmad-output/implementation-artifacts/deferred-work.md b/_bmad-output/implementation-artifacts/deferred-work.md index 0dadd12..c0a0702 100644 --- a/_bmad-output/implementation-artifacts/deferred-work.md +++ b/_bmad-output/implementation-artifacts/deferred-work.md @@ -134,3 +134,17 @@ Description: `_AIRLINE_PREFIXES` contains 23 hand-picked ICAO 3-letter designato Story: `2-4-altitude-colour-bands-and-aircraft-type-icons` Category: Technical debt Description: `_CATEGORY_MAP` maps only ADS-B B-categories (B1–B4) to `AircraftType.MILITARY`. Military aircraft that transmit A-category ADS-B codes (e.g. training jets advertising as A3) or no category at all will fall through to the callsign/altitude fallback and be misclassified. A military callsign prefix list (e.g. "RRR", "GAF", "USAF") would improve detection but is not required by any story AC. + +--- + +## Story 2.5: Per-Aircraft Drawing + +### [2-5] Default font is 8px — may be unreadable on physical hardware +Story: `2-5-per-aircraft-drawing` +Category: Technical debt +Description: `_draw_label` uses `ImageFont.load_default()` which renders at approximately 8px on the 800×480 display. Callsign and altitude labels may be too small to read at arm's length on the physical e-ink panel. Future hardening: load a bundled bitmap or TrueType font at 12–14px (e.g. Pillow's built-in `ImageFont.load_default(size=14)` on Pillow ≥10, or a small `.ttf` bundled under `src/planemapper/assets/`). + +### [2-5] Arrow geometry constants are hardcoded inline +Story: `2-5-per-aircraft-drawing` +Category: Technical debt +Description: Arrow tip distance (12px), base half-width (6px), and base offset (8px) are hardcoded inline in `_draw_arrow`. These control icon size and aspect ratio. For Pi Zero 2W or larger displays these values may need tuning. Future hardening: extract to named constants in `constants.py` (e.g. `ARROW_TIP`, `ARROW_BASE_HALF`, `ARROW_BASE_OFFSET`) so they can be adjusted without touching drawing logic. diff --git a/_bmad-output/implementation-artifacts/sprint-status.yaml b/_bmad-output/implementation-artifacts/sprint-status.yaml index 7ed1619..8af1cf5 100644 --- a/_bmad-output/implementation-artifacts/sprint-status.yaml +++ b/_bmad-output/implementation-artifacts/sprint-status.yaml @@ -35,7 +35,7 @@ # - Dev moves story to 'review', then runs code-review (fresh context, different LLM recommended) generated: 2026-04-22 -last_updated: 2026-04-22 # 2-1 done, 2-2 done, 2-3 done, 2-4 done, 2-5 review, epic-2 in-progress +last_updated: 2026-04-22 # 2-1 done, 2-2 done, 2-3 done, 2-4 done, 2-5 done, epic-2 in-progress project: planeMapper project_key: NOKEY tracking_system: file-system @@ -57,7 +57,7 @@ development_status: 2-2-coordinate-projection-and-base-map-loading: done 2-3-home-marker-and-airspace-outlines: done 2-4-altitude-colour-bands-and-aircraft-type-icons: done - 2-5-per-aircraft-drawing: review + 2-5-per-aircraft-drawing: done 2-6-stateful-renderer-and-display-interface: backlog 2-7-operational-radar-loop-startup-screen-and-systemd-wiring: backlog epic-2-retrospective: optional diff --git a/src/planemapper/renderer/aircraft.py b/src/planemapper/renderer/aircraft.py index e1b12b4..2753873 100644 --- a/src/planemapper/renderer/aircraft.py +++ b/src/planemapper/renderer/aircraft.py @@ -78,5 +78,5 @@ def draw_aircraft( colour = altitude_to_colour(aircraft.altitude_ft) draw = ImageDraw.Draw(image) _draw_trail(draw, trail) - _draw_arrow(draw, cx, cy, aircraft.heading, colour, aircraft.is_mlat) + _draw_arrow(draw, cx, cy, aircraft.heading or 0.0, colour, aircraft.is_mlat) _draw_label(draw, cx, cy, aircraft, colour)