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:
1 parent
d51bd9acca
commit
c9e5cc15ba
4 files changed
+19
-7
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user