mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-15 01:22:04 +00:00
Terrible clock format change
This commit is contained in:
parent
09fd3c0782
commit
f03f547e9e
@ -1095,13 +1095,16 @@ void drawCommonHeader(OLEDDisplay *display, int16_t x, int16_t y)
|
|||||||
int hour = hms / SEC_PER_HOUR;
|
int hour = hms / SEC_PER_HOUR;
|
||||||
int minute = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
int minute = (hms % SEC_PER_HOUR) / SEC_PER_MIN;
|
||||||
|
|
||||||
bool isPM = hour >= 12;
|
|
||||||
hour = hour % 12;
|
|
||||||
if (hour == 0)
|
|
||||||
hour = 12;
|
|
||||||
|
|
||||||
char timeStr[10];
|
char timeStr[10];
|
||||||
snprintf(timeStr, sizeof(timeStr), "%d:%02d%s", hour, minute, isPM ? "p" : "a");
|
|
||||||
|
snprintf(timeStr, sizeof(timeStr), "%d:%02d", hour, minute);
|
||||||
|
if (config.display.use_12h_clock) {
|
||||||
|
bool isPM = hour >= 12;
|
||||||
|
hour = hour % 12;
|
||||||
|
if (hour == 0)
|
||||||
|
hour = 12;
|
||||||
|
snprintf(timeStr, sizeof(timeStr), "%d:%02d%s", hour, minute, isPM ? "p" : "a");
|
||||||
|
}
|
||||||
|
|
||||||
int timeStrWidth = display->getStringWidth(timeStr);
|
int timeStrWidth = display->getStringWidth(timeStr);
|
||||||
int timeX = SCREEN_WIDTH - xOffset - timeStrWidth + 4; // time to the right by 4
|
int timeX = SCREEN_WIDTH - xOffset - timeStrWidth + 4; // time to the right by 4
|
||||||
@ -1187,16 +1190,13 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16
|
|||||||
|
|
||||||
if (useTimestamp && minutes >= 15 && daysAgo == 0) {
|
if (useTimestamp && minutes >= 15 && daysAgo == 0) {
|
||||||
std::string prefix = (daysAgo == 1 && SCREEN_WIDTH >= 200) ? "Yesterday" : "At";
|
std::string prefix = (daysAgo == 1 && SCREEN_WIDTH >= 200) ? "Yesterday" : "At";
|
||||||
std::string meridiem = "AM";
|
|
||||||
if (config.display.use_12h_clock) {
|
if (config.display.use_12h_clock) {
|
||||||
if (timestampHours >= 12)
|
bool isPM = timestampHours >= 12;
|
||||||
meridiem = "PM";
|
timestampHours = timestampHours % 12;
|
||||||
if (timestampHours > 12)
|
|
||||||
timestampHours -= 12;
|
|
||||||
if (timestampHours == 0)
|
if (timestampHours == 0)
|
||||||
timestampHours = 12;
|
timestampHours = 12;
|
||||||
snprintf(headerStr, sizeof(headerStr), "%s %d:%02d%s from %s", prefix.c_str(), timestampHours, timestampMinutes,
|
snprintf(headerStr, sizeof(headerStr), "%s %d:%02d%s from %s", prefix.c_str(), timestampHours, timestampMinutes,
|
||||||
meridiem.c_str(), sender);
|
isPM ? "p" : "a", sender);
|
||||||
} else {
|
} else {
|
||||||
snprintf(headerStr, sizeof(headerStr), "%s %d:%02d from %s", prefix.c_str(), timestampHours, timestampMinutes,
|
snprintf(headerStr, sizeof(headerStr), "%s %d:%02d from %s", prefix.c_str(), timestampHours, timestampMinutes,
|
||||||
sender);
|
sender);
|
||||||
@ -2004,7 +2004,6 @@ void drawColumnSeparator(OLEDDisplay *display, int16_t x, int16_t yStart, int16_
|
|||||||
display->drawLine(separatorX, yStart, separatorX, yEnd);
|
display->drawLine(separatorX, yStart, separatorX, yEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void drawNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *title,
|
void drawNodeListScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y, const char *title,
|
||||||
EntryRenderer renderer, NodeExtrasRenderer extras = nullptr, float heading = 0, double lat = 0,
|
EntryRenderer renderer, NodeExtrasRenderer extras = nullptr, float heading = 0, double lat = 0,
|
||||||
double lon = 0)
|
double lon = 0)
|
||||||
@ -2230,7 +2229,6 @@ void drawNodeDistance(OLEDDisplay *display, meshtastic_NodeInfoLite *node, int16
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Public screen function: shows how recently nodes were heard
|
// Public screen function: shows how recently nodes were heard
|
||||||
static void drawLastHeardScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
static void drawLastHeardScreen(OLEDDisplay *display, OLEDDisplayUiState *state, int16_t x, int16_t y)
|
||||||
{
|
{
|
||||||
@ -2248,12 +2246,8 @@ static void drawDistanceScreen(OLEDDisplay *display, OLEDDisplayUiState *state,
|
|||||||
drawNodeListScreen(display, state, x, y, "Distances", drawNodeDistance);
|
drawNodeListScreen(display, state, x, y, "Distances", drawNodeDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cycles Node list screens
|
||||||
//Cycles Node list screens
|
static EntryRenderer entryRenderers[] = {drawEntryLastHeard, drawEntryHopSignal};
|
||||||
static EntryRenderer entryRenderers[] = {
|
|
||||||
drawEntryLastHeard,
|
|
||||||
drawEntryHopSignal
|
|
||||||
};
|
|
||||||
|
|
||||||
static const int NUM_RENDERERS = sizeof(entryRenderers) / sizeof(entryRenderers[0]);
|
static const int NUM_RENDERERS = sizeof(entryRenderers) / sizeof(entryRenderers[0]);
|
||||||
static unsigned long lastSwitchTime = 0;
|
static unsigned long lastSwitchTime = 0;
|
||||||
@ -2501,6 +2495,7 @@ static void drawLoRaFocused(OLEDDisplay *display, OLEDDisplayUiState *state, int
|
|||||||
|
|
||||||
// === First Row: Region / Radio Preset ===
|
// === First Row: Region / Radio Preset ===
|
||||||
auto mode = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, false);
|
auto mode = DisplayFormatters::getModemPresetDisplayName(config.lora.modem_preset, false);
|
||||||
|
|
||||||
// Display Region and Radio Preset
|
// Display Region and Radio Preset
|
||||||
char regionradiopreset[25];
|
char regionradiopreset[25];
|
||||||
const char *region = myRegion ? myRegion->name : NULL;
|
const char *region = myRegion ? myRegion->name : NULL;
|
||||||
@ -3453,8 +3448,8 @@ void Screen::setFrames(FrameFocus focus)
|
|||||||
|
|
||||||
normalFrames[numframes++] = drawDeviceFocused;
|
normalFrames[numframes++] = drawDeviceFocused;
|
||||||
normalFrames[numframes++] = drawCyclingNodeScreen;
|
normalFrames[numframes++] = drawCyclingNodeScreen;
|
||||||
//normalFrames[numframes++] = drawLastHeardScreen;
|
// normalFrames[numframes++] = drawLastHeardScreen;
|
||||||
//normalFrames[numframes++] = drawHopSignalScreen;
|
// normalFrames[numframes++] = drawHopSignalScreen;
|
||||||
normalFrames[numframes++] = drawDistanceScreen;
|
normalFrames[numframes++] = drawDistanceScreen;
|
||||||
normalFrames[numframes++] = drawNodeListWithCompasses;
|
normalFrames[numframes++] = drawNodeListWithCompasses;
|
||||||
normalFrames[numframes++] = drawCompassAndLocationScreen;
|
normalFrames[numframes++] = drawCompassAndLocationScreen;
|
||||||
|
Loading…
Reference in New Issue
Block a user