Add 12h/AM-PM clock format for Imperial units, add miles to distance display
The header clock now shows 12-hour time with AM/PM when Imperial units are selected (Menu > Units), instead of always using 24-hour format - the clock-clear region was widened from 50px to 80px to fully erase the longer "12:59PM"-style text. The aircraft detail panel's distance line now also shows miles alongside km and nautical miles (e.g. "12km / 6nm / 7mi"), since nm alone wasn't self-explanatory for lay users from Imperial-unit countries. Also fixes the radar screen's range button, which still always showed a fixed "km" label regardless of the Metric/Imperial setting - it now shows mi (converted) when Imperial is selected, matching the pattern already used by the altitude legend. Refreshes firmware.bin to match this build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -541,8 +541,14 @@ namespace {
|
||||
updateLine(gfx, y, LINE_H, textMaxWidth, TFT_GREEN, lastPanel.climbText, climbLine, forceFull);
|
||||
y += LINE_H;
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s%.0fkm / %.0fnm %s%.0f", I18n::t(StringId::DETAIL_DIST),
|
||||
a.distanceKm, Units::kmToNm(a.distanceKm), I18n::t(StringId::DETAIL_HDG), a.headingDeg);
|
||||
// Zusaetzlich zu km/nm auch Meilen (mi) - nm allein war fuer
|
||||
// Laien-Nutzer aus Ländern mit imperialen Einheiten (v.a. USA)
|
||||
// nicht selbsterklaerend, "Meilen" sind dort die gebraeuchlichere
|
||||
// Alltags-Distanzeinheit (nm bleibt trotzdem stehen, da es zur
|
||||
// Geschwindigkeit in kt passt: 1 kt = 1 nm/h).
|
||||
snprintf(buf, sizeof(buf), "%s%.0fkm / %.0fnm / %.0fmi %s%.0f", I18n::t(StringId::DETAIL_DIST),
|
||||
a.distanceKm, Units::kmToNm(a.distanceKm), Units::kmToMi(a.distanceKm),
|
||||
I18n::t(StringId::DETAIL_HDG), a.headingDeg);
|
||||
updateLine(gfx, y, LINE_H, textMaxWidth, TFT_GREEN, lastPanel.distHeadingText, String(buf), forceFull);
|
||||
y += LINE_H;
|
||||
|
||||
@@ -750,7 +756,14 @@ void render(TFT_eSPI& tft, int16_t top) {
|
||||
drawInfoMarquee(tft, INFO_TEXT_X, infoTextY, infoTextW);
|
||||
|
||||
char rangeLabel[8];
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fkm", rangeKm);
|
||||
// Zeigt km bei Metrisch, mi bei Imperial (Menue > Einheiten) -
|
||||
// gleiches Muster wie drawLegend() weiter oben, statt fest immer
|
||||
// km anzuzeigen.
|
||||
if (LocationManager::useMetricUnits()) {
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fkm", rangeKm);
|
||||
} else {
|
||||
snprintf(rangeLabel, sizeof(rangeLabel), "%.0fmi", Units::kmToMi(rangeKm));
|
||||
}
|
||||
drawButton(tft, L.rangeBtn, rangeLabel);
|
||||
|
||||
drawLegend(tft, infoTop + 44);
|
||||
|
||||
Reference in New Issue
Block a user