From 8d8fece89db069af6673cbd27250d509224f12cb Mon Sep 17 00:00:00 2001 From: Jm Casler Date: Sun, 19 Dec 2021 14:27:49 -0500 Subject: [PATCH 1/2] Update to show fixed gps alternating with location info. --- src/graphics/Screen.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index 702708c8..b9f8083f 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -428,16 +428,14 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const auto gpsFormat = radioConfig.preferences.gps_format; String displayLine = ""; - if (radioConfig.preferences.fixed_position) { - displayLine = "Fixed GPS"; - display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); - } else if (!gps->getIsConnected() && !radioConfig.preferences.fixed_position) { + if (!gps->getIsConnected() && !radioConfig.preferences.fixed_position) { displayLine = "No GPS Module"; display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); } else if (!gps->getHasLock() && !radioConfig.preferences.fixed_position) { displayLine = "No GPS Lock"; display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); } else { + if (gpsFormat != GpsCoordinateFormat_GpsFormatDMS) { char coordinateLine[22]; geoCoord.updateCoords(int32_t(gps->getLatitude()), int32_t(gps->getLongitude()), int32_t(gps->getAltitude())); @@ -459,7 +457,17 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const geoCoord.getOSGREasting(), geoCoord.getOSGRNorthing()); } - display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine); + // If fixed position, display text "Fixed GPS" alternating with the coordinates. + if (radioConfig.preferences.fixed_position) { + if ((millis() / 10000) % 2) { + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + } else { + displayLine = "Fixed GPS"; + } + } else { + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine); + } + } else { char latLine[22]; char lonLine[22]; From 9f63a8c33091db8d1e5766715e8cd7b43acc4817 Mon Sep 17 00:00:00 2001 From: Sam <35611307+syund@users.noreply.github.com> Date: Sun, 19 Dec 2021 14:55:57 -0500 Subject: [PATCH 2/2] Fix coordinates not displaying when fixed --- src/graphics/Screen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index b9f8083f..f0221e74 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -460,9 +460,9 @@ static void drawGPScoordinates(OLEDDisplay *display, int16_t x, int16_t y, const // If fixed position, display text "Fixed GPS" alternating with the coordinates. if (radioConfig.preferences.fixed_position) { if ((millis() / 10000) % 2) { - display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(displayLine))) / 2, y, displayLine); + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine); } else { - displayLine = "Fixed GPS"; + display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth("Fixed GPS"))) / 2, y, "Fixed GPS"); } } else { display->drawString(x + (SCREEN_WIDTH - (display->getStringWidth(coordinateLine))) / 2, y, coordinateLine);