fix #536 allow fixed positions

meshtastic --setlat 32.7767 --setlon -96.7970 --setalt 1337
1.2-legacy
Kevin Hester 2020-12-09 12:05:15 +08:00
rodzic 3753fef298
commit 32b8e4f20a
1 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -202,6 +202,17 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
pos.latitude_i = gps->latitude; pos.latitude_i = gps->latitude;
pos.longitude_i = gps->longitude; 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); pos.time = getValidTime(RTCQualityGPS);
@ -209,7 +220,7 @@ int MeshService::onGPSChanged(const meshtastic::GPSStatus *unused)
pos.battery_level = powerStatus->getBatteryChargePercent(); pos.battery_level = powerStatus->getBatteryChargePercent();
updateBatteryLevel(pos.battery_level); 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 // Update our current position in the local DB
nodeDB.updatePosition(nodeDB.getNodeNum(), pos); nodeDB.updatePosition(nodeDB.getNodeNum(), pos);