mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-11-02 10:51:57 +00:00
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:
@@ -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