From 8264d4d65ed742b5675576aa8e08a0b5057edf4d Mon Sep 17 00:00:00 2001 From: Jason P Date: Fri, 5 Sep 2025 20:44:32 -0500 Subject: [PATCH] BaseUI Updates (#7787) * Account for low resolution wide screen OLEDs * Allow picking of Device Role and new Display Formatter for Device Role * Add remainder of client roles to display formatter * Don't update the role unless you pick a value * Mascots are fun * Fix warnings during compile time * Improve some menus * Mascots need to work everywhere * Update Chirpy image * Fix Trunk * Update protobufs * Add date to Clock screen * Analog clocks love dates too * Finalize date moves for analog clock --- src/graphics/draw/ClockRenderer.cpp | 2 ++ src/graphics/draw/UIRenderer.cpp | 40 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/src/graphics/draw/ClockRenderer.cpp b/src/graphics/draw/ClockRenderer.cpp index aec0a701f..5afcf094c 100644 --- a/src/graphics/draw/ClockRenderer.cpp +++ b/src/graphics/draw/ClockRenderer.cpp @@ -190,6 +190,7 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1 const char *titleStr = ""; // === Header === graphics::drawCommonHeader(display, x, y, titleStr, true, true); + int line = 0; #ifdef T_WATCH_S3 if (nimbleBluetooth && nimbleBluetooth->isConnected()) { @@ -323,6 +324,7 @@ void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 const char *titleStr = ""; // === Header === graphics::drawCommonHeader(display, x, y, titleStr, true, true); + int line = 0; #ifdef T_WATCH_S3 if (nimbleBluetooth && nimbleBluetooth->isConnected()) { diff --git a/src/graphics/draw/UIRenderer.cpp b/src/graphics/draw/UIRenderer.cpp index 5623c9026..e76a39398 100644 --- a/src/graphics/draw/UIRenderer.cpp +++ b/src/graphics/draw/UIRenderer.cpp @@ -1056,6 +1056,45 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU display->drawString(x, getTextPositions(display)[line++] + 2, latStr); #else snprintf(latStr, sizeof(latStr), " Lat: %.5f", geoCoord.getLatitude() * 1e-7); + // === Second Row: Last GPS Fix === + if (gpsStatus->getLastFixMillis() > 0) { + uint32_t delta = (millis() - gpsStatus->getLastFixMillis()) / 1000; // seconds since last fix + uint32_t days = delta / 86400; + uint32_t hours = (delta % 86400) / 3600; + uint32_t mins = (delta % 3600) / 60; + uint32_t secs = delta % 60; + + char buf[32]; +#if defined(USE_EINK) + // E-Ink: skip seconds, show only days/hours/mins + if (days > 0) { + snprintf(buf, sizeof(buf), " Last: %ud %uh", days, hours); + } else if (hours > 0) { + snprintf(buf, sizeof(buf), " Last: %uh %um", hours, mins); + } else { + snprintf(buf, sizeof(buf), " Last: %um", mins); + } +#else + // Non E-Ink: include seconds where useful + if (days > 0) { + snprintf(buf, sizeof(buf), "Last: %ud %uh", days, hours); + } else if (hours > 0) { + snprintf(buf, sizeof(buf), "Last: %uh %um", hours, mins); + } else if (mins > 0) { + snprintf(buf, sizeof(buf), "Last: %um %us", mins, secs); + } else { + snprintf(buf, sizeof(buf), "Last: %us", secs); + } +#endif + + display->drawString(0, getTextPositions(display)[line++], buf); + } else { + display->drawString(0, getTextPositions(display)[line++], "Last: ?"); + } + + // === Third Row: Latitude === + char latStr[32]; + snprintf(latStr, sizeof(latStr), "Lat: %.5f", geoCoord.getLatitude() * 1e-7); display->drawString(x, getTextPositions(display)[line++], latStr); #endif @@ -1066,6 +1105,7 @@ void UIRenderer::drawCompassAndLocationScreen(OLEDDisplay *display, OLEDDisplayU display->drawString(x, getTextPositions(display)[line++] + 4, lonStr); #else snprintf(lonStr, sizeof(lonStr), " Lon: %.5f", geoCoord.getLongitude() * 1e-7); + snprintf(lonStr, sizeof(lonStr), "Lon: %.5f", geoCoord.getLongitude() * 1e-7); display->drawString(x, getTextPositions(display)[line++], lonStr); // === Fifth Row: Altitude ===