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
+16
View File
@@ -2166,6 +2166,22 @@ bool MyMesh::handleCommand(const char* command, uint32_t sender_timestamp, char*
return true;
}
if (strcmp(command, "get tz.offset") == 0) {
sprintf(reply, "> %d", _prefs.tz_offset);
return true;
}
if (memcmp(command, "set tz.offset ", 14) == 0) {
int8_t tz = atof(&command[14]);
if (tz < -12 || tz > 14) {
strcpy(reply, "Error, must be from -12 to +14");
} else {
_prefs.tz_offset = tz;
savePrefs();
strcpy(reply, "OK");
}
return true;
}
return false; // not handled
}