gps: add GpsDriver, handle the hardware and software switches in the drivers

This commit is contained in:
Florent committed 2026-11-08 08:47:34 -04:00
1 parent 978b6e01be
commit 81afafcb35
28 files changed
+892 -468

No files matched your search

+4 -4
View File
@@ -392,16 +392,16 @@ public:
char buf[50];
int y = 18;
bool gps_state = _task->getGPSState();
#ifdef PIN_GPS_SWITCH
bool hw_gps_state = digitalRead(PIN_GPS_SWITCH);
bool hw_gps_state = nmea != NULL && nmea->isHardwareEnabled();
if (nmea != NULL && nmea->hasHardwareEnableState()) {
if (gps_state != hw_gps_state) {
strcpy(buf, gps_state ? "gps off(hw)" : "gps off(sw)");
} else {
strcpy(buf, gps_state ? "gps on" : "gps off");
}
#else
} else {
strcpy(buf, gps_state ? "gps on" : "gps off");
#endif
}
display.setColor(UIColor::primary_txt);
display.drawTextLeftAlign(0, y, buf);
if (nmea == NULL) {
+4 -4
View File
@@ -254,16 +254,16 @@ public:
char buf[50];
int y = 8;
bool gps_state = _task->getGPSState();
#ifdef PIN_GPS_SWITCH
bool hw_gps_state = digitalRead(PIN_GPS_SWITCH);
bool hw_gps_state = nmea != NULL && nmea->isHardwareEnabled();
if (nmea != NULL && nmea->hasHardwareEnableState()) {
if (gps_state != hw_gps_state) {
strcpy(buf, gps_state ? "gps off(hw)" : "gps off(sw)");
} else {
strcpy(buf, gps_state ? "gps on" : "gps off");
}
#else
} else {
strcpy(buf, gps_state ? "gps on" : "gps off");
#endif
}
display.setColor(UIColor::primary_txt);
display.drawTextLeftAlign(0, y, buf);
if (nmea == NULL) {
+3
View File
@@ -159,6 +159,9 @@ protected:
#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
char period[11];
snprintf(period, sizeof(period), "%lu", (unsigned long)_prefs.gps_period);
sensors.setSettingValue("gps_period", period);
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
}
#endif
+3
View File
@@ -168,6 +168,9 @@ protected:
#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
char period[11];
snprintf(period, sizeof(period), "%lu", (unsigned long)_prefs.gps_period);
sensors.setSettingValue("gps_period", period);
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
}
#endif
+3
View File
@@ -173,6 +173,9 @@ private:
#if ENV_INCLUDE_GPS == 1
void applyGpsPrefs() {
char period[11];
snprintf(period, sizeof(period), "%lu", (unsigned long)_prefs.gps_period);
sensors.setSettingValue("gps_period", period);
sensors.setSettingValue("gps", _prefs.gps_enabled?"1":"0");
}
#endif