From ca1e09d7805917d13cb1e6e9f92531235963a8fa Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Mon, 31 Mar 2025 00:33:01 -0400 Subject: [PATCH] Added GPS tittle --- src/graphics/Screen.cpp | 49 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/src/graphics/Screen.cpp b/src/graphics/Screen.cpp index b536c18b0..ecd1a8b1d 100644 --- a/src/graphics/Screen.cpp +++ b/src/graphics/Screen.cpp @@ -2340,16 +2340,55 @@ static void drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayUiStat // === Header === drawCommonHeader(display, x, y); + // === Draw title === + const int highlightHeight = FONT_HEIGHT_SMALL - 1; + const int textY = y + (highlightHeight - FONT_HEIGHT_SMALL) / 2; + const int screenWidth = display->getWidth(); + const char *titleStr = "GPS"; + const int centerX = x + SCREEN_WIDTH / 2; + + if (config.display.displaymode == meshtastic_Config_DisplayConfig_DisplayMode_INVERTED) { + display->setColor(BLACK); + } + + display->setTextAlignment(TEXT_ALIGN_CENTER); + display->drawString(centerX, textY, titleStr); + if (config.display.heading_bold) { + display->drawString(centerX + 1, textY, titleStr); + } + display->setColor(WHITE); + display->setTextAlignment(TEXT_ALIGN_LEFT); + // Row Y offset just like drawNodeListScreen int rowYOffset = FONT_HEIGHT_SMALL - 3; int rowY = y + rowYOffset; - // === Second Row: My Location === - display->setTextAlignment(TEXT_ALIGN_LEFT); - display->drawString(x + 2, rowY, "My Location:"); - display->setTextAlignment(TEXT_ALIGN_LEFT); - +// === Second Row: My Location === #if HAS_GPS + if (config.position.fixed_position) { + display->drawString(x + 2, compactFirstLine, "Sat:"); + if (screenWidth > 128) { + drawGPS(display, x + 32, compactFirstLine + 3, gpsStatus); + } else { + drawGPS(display, x + 23, compactFirstLine + 3, gpsStatus); + } + } else if (!gpsStatus || !gpsStatus->getIsConnected()) { + String displayLine = + config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_NOT_PRESENT ? "No GPS" : "GPS off"; + display->drawString(x + 2, compactFirstLine, "Sat:"); + if (screenWidth > 128) { + display->drawString(x + 32, compactFirstLine + 3, displayLine); + } else { + display->drawString(x + 23, compactFirstLine + 3, displayLine); + } + } else { + display->drawString(x + 2, compactFirstLine, "Sat:"); + if (screenWidth > 128) { + drawGPS(display, x + 32, compactFirstLine + 3, gpsStatus); + } else { + drawGPS(display, x + 23, compactFirstLine + 3, gpsStatus); + } + } // === Update GeoCoord === geoCoord.updateCoords(int32_t(gpsStatus->getLatitude()), int32_t(gpsStatus->getLongitude()), int32_t(gpsStatus->getAltitude()));