Skip to content

Commit d34bfc6

Browse files
author
Tom Mackintosh
committed
Merge branch 'stock'
2 parents d2fb717 + 361b898 commit d34bfc6

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

src/helpers/sensors/EnvironmentSensorManager.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,9 @@ bool EnvironmentSensorManager::begin() {
337337
bool EnvironmentSensorManager::querySensors(uint8_t requester_permissions, CayenneLPP& telemetry) {
338338
next_available_channel = TELEM_CHANNEL_SELF + 1;
339339

340-
if (requester_permissions & TELEM_PERM_LOCATION && gps_active && gps_fix_valid) {
340+
if (requester_permissions & TELEM_PERM_LOCATION && gps_active) {
341341
telemetry.addGPS(TELEM_CHANNEL_SELF, node_lat, node_lon, node_altitude);
342+
telemetry.addSwitch(TELEM_CHANNEL_SELF, gps_has_fix);
342343
}
343344

344345
if (requester_permissions & TELEM_PERM_ENVIRONMENT) {
@@ -718,9 +719,9 @@ void EnvironmentSensorManager::loop() {
718719
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
719720
node_altitude = ((double)_location->getAltitude()) / 1000.0;
720721
MESH_DEBUG_PRINTLN("lat %f lon %f alt %f", node_lat, node_lon, node_altitude);
721-
gps_fix_valid = true;
722+
gps_has_fix = true;
722723
} else {
723-
gps_fix_valid = false;
724+
gps_has_fix = false;
724725
}
725726
#else
726727
if (_location->isValid()) {
@@ -729,9 +730,9 @@ void EnvironmentSensorManager::loop() {
729730
MESH_DEBUG_PRINTLN("lat %f lon %f", node_lat, node_lon);
730731
node_altitude = ((double)_location->getAltitude()) / 1000.0;
731732
MESH_DEBUG_PRINTLN("lat %f lon %f alt %f", node_lat, node_lon, node_altitude);
732-
gps_fix_valid = true;
733+
gps_has_fix = true;
733734
} else {
734-
gps_fix_valid = false;
735+
gps_has_fix = false;
735736
}
736737
#endif
737738
}

src/helpers/sensors/EnvironmentSensorManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EnvironmentSensorManager : public SensorManager {
2525

2626
bool gps_detected = false;
2727
bool gps_active = false;
28-
bool gps_fix_valid = false; // true only when _location->isValid() — reset on fix loss
28+
bool gps_has_fix = false; // true only when _location->isValid() — reset on fix loss
2929
uint32_t gps_update_interval_sec = 1; // Default 1 second
3030

3131
#if ENV_INCLUDE_GPS

0 commit comments

Comments
 (0)