mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-04 03:06:12 +00:00
feat(units): global metric/imperial setting for all distance displays
Add a single "Units" choice (Settings › System: Metric / Imperial) that governs every distance and speed shown in Tools — Nearby Nodes, the Trail views, and the navigate-to-point screen. - NodePrefs: units_imperial (global) + trail_show_pace (Trail readout mode), schema bumped 0xC0DE0005 → 0006. The old combined trail_units_idx is kept for file-layout stability but no longer drives anything; upgraders default to metric + speed. - geo::fmtDist gains an imperial mode (ft below ~1000 ft, then miles). - NavView / Nearby / Trail (waypoint list, Summary distance, List deltas, map scale-bar label) all format through the global preference. - Trail's action-menu "Units" row becomes a Speed/Pace readout toggle; the km-vs-mi unit now follows the global setting instead of being one of four combined options. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,7 @@ class SettingsScreen : public UIScreen {
|
||||
SECTION_SYSTEM,
|
||||
TIMEZONE,
|
||||
LOW_BAT,
|
||||
UNITS,
|
||||
// Contacts section
|
||||
SECTION_CONTACTS, DM_FILTER, CH_FILTER, ROOM_FILTER,
|
||||
// Messages section
|
||||
@@ -486,6 +487,10 @@ class SettingsScreen : public UIScreen {
|
||||
display.print("LowBat");
|
||||
display.setCursor(display.valCol(), y);
|
||||
display.print(LOW_BAT_LABELS[lowBatIndex()]);
|
||||
} else if (item == UNITS) {
|
||||
display.print("Units");
|
||||
display.setCursor(display.valCol(), y);
|
||||
display.print((p && p->units_imperial) ? "Imperial" : "Metric");
|
||||
} else if (item == BATT_DISPLAY) {
|
||||
display.print("BattDisp");
|
||||
display.setCursor(display.valCol(), y);
|
||||
@@ -732,6 +737,11 @@ public:
|
||||
if (left) idx = (idx + LOW_BAT_COUNT - 1) % LOW_BAT_COUNT;
|
||||
if (left || right) { p->low_batt_mv = LOW_BAT_OPTS[idx]; _dirty = true; return true; }
|
||||
}
|
||||
if (_selected == UNITS && p && (left || right || enter)) {
|
||||
p->units_imperial ^= 1;
|
||||
_dirty = true;
|
||||
return true;
|
||||
}
|
||||
if (_selected == BATT_DISPLAY && p) {
|
||||
int idx = p->batt_display_mode < BATT_DISPLAY_COUNT ? p->batt_display_mode : 0;
|
||||
if (right) idx = (idx + 1) % BATT_DISPLAY_COUNT;
|
||||
|
||||
Reference in New Issue
Block a user