companion: get/set timezone offset for clock

* Add tz_offset companion prefs and get/set commands for companion cli
* Use tz_offset for clock on display

Signed-off-by: Aleksei Mamlin <mamlinav@gmail.com>
This commit is contained in:
Aleksei Mamlin
2026-08-31 09:08:22 +03:00
parent 307fc9ba01
commit 1d9a62ca4a
4 changed files with 19 additions and 7 deletions
+1 -6
View File
@@ -7,10 +7,6 @@
#include <WiFi.h>
#endif
#ifndef UI_TZ_OFFSET
#define UI_TZ_OFFSET 0
#endif
#ifndef AUTO_OFF_MILLIS
#define AUTO_OFF_MILLIS 15000 // 15 seconds
#endif
@@ -256,8 +252,7 @@ public:
#ifdef UI_SHOW_CLOCK
display.setTextSize(3);
uint32_t now = _rtc->getCurrentTime();
int8_t tz = UI_TZ_OFFSET; // for now draw time from Santo Domingo ...
now += (int32_t)tz * 3600;
now += (int32_t)_node_prefs->tz_offset * 3600;
DateTime dt (now);
sprintf(tmp, "%02d:%02d", dt.hour(), dt.minute());
display.drawTextCentered(display.width() / 2, 60, tmp);