gps: move the gps CLI to GpsPrefs and convert all targets

This commit is contained in:
Florent committed 2026-11-08 08:47:34 -04:00
1 parent 81afafcb35
commit dea38936d7
69 files changed
+381 -301

No files matched your search

@@ -650,7 +650,7 @@ bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, Cayen
int EnvironmentSensorManager::getNumSettings() const {
int settings = 0;
#if ENV_INCLUDE_GPS
if (gps_detected) settings += 2; // GPS enablement and periodic acquisition
if (gps_detected) settings += 1; // GPS enablement
#endif
return settings;
}
@@ -661,9 +661,6 @@ const char* EnvironmentSensorManager::getSettingName(int i) const {
if (gps_detected && i == settings++) {
return "gps";
}
if (gps_detected && i == settings++) {
return "gps_period";
}
#endif
return NULL;
}
@@ -674,12 +671,6 @@ const char* EnvironmentSensorManager::getSettingValue(int i) const {
if (gps_detected && i == settings++) {
return _location->isGpsOn() ? "1" : "0";
}
if (gps_detected && i == settings++) {
static char period[11];
snprintf(period, sizeof(period), "%lu",
(unsigned long)_location->getGpsPeriod());
return period;
}
#endif
return NULL;
}
@@ -694,13 +685,6 @@ bool EnvironmentSensorManager::setSettingValue(const char* name, const char* val
}
return true;
}
if (gps_detected && strcmp(name, "gps_period") == 0) {
char* end = nullptr;
unsigned long period = strtoul(value, &end, 10);
if (*value == '\0' || *end != '\0' || period > 86400) return false;
_location->setGpsPeriod((uint32_t)period);
return true;
}
if (strcmp(name, "gps_interval") == 0) {
uint32_t interval_seconds = atoi(value);
gps_update_interval_sec = interval_seconds > 0 ? interval_seconds : 1;