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:
@@ -7,6 +7,7 @@
|
||||
#include "menu_stars.h"
|
||||
#include "config.h"
|
||||
#include "i18n.h"
|
||||
#include "units.h"
|
||||
|
||||
namespace LocationPresetsScreen {
|
||||
|
||||
@@ -602,8 +603,14 @@ void run(TFT_eSPI& tft) {
|
||||
}
|
||||
nearest = AirportLookup::findNearest(activeLat, activeLon);
|
||||
if (nearest.found) {
|
||||
// Respektiert jetzt die Einheiten-Einstellung (Menue >
|
||||
// Einheiten) - vorher immer "(XX km)", auch bei Imperial.
|
||||
char buf[48];
|
||||
snprintf(buf, sizeof(buf), "%s %s (%.0f km)", nearest.icao, nearest.name, nearest.distanceKm);
|
||||
if (LocationManager::useMetricUnits()) {
|
||||
snprintf(buf, sizeof(buf), "%s %s (%.0f km)", nearest.icao, nearest.name, nearest.distanceKm);
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf), "%s %s (%.0f nm)", nearest.icao, nearest.name, Units::kmToNm(nearest.distanceKm));
|
||||
}
|
||||
String line = String(I18n::t(StringId::LOCATION_NEAREST_AIRPORT_PREFIX)) + buf;
|
||||
setupMarquee(tft, line, AIRPORT_LINE_W);
|
||||
drawMarquee(tft, AIRPORT_LINE_X, airportLineY, AIRPORT_LINE_W, 20);
|
||||
|
||||
Reference in New Issue
Block a user