Skip to content

Commit 067939c

Browse files
authored
Correct altitudeLine getting clobbered in the great merge (#8138)
* Correct altitudeLine getting clobbered in the great merge * Fix variable usage in altitude calculation
1 parent 2b60bae commit 067939c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/graphics/draw/UIRenderer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,18 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU
11051105
// === Fourth Row: Line 2 GPS Info ===
11061106
UIRenderer::drawGpsCoordinates(display, x, getTextPositions(display)[line++], gpsStatus, "line2");
11071107
}
1108+
1109+
// === Final Row: Altitude ===
1110+
char altitudeLine[32] = {0};
1111+
int32_t alt = (strcmp(displayLine, "Phone GPS") == 0 && ourNode && nodeDB->hasValidPosition(ourNode))
1112+
? ourNode->position.altitude
1113+
: geoCoord.getAltitude();
1114+
if (config.display.units == meshtastic_Config_DisplayConfig_DisplayUnits_IMPERIAL) {
1115+
snprintf(altitudeLine, sizeof(altitudeLine), "Alt: %.0fft", alt * METERS_TO_FEET);
1116+
} else {
1117+
snprintf(altitudeLine, sizeof(altitudeLine), "Alt: %.0im", alt);
1118+
}
1119+
display->drawString(x, getTextPositions(display)[line++], altitudeLine);
11081120
}
11091121
#if !defined(M5STACK_UNITC6L)
11101122
// === Draw Compass if heading is valid ===

0 commit comments

Comments
 (0)