diff --git a/src/mesh/MeshService.cpp b/src/mesh/MeshService.cpp index afd5a6d4..1c06406f 100644 --- a/src/mesh/MeshService.cpp +++ b/src/mesh/MeshService.cpp @@ -202,6 +202,17 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused) pos.latitude_i = gps->latitude; pos.longitude_i = gps->longitude; } + else { + // The GPS has lost lock, if we are fixed position we should just keep using + // the old position + if(radioConfig.preferences.fixed_position) { + NodeInfo *node = nodeDB.getNode(nodeDB.getNodeNum()); + assert(node); + assert(node->has_position); + pos = node->position; + DEBUG_MSG("WARNING: Using fixed position\n"); + } + } pos.time = getValidTime(RTCQualityGPS); @@ -209,7 +220,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused) pos.battery_level = powerStatus->getBatteryChargePercent(); updateBatteryLevel(pos.battery_level); - // DEBUG_MSG("got gps notify time=%u, lat=%d, bat=%d\n", pos.latitude_i, pos.time, pos.battery_level); + DEBUG_MSG("got gps notify time=%u, lat=%d, bat=%d\n", pos.latitude_i, pos.time, pos.battery_level); // Update our current position in the local DB nodeDB.updatePosition(nodeDB.getNodeNum(), pos);