feat(gps): duty-cycle the receiver, for nodes that run GPS only for the clock

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5 committed 2026-08-06 10:05:26 +02:00
1 parent 4d96ff9e2f
commit 5486cc5439
6 files changed
+169 -5

No files matched your search

+2 -1
View File
@@ -168,7 +168,8 @@ public:
#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
sensors.setSettingValue("gps", _prefs.gps_enabled ? "1" : "0");
// 0 off / 1 on / 2 duty cycle (see EnvironmentSensorManager::gpsDutyLoop)
sensors.setSettingValue("gps", _prefs.gps_enabled == 2 ? "2" : (_prefs.gps_enabled ? "1" : "0"));
if (_prefs.gps_interval > 0) {
char interval_str[12]; // Max: 24 hours = 86400 seconds (5 digits + null)
sprintf(interval_str, "%u", _prefs.gps_interval);
+4 -1
View File
@@ -316,7 +316,10 @@ protected:
#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
// 0 off / 1 on / 2 duty cycle -- pass the mode through, not a boolean, or
// a duty-cycled node comes back from a reboot with GPS powered forever.
const char* mode = _prefs.gps_enabled == 2 ? "2" : (_prefs.gps_enabled ? "1" : "0");
sensors.setSettingValue("gps", mode);
}
#endif