upstream sync and gps stuff

This commit is contained in:
liquidraver
2026-10-02 23:10:09 +02:00
parent 5b779478b0
commit f9d01cf33a
21 changed files with 296 additions and 45 deletions
+21
View File
@@ -1201,6 +1201,9 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, const char* command, cha
size_t cap = replyCap(sender_timestamp);
reply[0] = '>'; reply[1] = ' ';
gps_get_diag_report(reply + 2, cap - 2);
} else if (memcmp(config, "gps standby", 11) == 0) {
if (!gps_has_standby_pin()) strcpy(reply, "> n/a (no GPS standby pin on this board)");
else snprintf(reply, CLI_REPLY_SIZE, "> %u", (unsigned)gps_get_standby_max_sec());
} else if (memcmp(config, "gps duty", 8) == 0) {
uint32_t s = gps_get_poll_interval_sec(); // now-effective value
if (s == 0) strcpy(reply, "> always on (0)");
@@ -1803,6 +1806,24 @@ void CommonCLI::handleSetCmd(uint32_t sender_timestamp, const char* command, cha
} else {
strcpy(reply, "usage: set gps diag <0|1|on|off>");
}
} else if (memcmp(config, "gps standby", 11) == 0) {
// set gps standby <seconds> | default (0 = always cut the supply)
const char* arg = config + 11;
while (*arg == ' ') arg++;
char* end = NULL;
unsigned long parsed = strtoul(arg, &end, 10);
bool is_default = strcmp(arg, "default") == 0;
if (!gps_has_standby_pin()) {
strcpy(reply, "Error: no GPS standby pin on this board");
} else if (!is_default && (*arg == '\0' || end == arg || *end != '\0' || parsed > GPS_INTERVAL_MAX_SEC)) {
strcpy(reply, "usage: set gps standby <seconds> | default (0 = always cut the supply)");
} else {
uint32_t val = is_default ? GPS_STANDBY_MAX_DEFAULT_SEC : (uint32_t)parsed;
_prefs->gps_standby_max = val;
gps_set_standby_max_sec(val); // applies at the next standby
savePrefs();
snprintf(reply, CLI_REPLY_SIZE, "OK - gps standby=%u s", (unsigned)val);
}
} else if (memcmp(config, "gps duty", 8) == 0) {
// set gps duty <seconds> | default (0 = always on)
const char* arg = config + 8;