Commit e5b88df6 authored by Gus Grubba's avatar Gus Grubba

CP - Update flight distance from within the new TrajectoryPoints handler.

This was lost when moving the handling the the trajectory points from within the vehicle.
parent 0b5aba44
......@@ -23,7 +23,10 @@ void TrajectoryPoints::_vehicleCoordinateChanged(QGeoCoordinate coordinate)
// Fewer points means higher performance of map display.
if (_lastPoint.isValid()) {
if (_lastPoint.distanceTo(coordinate) > _distanceTolerance) {
double distance = _lastPoint.distanceTo(coordinate);
if (distance > _distanceTolerance) {
//-- Update flight distance
_vehicle->updateFlightDisance(distance);
// Vehicle has moved far enough from previous point for an update
double newAzimuth = _lastPoint.azimuthTo(coordinate);
if (qIsNaN(_lastAzimuth) || qAbs(newAzimuth - _lastAzimuth) > _azimuthTolerance) {
......
......@@ -4244,6 +4244,11 @@ void Vehicle::_handleObstacleDistance(const mavlink_message_t& message)
_objectAvoidance->update(&o);
}
void Vehicle::updateFlightDisance(double distance)
{
_flightDistanceFact.setRawValue(_flightDistanceFact.rawValue().toDouble() + distance);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
......
......@@ -805,6 +805,8 @@ public:
JoystickModeMax
} JoystickMode_t;
void updateFlightDisance(double distance);
int joystickMode(void);
void setJoystickMode(int mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment