mirror of
https://github.com/meshtastic/firmware.git
synced 2025-12-30 22:50:57 +00:00
Show GPS Date properly in drawCommonHeader (#7887)
* Commit good code that is sustainable * Fix new build errors
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#if HAS_SCREEN
|
||||
#include "ClockRenderer.h"
|
||||
#include "NodeDB.h"
|
||||
#include "UIRenderer.h"
|
||||
#include "configuration.h"
|
||||
#include "gps/GeoCoord.h"
|
||||
#include "gps/RTC.h"
|
||||
@@ -190,8 +189,7 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1
|
||||
// === Set Title, Blank for Clock
|
||||
const char *titleStr = "";
|
||||
// === Header ===
|
||||
graphics::drawCommonHeader(display, x, y, titleStr, true);
|
||||
int line = 0;
|
||||
graphics::drawCommonHeader(display, x, y, titleStr, true, true);
|
||||
|
||||
#ifdef T_WATCH_S3
|
||||
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
|
||||
@@ -301,29 +299,6 @@ void drawDigitalClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int1
|
||||
display->drawString(startingHourMinuteTextX + timeStringWidth - xOffset, (display->getHeight() - hourMinuteTextY) - yOffset,
|
||||
secondString);
|
||||
#endif
|
||||
|
||||
display->setFont(FONT_SMALL);
|
||||
// Display GPS derived date
|
||||
char datetimeStr[25];
|
||||
UIRenderer::formatDateTime(datetimeStr, sizeof(datetimeStr), rtc_sec, display, false);
|
||||
char fullLine[40];
|
||||
xOffset = 1;
|
||||
if (isHighResolution) {
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", datetimeStr);
|
||||
} else {
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", &datetimeStr[2]);
|
||||
}
|
||||
if (hasUnreadMessage) {
|
||||
if (isHighResolution) {
|
||||
xOffset = 23;
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", &datetimeStr[2]);
|
||||
} else {
|
||||
xOffset = 15;
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", &datetimeStr[5]);
|
||||
}
|
||||
}
|
||||
display->drawString(display->getWidth() - xOffset - display->getStringWidth(fullLine), getTextPositions(display)[line],
|
||||
fullLine);
|
||||
}
|
||||
|
||||
void drawBluetoothConnectedIcon(OLEDDisplay *display, int16_t x, int16_t y)
|
||||
@@ -338,8 +313,7 @@ void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
||||
// === Set Title, Blank for Clock
|
||||
const char *titleStr = "";
|
||||
// === Header ===
|
||||
graphics::drawCommonHeader(display, x, y, titleStr, true);
|
||||
int line = 0;
|
||||
graphics::drawCommonHeader(display, x, y, titleStr, true, true);
|
||||
|
||||
#ifdef T_WATCH_S3
|
||||
if (nimbleBluetooth && nimbleBluetooth->isConnected()) {
|
||||
@@ -537,29 +511,6 @@ void drawAnalogClockFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
||||
// draw second hand
|
||||
display->drawLine(centerX, centerY, secondX, secondY);
|
||||
#endif
|
||||
|
||||
display->setFont(FONT_SMALL);
|
||||
// Display GPS derived date
|
||||
char datetimeStr[25];
|
||||
UIRenderer::formatDateTime(datetimeStr, sizeof(datetimeStr), rtc_sec, display, false);
|
||||
char fullLine[40];
|
||||
int xOffset = 1;
|
||||
if (isHighResolution) {
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", datetimeStr);
|
||||
} else {
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", &datetimeStr[2]);
|
||||
}
|
||||
if (hasUnreadMessage) {
|
||||
if (isHighResolution) {
|
||||
xOffset = 23;
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", &datetimeStr[2]);
|
||||
} else {
|
||||
xOffset = 15;
|
||||
snprintf(fullLine, sizeof(fullLine), "%s", &datetimeStr[5]);
|
||||
}
|
||||
}
|
||||
display->drawString(display->getWidth() - xOffset - display->getStringWidth(fullLine), getTextPositions(display)[line],
|
||||
fullLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "NodeDB.h"
|
||||
#include "graphics/Screen.h"
|
||||
#include "graphics/emotes.h"
|
||||
#include <OLEDDisplay.h>
|
||||
|
||||
Reference in New Issue
Block a user