review(2-5): code-review pass for per-aircraft drawing — add heading guard, close story

- 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 <noreply@anthropic.com>
This commit is contained in:
Matt Edholm
2026-04-22 23:29:22 -04:00
parent f530185e31
commit 48a3a1c7dd
4 changed files with 18 additions and 4 deletions
@@ -1,6 +1,6 @@
# Story 2.5: Per-Aircraft Drawing (Arrow, Label, Trail, MLAT) # Story 2.5: Per-Aircraft Drawing (Arrow, Label, Trail, MLAT)
Status: review Status: done
## Story ## Story
@@ -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` Story: `2-4-altitude-colour-bands-and-aircraft-type-icons`
Category: Technical debt Category: Technical debt
Description: `_CATEGORY_MAP` maps only ADS-B B-categories (B1B4) 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. Description: `_CATEGORY_MAP` maps only ADS-B B-categories (B1B4) 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 1214px (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.
@@ -35,7 +35,7 @@
# - Dev moves story to 'review', then runs code-review (fresh context, different LLM recommended) # - Dev moves story to 'review', then runs code-review (fresh context, different LLM recommended)
generated: 2026-04-22 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: planeMapper
project_key: NOKEY project_key: NOKEY
tracking_system: file-system tracking_system: file-system
@@ -57,7 +57,7 @@ development_status:
2-2-coordinate-projection-and-base-map-loading: done 2-2-coordinate-projection-and-base-map-loading: done
2-3-home-marker-and-airspace-outlines: done 2-3-home-marker-and-airspace-outlines: done
2-4-altitude-colour-bands-and-aircraft-type-icons: 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-6-stateful-renderer-and-display-interface: backlog
2-7-operational-radar-loop-startup-screen-and-systemd-wiring: backlog 2-7-operational-radar-loop-startup-screen-and-systemd-wiring: backlog
epic-2-retrospective: optional epic-2-retrospective: optional
+1 -1
View File
@@ -78,5 +78,5 @@ def draw_aircraft(
colour = altitude_to_colour(aircraft.altitude_ft) colour = altitude_to_colour(aircraft.altitude_ft)
draw = ImageDraw.Draw(image) draw = ImageDraw.Draw(image)
_draw_trail(draw, trail) _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) _draw_label(draw, cx, cy, aircraft, colour)