mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 10:51:57 +00:00
feat: summer time - Settings > Summer time (Europe, North America, Australia, New Zealand) puts the clock an hour ahead and back by itself; every local time goes through tzHoursAt(), the alarm keeps its time across the change (a skipped time rings an hour later, a repeated one once)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -100,7 +100,7 @@ void UITask::buildBot() {
|
||||
if (log.count() == 0) label(g, "No replies yet", THEME_FONT_BODY, theme::TEXT_MUTED);
|
||||
for (int i = 0; i < log.count(); i++) {
|
||||
const BotLogEntry& e = log.at(i);
|
||||
const uint32_t t = e.ts + (int32_t)p->tz_offset_hours * 3600;
|
||||
const uint32_t t = e.ts + (int32_t)tzHoursAt(p, e.ts) * 3600;
|
||||
static const char* const WHERE[] = { "DM", "channel", "room" };
|
||||
char hd[64];
|
||||
snprintf(hd, sizeof(hd), "%02u:%02u %s (%s)", (unsigned)(t / 3600 % 24), (unsigned)(t / 60 % 60),
|
||||
|
||||
@@ -1378,7 +1378,7 @@ void UITask::flowHistoryPopup() {
|
||||
const bool named = f.node[0] >= 0 && the_mesh.getContactByIdx(f.node[0], c) && c.name[0];
|
||||
snprintf(title, sizeof(title), "%s%s%s%.24s", FLOW_KINDS[h.kind < PacketFlow::K_COUNT ? h.kind : PacketFlow::K_OTHER],
|
||||
named ? " " : "", named && !f.origin ? "via " : "", named ? c.name : "");
|
||||
const uint32_t t = h.ts + (int32_t)_prefs->tz_offset_hours * 3600;
|
||||
const uint32_t t = h.ts + (int32_t)tzHoursAt(_prefs, h.ts) * 3600;
|
||||
int o = snprintf(sub, sizeof(sub), "%02u:%02u:%02u ", (unsigned)(t / 3600 % 24), (unsigned)(t / 60 % 60), (unsigned)(t % 60));
|
||||
if (h.hops == 0) o += snprintf(sub + o, sizeof(sub) - o, "direct");
|
||||
else o += snprintf(sub + o, sizeof(sub) - o, "%u hop%s", (unsigned)h.hops, h.hops == 1 ? "" : "s");
|
||||
|
||||
@@ -632,8 +632,8 @@ void UITask::settingsGroup(int i) {
|
||||
g = group(body, "SYSTEM");
|
||||
listRow(g, LV_SYMBOL_EDIT " Name", the_mesh.getNodeName(), onNodeName, NULL);
|
||||
if (_prefs) {
|
||||
snprintf(sub, sizeof(sub), "%s, %s", settingText(*_prefs, SETTING(tz_offset_hours), v1, sizeof(v1)),
|
||||
_prefs->clock_12h ? "12 h" : "24 h");
|
||||
snprintf(sub, sizeof(sub), "%s%s, %s", settingText(*_prefs, SETTING(tz_offset_hours), v1, sizeof(v1)),
|
||||
inSummerTime(*_prefs, rtc_clock.getCurrentTime()) ? " summer" : "", _prefs->clock_12h ? "12 h" : "24 h");
|
||||
listRow(g, UI_SYMBOL_CLOCK " Time", sub, onOpenSchemaPage, (void*)(uintptr_t)PG_TIME);
|
||||
schemaRow(g, SETTING(units_imperial));
|
||||
}
|
||||
|
||||
@@ -1166,9 +1166,9 @@ static void tileBadge(lv_obj_t* tile, int n) {
|
||||
lv_obj_align(lv_obj_get_child(tile, -1), LV_ALIGN_TOP_RIGHT, -2, 2);
|
||||
}
|
||||
|
||||
// Local time (NodePrefs::tz_offset_hours), now or at `utc`; false before the clock is set.
|
||||
// Local time (time zone + summer time), now or at `utc`; false before the clock is set.
|
||||
static bool localTime(const NodePrefs* p, struct tm& out, uint32_t utc = rtc_clock.getCurrentTime()) {
|
||||
return localTm(utc, p ? p->tz_offset_hours : 0, out);
|
||||
return localTm(utc, tzHoursAt(p, utc), out);
|
||||
}
|
||||
static const char* const MONTHS[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||
|
||||
Reference in New Issue
Block a user