mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 19:02:00 +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:
@@ -153,12 +153,11 @@ public:
|
||||
display.drawTextCentered(display.width() / 2, display.height() / 2, "No replies yet");
|
||||
return 2000;
|
||||
}
|
||||
const int8_t tz = _prefs ? _prefs->tz_offset_hours : 0;
|
||||
int mq_delay = 0;
|
||||
drawList(display, log.count(), _sel, _scroll, [&](int i, int y, bool sel, int reserve) {
|
||||
drawRowSelection(display, y, sel, reserve);
|
||||
char line[200];
|
||||
botcfg::logLine(log.at(i), tz, line, sizeof(line));
|
||||
botcfg::logLine(log.at(i), tzHoursAt(_prefs, log.at(i).ts), line, sizeof(line));
|
||||
char filt[200];
|
||||
display.translateUTF8ToBlocks(filt, line, sizeof(filt));
|
||||
int r = display.drawTextEllipsized(2, y, display.width() - 2 - reserve, filt, sel);
|
||||
|
||||
@@ -263,7 +263,7 @@ class ClockToolsScreen : public UIScreen {
|
||||
// screen), the grid goes tight and the month and year stand beside it.
|
||||
int renderCalendar(DisplayDriver& d) {
|
||||
struct tm t;
|
||||
if (!localTm(rtc_clock.getCurrentTime(), _prefs ? _prefs->tz_offset_hours : 0, t) || t.tm_year < 120) {
|
||||
if (!localTm(rtc_clock.getCurrentTime(), tzHoursAt(_prefs, rtc_clock.getCurrentTime()), t) || t.tm_year < 120) {
|
||||
drawScreenHeader(d, "Calendar");
|
||||
d.drawTextCentered(d.width() / 2, d.height() / 2 - d.getLineHeight() / 2, "Clock not set");
|
||||
return 60000;
|
||||
|
||||
@@ -1002,7 +1002,7 @@ public:
|
||||
|
||||
void drawClockPage(DisplayDriver& d, uint32_t unix_ts) {
|
||||
struct tm ti;
|
||||
localTm(unix_ts, _node_prefs ? _node_prefs->tz_offset_hours : 0, ti);
|
||||
localTm(unix_ts, tzHoursAt(_node_prefs, unix_ts), ti);
|
||||
const bool h12 = _node_prefs && _node_prefs->clock_12h;
|
||||
const bool show_sec = !Features::IS_EINK && (!_node_prefs || !_node_prefs->clock_hide_seconds);
|
||||
const int W = d.width(), H = d.height();
|
||||
@@ -1086,7 +1086,7 @@ public:
|
||||
const uint32_t unix_ts = _rtc->getCurrentTime();
|
||||
const bool synced = unix_ts >= 1000000000UL;
|
||||
struct tm ti;
|
||||
if (synced) localTm(unix_ts, _node_prefs ? _node_prefs->tz_offset_hours : 0, ti);
|
||||
if (synced) localTm(unix_ts, tzHoursAt(_node_prefs, unix_ts), ti);
|
||||
const bool h12 = _node_prefs && _node_prefs->clock_12h;
|
||||
const bool compact = _node_prefs && _node_prefs->lock_compact && W > H;
|
||||
// The month and the rows under the big clock: on a tall screen (portrait
|
||||
@@ -1338,7 +1338,7 @@ public:
|
||||
uint32_t now_ts = _rtc->getCurrentTime();
|
||||
if (now_ts >= 1000000000UL) {
|
||||
struct tm lt;
|
||||
localTm(now_ts, _node_prefs->tz_offset_hours, lt);
|
||||
localTm(now_ts, tzHoursAt(_node_prefs, now_ts), lt);
|
||||
int hh = lt.tm_hour;
|
||||
if (_node_prefs->clock_12h) { hh %= 12; if (hh == 0) hh = 12; }
|
||||
snprintf(filtered_name, sizeof(filtered_name), "%d:%02d", hh, lt.tm_min);
|
||||
|
||||
@@ -632,14 +632,13 @@ private:
|
||||
_list_max_scroll = max_scroll;
|
||||
|
||||
NodePrefs* p = _task->getNodePrefs();
|
||||
int32_t tz_off = (int32_t)(p ? p->tz_offset_hours : 0) * 3600;
|
||||
|
||||
for (int i = 0; i < visible; i++) {
|
||||
int idx = total - 1 - (_list_scroll + i);
|
||||
if (idx < 0) break;
|
||||
const TrailPoint& pt = _store->at(idx);
|
||||
|
||||
time_t lt = (time_t)((int32_t)pt.ts + tz_off);
|
||||
time_t lt = (time_t)((int32_t)pt.ts + (int32_t)tzHoursAt(p, pt.ts) * 3600);
|
||||
struct tm* ti = gmtime(<);
|
||||
|
||||
char dist[12];
|
||||
|
||||
Reference in New Issue
Block a user