From a763fd4c91034a8f3b497eaccca90a36e95a60ab Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sat, 17 Oct 2026 15:16:38 +1300 Subject: [PATCH 1/2] timezone offset is now stored as float to allow half hour offsets --- examples/companion_radio/MyMesh.cpp | 4 ++-- examples/companion_radio/NodePrefs.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index f32ea67a..99a9aa30 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -2192,11 +2192,11 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char* } if (strcmp(command, "get tz.offset") == 0) { - sprintf(reply, "> %d", _prefs.tz_offset); + sprintf(reply, "> %.1f", _prefs.tz_offset); return true; } if (memcmp(command, "set tz.offset ", 14) == 0) { - int8_t tz = atof(&command[14]); + float tz = atof(&command[14]); if (tz < -12 || tz > 14) { strcpy(reply, "Error, must be from -12 to +14"); } else { diff --git a/examples/companion_radio/NodePrefs.h b/examples/companion_radio/NodePrefs.h index 46a3dbb7..3cceed56 100644 --- a/examples/companion_radio/NodePrefs.h +++ b/examples/companion_radio/NodePrefs.h @@ -47,7 +47,7 @@ public: uint8_t agc_reset_interval = 0; // secs / 4 char default_scope_name[31]; uint8_t default_scope_key[16]; - int8_t tz_offset = 0; + float tz_offset = 0; #ifdef ENABLE_WIFI_INTERFACE #ifndef WIFI_SSID #define WIFI_SSID "" From c2c5de52be11980f6c6fee43c2580b546143c213 Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sat, 17 Oct 2026 15:22:46 +1300 Subject: [PATCH 2/2] tz_offset should be treated as float when down casting calculation result to int32 --- examples/companion_radio/ui-new/UITask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index bc25de79..e3488853 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -295,7 +295,7 @@ public: #ifdef UI_SHOW_CLOCK display.setTextSize(3); uint32_t now = _rtc->getCurrentTime(); - now += (int32_t)_node_prefs->tz_offset * 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);