mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-08-03 10:46: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:
@@ -18,7 +18,8 @@ inline void draw(DisplayDriver& d,
|
||||
bool own_valid, int32_t own_lat, int32_t own_lon,
|
||||
int32_t tgt_lat, int32_t tgt_lon,
|
||||
const char* label,
|
||||
bool cog_valid, int cog_deg) {
|
||||
bool cog_valid, int cog_deg,
|
||||
bool imperial) {
|
||||
const int cx = d.width() / 2;
|
||||
const int hdr = d.headerH();
|
||||
|
||||
@@ -40,7 +41,7 @@ inline void draw(DisplayDriver& d,
|
||||
int to_deg = geo::bearingDeg(own_lat, own_lon, tgt_lat, tgt_lon);
|
||||
float dist_km = geo::haversineKm(own_lat, own_lon, tgt_lat, tgt_lon);
|
||||
char dist[12];
|
||||
geo::fmtDist(dist, sizeof(dist), dist_km);
|
||||
geo::fmtDist(dist, sizeof(dist), dist_km, imperial);
|
||||
|
||||
const int step = d.lineStep();
|
||||
int y = hdr + 2;
|
||||
|
||||
Reference in New Issue
Block a user