Respect Metric/Imperial unit setting in radar range button, ring labels, aircraft list, nearest airport, and stats
Five places ignored the Units setting (Menu > Units) and always showed fixed metric values even when Imperial was selected: the radar range button (now km/nm), the radar's ring distance labels (now km/nm), the aircraft list's altitude/distance columns (now m+km or ft+nm), the Location Presets screen's nearest-airport distance (now km/nm), and the Stats screen's highest-altitude-today line (now m or ft). The range button had already been touched previously but used "mi" instead of "nm" - aligned to nm here for consistency with the other distance displays, which all pair with km rather than miles. The radar detail panel's simultaneous multi-unit display and the climb/descent rate (always ft/min, aviation convention) are intentionally left unchanged. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -471,10 +471,16 @@ namespace {
|
||||
gfx.drawString("S", L.cx, L.cy + L.radius - 10);
|
||||
gfx.drawString("E", L.cx + L.radius - 10, L.cy);
|
||||
gfx.drawString("W", L.cx - L.radius + 10, L.cy);
|
||||
// Ring-Beschriftungen (Zwischenabstaende) respektieren jetzt die
|
||||
// Einheiten-Einstellung (Menue > Einheiten) - vorher immer in km,
|
||||
// auch wenn Imperial (nm) eingestellt war. Gleiches Umrechnungs-
|
||||
// Muster wie beim Range-Button unten und der Legende oben.
|
||||
bool metric = LocationManager::useMetricUnits();
|
||||
float displayRange = metric ? rangeKm : Units::kmToNm(rangeKm);
|
||||
char ringLabel[8];
|
||||
snprintf(ringLabel, sizeof(ringLabel), "%.0f", rangeKm / 3);
|
||||
snprintf(ringLabel, sizeof(ringLabel), "%.0f", displayRange / 3);
|
||||
gfx.drawString(ringLabel, L.cx, L.cy - L.radius / 3);
|
||||
snprintf(ringLabel, sizeof(ringLabel), "%.0f", rangeKm * 2 / 3);
|
||||
snprintf(ringLabel, sizeof(ringLabel), "%.0f", displayRange * 2 / 3);
|
||||
gfx.drawString(ringLabel, L.cx, L.cy - L.radius * 2 / 3);
|
||||
gfx.setTextDatum(TL_DATUM);
|
||||
}
|
||||
@@ -779,14 +785,14 @@ void render(TFT_eSPI& tft, int16_t top) {
|
||||
int16_t infoTextW = L.rangeBtn.x - INFO_TEXT_X - INFO_TEXT_GAP;
|
||||
drawInfoMarquee(tft, INFO_TEXT_X, infoTextY, infoTextW);
|
||||
|
||||
// Respektiert jetzt die Einheiten-Einstellung (Menue > Einheiten) -
|
||||
// vorher immer "XXkm", auch bei Imperial (dort jetzt "XXnm").
|
||||
char rangeLabel[8];
|
||||
// Zeigt km bei Metrisch, mi bei Imperial (Menue > Einheiten) -
|
||||
// gleiches Muster wie drawLegend() weiter oben, statt fest immer
|
||||
// km anzuzeigen.
|
||||
if (LocationManager::useMetricUnits()) {
|
||||
bool rangeMetric = LocationManager::useMetricUnits();
|
||||
if (rangeMetric) {
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fkm", rangeKm);
|
||||
} else {
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fmi", Units::kmToMi(rangeKm));
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fnm", Units::kmToNm(rangeKm));
|
||||
}
|
||||
drawButton(tft, L.rangeBtn, rangeLabel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user