From e578525a951510cff8b8ce30e79aa73f88a606cd Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Wed, 3 Jun 2026 08:36:41 +0200 Subject: [PATCH] fix(nav): drop nav view when target contact disappears; cap label entry Review fixes: - NearbyScreen: when the periodic detail refresh can't find the selected contact any more, clear _nav as well as _detail so the nav view and the input handler don't disagree about state. - TrailScreen: bound the label keyboard to WAYPOINT_LABEL_LEN-1 (11) chars for both Mark-here and Rename, so the user can't type more than the stored label holds. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/ui-new/NearbyScreen.h | 2 +- examples/companion_radio/ui-new/TrailScreen.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/companion_radio/ui-new/NearbyScreen.h b/examples/companion_radio/ui-new/NearbyScreen.h index a394e7b2..897406fe 100644 --- a/examples/companion_radio/ui-new/NearbyScreen.h +++ b/examples/companion_radio/ui-new/NearbyScreen.h @@ -569,7 +569,7 @@ public: if (_entries[i].contact_idx == saved_contact_idx) { _sel = i; found = true; break; } } } - if (!found) _detail = false; + if (!found) { _detail = false; _nav = false; } // contact gone — drop both views _detail_refresh_ms = millis(); } diff --git a/examples/companion_radio/ui-new/TrailScreen.h b/examples/companion_radio/ui-new/TrailScreen.h index 41876029..e96047d8 100644 --- a/examples/companion_radio/ui-new/TrailScreen.h +++ b/examples/companion_radio/ui-new/TrailScreen.h @@ -113,7 +113,7 @@ public: if (sel == 0) { // Rename if (_wp_sel < _task->waypoints().count()) { _kb_rename_idx = _wp_sel; - _wp_kb.begin(_task->waypoints().at(_wp_sel).label); + _wp_kb.begin(_task->waypoints().at(_wp_sel).label, WAYPOINT_LABEL_LEN - 1); _kb_active = true; } } else { // Delete @@ -356,7 +356,7 @@ private: if (_task->waypoints().full()) { _task->showAlert("Waypoints full", 1000); return; } _mark_lat = lat; _mark_lon = lon; _mark_ts = (uint32_t)rtc_clock.getCurrentTime(); _kb_rename_idx = -1; - _wp_kb.begin(""); + _wp_kb.begin("", WAYPOINT_LABEL_LEN - 1); _kb_active = true; }