From b5361ef89fcccd208d51772b8a13b55aca5f53d8 Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sat, 26 Sep 2020 18:37:51 -0700 Subject: [PATCH] Display gps altitude on display #443 --- src/graphics/Screen.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 0706ddb44..572912ff1 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -241,6 +241,23 @@ static void drawGPS(OLEDDisplay *display, int16_t x, int16_t y, const GPSStatus } } +//asdf +static void drawGPSAltitude(OLEDDisplay *display, int16_t x, int16_t y, const GPSStatus *gps) +{ + String displayLine = ""; + if (!gps->getIsConnected()) { + //displayLine = "No GPS Module"; + //display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + } else if (!gps->getHasLock()) { + //displayLine = "No GPS Lock"; + //display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + } else { + + displayLine = "Altitude: " + String(gps->getAltitude()) + "m"; + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + } +} + // Draw GPS status coordinates static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const GPSStatus *gps) { @@ -1012,6 +1029,8 @@ void DebugInfo::drawFrameSettings(OLEDDisplay *display, OLEDDisplayUiState *stat String(days) + "d " + (hours < 10 ? "0" : "") + String(hours) + ":" + (minutes < 10 ? "0" : "") + String(minutes) + ":" + (seconds < 10 ? "0" : "") + String(seconds)); + drawGPSAltitude(display, x, y + FONT_HEIGHT * 2, gpsStatus); + // Line 4 drawGPScoordinates(display, x, y + FONT_HEIGHT * 3, gpsStatus);