From 6ca1c766ef95fd4261ea283fc6bb6a09897a7962 Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Wed, 3 Jun 2026 08:32:32 +0200 Subject: [PATCH] feat(nav): navigate to a node from Nearby MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Phase 6. In a node's detail view, Enter (when the ping popup is closed) opens the shared NavView targeting that node's last-known advert position — same To/Hdg/distance screen used by waypoints. Nodes with no position report "No node GPS". This turns Nearby from a static snapshot into a "walk toward this person" view and folds in the old compass-to-contact idea. Co-Authored-By: Claude Opus 4.8 --- .../companion_radio/ui-new/NearbyScreen.h | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/examples/companion_radio/ui-new/NearbyScreen.h b/examples/companion_radio/ui-new/NearbyScreen.h index 97069ef0..a394e7b2 100644 --- a/examples/companion_radio/ui-new/NearbyScreen.h +++ b/examples/companion_radio/ui-new/NearbyScreen.h @@ -1,6 +1,7 @@ #pragma once #include #include "../GeoUtils.h" +#include "NavView.h" #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -31,6 +32,7 @@ class NearbyScreen : public UIScreen { int _sel; int _scroll; bool _detail; + bool _nav = false; // full-screen navigate-to-node view (over detail) int32_t _own_lat, _own_lon; bool _own_gps; uint8_t _filter; @@ -536,6 +538,7 @@ public: void enter() { _sel = _scroll = 0; _detail = false; + _nav = false; _filter = 0; _discover_mode = false; _ddetail = false; @@ -570,6 +573,15 @@ public: _detail_refresh_ms = millis(); } + // ── navigate-to-node view ──────────────────────────────────────────────── + if (_nav && _sel < _count) { + const Entry& e = _entries[_sel]; + int cog; bool cogv = _task->currentCourse(cog); + navview::draw(display, _own_gps, _own_lat, _own_lon, + e.lat_e6, e.lon_e6, e.name, cogv, cog); + return 1000; + } + // ── detail view ────────────────────────────────────────────────────────── if (_detail && _sel < _count) { renderStoredDetail(display); @@ -632,16 +644,30 @@ public: // ── discover sub-screen ────────────────────────────────────────────────── if (_discover_mode) return handleInputDiscover(c); + // ── navigate-to-node view — any nav key returns to detail ───────────────── + if (_nav) { + if (c == KEY_CANCEL || c == KEY_LEFT || c == KEY_PREV || + c == KEY_RIGHT || c == KEY_NEXT) { _nav = false; } + return true; + } + // ── detail view ───────────────────────────────────────────────────────── if (_detail) { - if (c == KEY_CANCEL) { - _detail = false; + if (c == KEY_CANCEL) { + _detail = false; closePingMenu(); - return true; + return true; } uint8_t pub_key[PUB_KEY_SIZE]; if (selectedStoredPubKey(pub_key) && handlePingMenuInput(c, pub_key)) return true; + + // Enter (ping menu closed) → navigate to this node's last-known position. + if (c == KEY_ENTER && _sel < _count) { + const Entry& e = _entries[_sel]; + if (e.lat_e6 != 0 || e.lon_e6 != 0) _nav = true; + else _task->showAlert("No node GPS", 1000); + } return true; }