From 459c2c3b126020093fbcfb2ee3ec0233e02d69b1 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Thu, 4 Jun 2026 00:04:11 +0200 Subject: [PATCH] feat(nav/map): show two label characters beside a waypoint marker One character was too ambiguous to tell adjacent waypoints apart on the map. Draw the first two characters of the label (falling back to one when the label is a single char) in both the normal and degenerate map paths, and widen the right-edge fit guard to the rendered text width. Co-Authored-By: Claude Opus 4.8 --- docs/solo_features/tools_screen/tools_screen.md | 2 +- examples/companion_radio/ui-new/TrailScreen.h | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/solo_features/tools_screen/tools_screen.md b/docs/solo_features/tools_screen/tools_screen.md index 95369c3a..044c4428 100644 --- a/docs/solo_features/tools_screen/tools_screen.md +++ b/docs/solo_features/tools_screen/tools_screen.md @@ -109,7 +109,7 @@ A waypoint is a saved spot — your car, camp, a water source — that you can n **Dropping a waypoint** — **Hold Enter → Mark here**. This captures the current GPS fix and opens the on-screen keyboard for a short label (up to 11 characters — e.g. `CAR`, `CAMP`, `H2O`). Leaving it blank auto-names it `WP1`, `WP2`, … Marking works whether or not the trail is being recorded; it needs a GPS fix (otherwise it reports *No GPS fix*). -**On the map** — saved waypoints show on the Trail Map view as a hollow diamond with the label's first character beside it. The map's bounding box always includes them, so off-track waypoints stay in frame; the map even renders waypoints when no trail is recorded. +**On the map** — saved waypoints show on the Trail Map view as a hollow diamond with the label's first two characters beside it (enough to tell nearby waypoints apart). The map's bounding box always includes them, so off-track waypoints stay in frame; the map even renders waypoints when no trail is recorded. **Navigating** — **Hold Enter → Waypoints** opens the list (each row shows the label and live distance). The list always begins with a synthetic **Trail start** row whenever a trail exists, so you can backtrack to where you began without having marked it. Select a row and press **Enter** to open the navigation view: diff --git a/examples/companion_radio/ui-new/TrailScreen.h b/examples/companion_radio/ui-new/TrailScreen.h index da4e9d8b..c1a5304a 100644 --- a/examples/companion_radio/ui-new/TrailScreen.h +++ b/examples/companion_radio/ui-new/TrailScreen.h @@ -694,8 +694,8 @@ private: if (nwp > 0) { drawWaypointMarker(display, ccx, ccy); const char* lbl = wp.at(0).label; // single coincident spot — label it - if (lbl[0] && ccx + 4 + display.getCharWidth() <= area_x + area_w) { - char s[2] = { lbl[0], 0 }; + char s[3] = { lbl[0], lbl[0] ? lbl[1] : (char)0, 0 }; + if (s[0] && ccx + 4 + (int)display.getTextWidth(s) <= area_x + area_w) { display.setCursor(ccx + 4, ccy - 3); display.print(s); } @@ -753,14 +753,15 @@ private: drawStartMarker(display, sx, sy); } - // Waypoints, with the label's first character beside the marker. + // Waypoints, with the first two label characters beside the marker so + // nearby waypoints can be told apart. for (int i = 0; i < nwp; i++) { const Waypoint& w = wp.at(i); int wx, wy; projectLL(w.lat_1e6, w.lon_1e6, wx, wy); drawWaypointMarker(display, wx, wy); - if (w.label[0] && wx + 3 + display.getCharWidth() <= area_x + area_w) { - char s[2] = { w.label[0], 0 }; - display.setCursor(wx + 3, wy - 3); + char s[3] = { w.label[0], w.label[0] ? w.label[1] : (char)0, 0 }; + if (s[0] && wx + 4 + (int)display.getTextWidth(s) <= area_x + area_w) { + display.setCursor(wx + 4, wy - 3); display.print(s); } }