mirror of
https://github.com/meshtastic/firmware.git
synced 2026-01-07 02:18:09 +00:00
Refactored status handlers and merged
This commit is contained in:
@@ -41,7 +41,7 @@ class GPS : public Observable<void *>
|
||||
|
||||
virtual ~GPS() {}
|
||||
|
||||
Observable<const meshtastic::GPSStatus> newStatus;
|
||||
Observable<const meshtastic::GPSStatus *> newStatus;
|
||||
|
||||
/**
|
||||
* Returns true if we succeeded
|
||||
|
||||
@@ -65,13 +65,9 @@ void NEMAGPS::loop()
|
||||
if (hasValidLocation)
|
||||
notifyObservers(NULL);
|
||||
}
|
||||
meshtastic::GPSStatus status;
|
||||
status.hasLock = hasLock();
|
||||
status.isConnected = isConnected;
|
||||
status.latitude = latitude;
|
||||
status.longitude = longitude;
|
||||
status.altitude = altitude;
|
||||
status.dop = dop;
|
||||
newStatus.notifyObservers(status);
|
||||
|
||||
// Notify any status instances that are observing us
|
||||
const meshtastic::GPSStatus status = meshtastic::GPSStatus(hasLock(), isConnected, latitude, longitude, altitude, dop);
|
||||
newStatus.notifyObservers(&status);
|
||||
}
|
||||
}
|
||||
@@ -128,14 +128,9 @@ The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of s
|
||||
} else // we didn't get a location update, go back to sleep and hope the characters show up
|
||||
wantNewLocation = true;
|
||||
|
||||
meshtastic::GPSStatus status;
|
||||
status.hasLock = hasLock();
|
||||
status.isConnected = isConnected;
|
||||
status.latitude = latitude;
|
||||
status.longitude = longitude;
|
||||
status.altitude = altitude;
|
||||
status.dop = dop;
|
||||
newStatus.notifyObservers(status);
|
||||
// Notify any status instances that are observing us
|
||||
const meshtastic::GPSStatus status = meshtastic::GPSStatus(hasLock(), isConnected, latitude, longitude, altitude, dop);
|
||||
newStatus.notifyObservers(&status);
|
||||
|
||||
// Once we have sent a location once we only poll the GPS rarely, otherwise check back every 1s until we have something over
|
||||
// the serial
|
||||
|
||||
Reference in New Issue
Block a user