From 32ffcb18a3d09d2876ac01a20f0f487af97a940f Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Wed, 3 Jun 2026 23:49:26 +0200 Subject: [PATCH] feat(nav): "Clear waypoints" action in Trail menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a bulk clear for saved waypoints (Trail → Hold Enter → Clear waypoints), shown only when at least one waypoint exists. Independent of the trail — Reset trail still leaves waypoints intact; this is the explicit way to wipe them all instead of deleting one by one. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/ui-new/TrailScreen.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/examples/companion_radio/ui-new/TrailScreen.h b/examples/companion_radio/ui-new/TrailScreen.h index 140a450b..28039982 100644 --- a/examples/companion_radio/ui-new/TrailScreen.h +++ b/examples/companion_radio/ui-new/TrailScreen.h @@ -38,9 +38,9 @@ class TrailScreen : public UIScreen { // (Start/Stop tracking, Reset). PopupMenu stores label pointers verbatim, so // the labels live in member buffers that get refreshed in openActionMenu() // and after every LEFT/RIGHT cycle. - enum ActionId { ACT_MIN_DIST, ACT_UNITS, ACT_GRID, ACT_TOGGLE, ACT_SAVE, ACT_LOAD, ACT_RESET, ACT_EXPORT, ACT_EXPORT_SAVED, ACT_MARK, ACT_WAYPOINTS }; + enum ActionId { ACT_MIN_DIST, ACT_UNITS, ACT_GRID, ACT_TOGGLE, ACT_SAVE, ACT_LOAD, ACT_RESET, ACT_EXPORT, ACT_EXPORT_SAVED, ACT_MARK, ACT_WAYPOINTS, ACT_WP_CLEAR }; PopupMenu _action_menu; - uint8_t _act_map[14]; // 11 used today; pad so adding an action doesn't OOB + uint8_t _act_map[14]; // 12 used today; pad so adding an action doesn't OOB uint8_t _act_count = 0; char _act_min_dist_label[24]; char _act_units_label[24]; @@ -183,6 +183,8 @@ public: else if (act == ACT_EXPORT_SAVED) { handleExportSaved(); } else if (act == ACT_MARK) { handleMarkHere(); } else if (act == ACT_WAYPOINTS) { _wp_mode = WP_LIST; _wp_sel = 0; _wp_scroll = 0; } + else if (act == ACT_WP_CLEAR) { _task->waypoints().clear(); _task->saveWaypoints(); + _task->showAlert("Waypoints cleared", 800); } else /* MIN_DIST / UNITS */ { reopenAt(sel); return true; } // re-open keeping focus } if (_cfg_dirty) { the_mesh.savePrefs(); _cfg_dirty = false; } @@ -316,6 +318,9 @@ private: if (_task->waypoints().count() > 0 || !_store->empty()) { _act_map[_act_count++] = ACT_WAYPOINTS; _action_menu.addItem("Waypoints"); } + if (_task->waypoints().count() > 0) { + _act_map[_act_count++] = ACT_WP_CLEAR; _action_menu.addItem("Clear waypoints"); + } if (!_store->empty()) { _act_map[_act_count++] = ACT_SAVE; _action_menu.addItem("Save trail"); }