feat(companion): widen Locator targeting beyond favourites/live-share

Locator's person target now resolves any known contact's position, not just
an active live [LOC] share: locatorDistance() falls back to the contact's
last-advertised gps_lat/gps_lon when there's no current live share, so a
rarely-updating but stationary node (a repeater, or someone who shared a fix
once) still works as a target. LocatorScreen's target picker is widened to
match (favourites always offered, plus every other contact with a currently
resolvable position), and shows a compact age tag for non-live entries so
staleness is visible.

Also adds a quick "Set Locator target" action directly from Nearby Nodes' and
Waypoints' own popup menus (UITask::setLocatorTarget()), so picking a target
doesn't require a detour through Tools > Locator.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekZegare4
2026-06-24 16:18:39 +02:00
co-authored by Claude Sonnet 4.6
parent 57f5346427
commit b7e7e945d2
6 changed files with 138 additions and 41 deletions
@@ -274,7 +274,7 @@ public:
if (_sel >= wpListCount()) _sel = wpListCount() - 1;
if (_sel < 0) _sel = 0;
}
} else { // Send (share in a message)
} else if (sel == 2) { // Send (share in a message)
if (wi >= 0 && wi < _task->waypoints().count()) {
const Waypoint& w = _task->waypoints().at(wi);
double lat = w.lat_1e6 / 1000000.0, lon = w.lon_1e6 / 1000000.0;
@@ -283,6 +283,11 @@ public:
else snprintf(text, sizeof(text), WAYPOINT_MSG_TAG "%.5f,%.5f", lat, lon);
_task->shareToMessage(text); // hands off to the Messages screen
}
} else { // Set Locator target
if (wi >= 0 && wi < _task->waypoints().count()) {
const Waypoint& w = _task->waypoints().at(wi);
_task->setLocatorTarget(0, nullptr, w.lat_1e6, w.lon_1e6, w.label);
}
}
}
return true;
@@ -336,13 +341,14 @@ public:
else _mode = NAV; // a waypoint / Trail-start row
return true;
}
// Rename/Delete/Send apply to saved waypoints only — not Trail-start or Add.
// Rename/Delete/Send/Locator apply to saved waypoints only — not Trail-start or Add.
if (c == KEY_CONTEXT_MENU && !selIsStart() && _sel != n &&
wpIndex() >= 0 && wpIndex() < _task->waypoints().count()) {
_ctx.begin("Waypoint", 3);
_ctx.begin("Waypoint", 4);
_ctx.addItem("Rename");
_ctx.addItem("Delete");
_ctx.addItem("Send");
_ctx.addItem("Locator target");
return true;
}
return true;