mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-05 19:56:11 +00:00
refactor: dedup persistence header, harden action menu, tidy small items
- Persist.h: shared writeHeader()/readHeader() for the magic+version+count
on-disk header; Waypoint and Trail snapshots now share one implementation
(byte layout unchanged; each keeps its own count clamp/reject + extra fields).
- TrailScreen: pushAction() guards _act_map / PopupMenu capacity, so adding a
new action can't silently overrun the fixed array.
- PopupMenu: add count()/setSelected() accessors; replace the remaining direct
_sel/_count field pokes in NearbyScreen, TrailScreen and QuickMsgScreen.
- Trail summary: unit-suffixed time ("1h 05m" / "5m 03s") so hours can't be
misread as minutes.
- Trail::haversineMeters delegates to geo::haversineKm — single Haversine
implementation (also trims a little flash).
Verified: GAT562 (SSD1306) and WioTrackerL1Eink (GxEPD) solo builds compile clean.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
151892e1ce
commit
b8a7b5dcc0
@@ -196,13 +196,13 @@ class NearbyScreen : public UIScreen {
|
||||
}
|
||||
|
||||
void rebuildPingMenu() {
|
||||
int keep = _ping_menu._sel; // preserve selection across a rebuild
|
||||
int keep = _ping_menu.selectedIndex(); // preserve selection across a rebuild
|
||||
_ping_menu.begin("Ping", 4);
|
||||
_ping_menu.addItem("Send");
|
||||
if (_ping_time_str[0]) _ping_menu.addItem(_ping_time_str);
|
||||
if (_ping_snr_out_str[0]) _ping_menu.addItem(_ping_snr_out_str);
|
||||
if (_ping_snr_back_str[0]) _ping_menu.addItem(_ping_snr_back_str);
|
||||
if (keep > 0 && keep < _ping_menu._count) _ping_menu._sel = keep;
|
||||
_ping_menu.setSelected(keep);
|
||||
}
|
||||
|
||||
void openPingMenu() { rebuildPingMenu(); }
|
||||
@@ -261,7 +261,7 @@ class NearbyScreen : public UIScreen {
|
||||
}
|
||||
// Keep the menu in sync with the populated result lines (grows as the
|
||||
// reply arrives; never shows blank rows).
|
||||
if (pingRowCount() != _ping_menu._count) rebuildPingMenu();
|
||||
if (pingRowCount() != _ping_menu.count()) rebuildPingMenu();
|
||||
}
|
||||
|
||||
bool handlePingMenuInput(char c, const uint8_t* pub_key, bool allow_enter_to_open = false) {
|
||||
|
||||
Reference in New Issue
Block a user