sforkowany z mirror/meshtastic-firmware
fix #536 allow fixed positions
meshtastic --setlat 32.7767 --setlon -96.7970 --setalt 13371.2-legacy
rodzic
3753fef298
commit
32b8e4f20a
|
@ -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);
|
||||||
|
|
Ładowanie…
Reference in New Issue