Skip to content

feat(hud): camera markers on the map and a configurable approach popup - #19

Closed
bobczan wants to merge 7 commits into
pxwel-dev:mainfrom
bobczan:feat/camera-markers-popup
Closed

bobczan wants to merge 7 commits into
pxwel-dev:mainfrom
bobczan:feat/camera-markers-popup

Conversation

@bobczan

@bobczan bobczan commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What

  • Draw every camera of the active region at its real coordinates with a UK-style sign (black rounded border, white face, plain camera with lens ring), with or without an active route, in driving view and Explore, from Z2. Markers are filtered by
    egion_iso, so cameras across a border never appear.
  • Replace the bottom strip alert with a compact 156x142 approach card: 72 px sign, name and distance, drawn from 400 m and hidden after passing. The bottom strip no longer competes with the road-name card.
  • New Settings -> Camera popup: Off / Left / Right (persisted as campopup, default Left). This is the requested placement control: the card must not cover the speed limit, and the driver chooses which side keeps the road visible.
  • Marker size 20 px at Z4+, 16 px below; hidden under Z2 where it would be clutter.
  • Day and night palettes for the card (light amber by day, deep amber at night).

The popup is suppressed while a menu or modal is open and outside the map screen.

Verification

  • gcc -fsyntax-only clean against 2.2.6.3.
  • Placement, colours and geometry were previewed against the production 2.2.6.3 HUD before coding; the card uses the same HUD primitives (
    ound_rect, hud_disc, compact_center).

Not in this PR

Renatka-specific branding and the red-circle limit rendering live in a separate fork branch and are not proposed upstream.

Open question

Should the popup distance threshold stay at 400 m, or follow the existing service range (700 m without a route, 1200 m with one)? I kept 400 m because the card is large and covers part of the map.

Draw every camera in the active region at its real coordinates with a UK-style sign, with or without an active route, from Z2. Replace the bottom strip alert with a compact 156x142 card on the left or right screen edge, shown from 400 m and hidden once passed, so the speed limit stays unobstructed.

Settings -> Camera popup offers Off / Left / Right and persists as campopup in prefs.ini, default Left. Markers are filtered by the active region ISO so cameras across a border never appear.
The preview harness zero-initialises prefs, so a missing campopup read as 0 and the popup was suppressed (and Off was unreachable). Encode 0=Left (default), 1=Right, 2=Off so a zero-initialised prefs block still shows the card. The gallery fixture now pins screen/modal and keeps the camera state across draw(), so preview stills show the popup.
@bobczan

bobczan commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Fixes from rendering the previews on real 2.2.6.3 code

Rendering the production draw() path with the gallery harness exposed two issues, now fixed in e8bf748:

  1. Popups disappeared with a zero-initialised prefs block. campopup was encoded as 0 = Off, 1 = Left, 2 = Right, so any host/preview or prefs file without the key read as Off, and Off was unreachable through the UI cycle. Re-encoded as 0 = Left (default), 1 = Right, 2 = Off, so the absence of the key gives the intended default instead of hiding the card.

  2. Preview stills could never show the popup. draw() calls camera_service() before compositing, which cleared the fixture camera state, and the fixture left modal set. The gallery now pins screen/modal, sets a camera_fixture flag that skips the service for that frame, and show_camera() keeps its distance/visibility.

Also confirmed in the same run: markers render at real atlas coordinates and are iso-filtered, the popup is left-middle by default, and the card clears the speed limit entirely.

Reference stills (day, camera-1 scene): marker at the top, popup on the left with "Speed camera / 30" and "200 yd", limit card untouched on the right.

The translation-coverage test requires every ui_tr() literal to exist in the locale table; the new popup setting introduced three missing keys and failed CI.
build_translations requires identical key sets; adds Left, Right and Camera popup to every language file and refreshes the generated table.
The 142 px card overlapped the Then/next-turn pills at the right edge; offset it 12 px upward so both remain readable.
Restores the existing strip alert and lets the side card use the same camera_visible timing, so both appear and clear together. This also keeps the road-pill contract the native HUD tests assert.
The settings-category test requires every setting to belong to exactly one group; Navigation is the natural home for the alert placement.
@pxwel-dev

Copy link
Copy Markdown
Owner

Thanks for putting this together @bobczan, I appreciate the initiative, though I'm going to pass on this PR rather than merge it as-is.
There are a few architectural and UX issues here that don't fit cleanly with ClioPlay's renderer and design:
Production render path: draw_camera_popup() is only hooked into draw()/draw_map(), whereas live head-unit frames run through frame_renderer.h (render_present() / overlay_frames.h), so the popup wouldn't appear on the car and isn't integrated with dirty-row tracking or the glass overlay system.
Country policy & SD I/O: draw_camera_markers() bypasses the region_flags & 2 legal camera-policy check and performs an unbounded camera_read() (lseek+read per record) loop over the SD card every map frame, which is too heavy for the ARM920T at 10 FPS.
HUD layout & behaviour: A flat opaque 156×142 card doesn't match the frosted-glass HUD, checks legacy modal rather than sheet_page (overlapping open menus/sheets and the GPS HUD / Then pill on the right), duplicates the bottom camera strip, and doesn't enforce the 400 m cap or handle average-speed zones cleanly.
Translations & testing: 15 of the 18 locales are left as English placeholders, production clio040.c carries a camera_fixture flag for the gallery harness, and there are no unit tests for the new setting or rendering path.
Map camera markers themselves are an interesting future idea, though if we add them upstream later they'll need to follow the country-policy guard, use a bounded RAM cache (no per-frame SD reads), distinguish camera types, and stay visually consistent with the existing glass HUD and POI icons.

@pxwel-dev pxwel-dev closed this Nov 25, 2026
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