gps: adapt ui-new and the sensor managers
This commit is contained in:
1 parent
a0c5854b59
commit
5303703750
9 files changed
+53
-18
No files matched your search
@@ -66,7 +66,7 @@ void SolarSensorManager::loop() {
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
|
||||
@@ -82,7 +82,7 @@ void HWTSensorManager::loop() {
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isEnabled() && _location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
|
||||
@@ -64,8 +64,8 @@ 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 && _location->isEnabled()) {
|
||||
if(_location->isValid()) {
|
||||
if(millis() > next_gps_update && _location->isGpsOn()) {
|
||||
if(_location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude()) / 1000000.;
|
||||
node_lon = ((double)_location->getLongitude()) / 1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
|
||||
@@ -70,7 +70,7 @@ void MeshTrackerX1SensorManager::loop() {
|
||||
_nmea->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_nmea->isEnabled() && _nmea->isValid()) {
|
||||
if (_nmea->isGpsOn() && _nmea->hasValidFix()) {
|
||||
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
||||
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
|
||||
|
||||
@@ -10,7 +10,7 @@ public:
|
||||
}
|
||||
|
||||
void begin() override {
|
||||
if (isEnabled()) return;
|
||||
if (isActive()) return;
|
||||
|
||||
digitalWrite(PIN_GPS_STANDBY, HIGH);
|
||||
NmeaGpsDriver::begin();
|
||||
|
||||
@@ -62,14 +62,14 @@ bool NanoG2UltraSensorManager::querySensors(uint8_t requester_permissions, Cayen
|
||||
void NanoG2UltraSensorManager::loop() {
|
||||
static long next_gps_update = 0;
|
||||
|
||||
if (!_location->isEnabled()) {
|
||||
if (!_location->isGpsOn()) {
|
||||
return; // GPS is not active, skip further processing
|
||||
}
|
||||
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isEnabled() && _location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude()) / 1000000.;
|
||||
node_lon = ((double)_location->getLongitude()) / 1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
|
||||
@@ -113,7 +113,7 @@ void T1000SensorManager::loop() {
|
||||
_nmea->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_nmea->isEnabled() && _nmea->isValid()) {
|
||||
if (_nmea->isGpsOn() && _nmea->hasValidFix()) {
|
||||
node_lat = ((double)_nmea->getLatitude())/1000000.;
|
||||
node_lon = ((double)_nmea->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_nmea->getAltitude()) / 1000.0;
|
||||
|
||||
@@ -58,7 +58,7 @@ void ThinkNodeM1SensorManager::loop() {
|
||||
_location->loop();
|
||||
|
||||
if (millis() > next_gps_update) {
|
||||
if (_location->isEnabled() && _location->isValid()) {
|
||||
if (_location->isGpsOn() && _location->hasValidFix()) {
|
||||
node_lat = ((double)_location->getLatitude())/1000000.;
|
||||
node_lon = ((double)_location->getLongitude())/1000000.;
|
||||
node_altitude = ((double)_location->getAltitude()) / 1000.0;
|
||||
|
||||
Reference in new issue
Block a user