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

+8 -11
View File
@@ -11,7 +11,8 @@ WRAPPER_CLASS radio_driver(radio, board);
ESP32RTCClock fallback_clock;
AutoDiscoverRTCClock rtc_clock(fallback_clock);
MicroNMEALocationProvider nmea = MicroNMEALocationProvider(Serial1, &rtc_clock);
NmeaGpsDriver gps_driver(Serial1);
MicroNMEALocationProvider nmea(gps_driver, &rtc_clock);
MASensorManager sensors = MASensorManager(nmea);
#ifdef DISPLAY_CLASS
@@ -37,17 +38,13 @@ mesh::LocalIdentity radio_new_identity() {
void MASensorManager::start_gps() {
if(!gps_active) {
MESH_DEBUG_PRINTLN("starting GPS");
gps_active = true;
}
MESH_DEBUG_PRINTLN("starting GPS");
_location->setGpsOn(true);
}
void MASensorManager::stop_gps() {
if(gps_active) {
MESH_DEBUG_PRINTLN("stopping GPS");
gps_active = false;
}
MESH_DEBUG_PRINTLN("stopping GPS");
_location->setGpsOn(false);
}
bool MASensorManager::begin() {
@@ -67,7 +64,7 @@ bool MASensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& te
void MASensorManager::loop() {
static long next_gps_update = 0;
_location->loop();
if(millis() > next_gps_update && gps_active) {
if(millis() > next_gps_update && _location->isEnabled()) {
if(_location->isValid()) {
node_lat = ((double)_location->getLatitude()) / 1000000.;
node_lon = ((double)_location->getLongitude()) / 1000000.;
@@ -85,7 +82,7 @@ const char* MASensorManager::getSettingName(int i) const {
}
const char* MASensorManager::getSettingValue(int i) const {
if(i == 0) {
return gps_active ? "1" : "0";
return _location->isGpsOn() ? "1" : "0";
}
return NULL;
}