Browse Source

Merge pull request #8254 from mavlink/pr-odometer

Update flight distance
QGC4.4
Gus Grubba 5 years ago committed by GitHub
parent
commit
16630ddacf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/Vehicle/TrajectoryPoints.cc
  2. 5
      src/Vehicle/Vehicle.cc
  3. 2
      src/Vehicle/Vehicle.h

5
src/Vehicle/TrajectoryPoints.cc

@ -23,7 +23,10 @@ void TrajectoryPoints::_vehicleCoordinateChanged(QGeoCoordinate coordinate) @@ -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->updateFlightDistance(distance);
// Vehicle has moved far enough from previous point for an update
double newAzimuth = _lastPoint.azimuthTo(coordinate);
if (qIsNaN(_lastAzimuth) || qAbs(newAzimuth - _lastAzimuth) > _azimuthTolerance) {

5
src/Vehicle/Vehicle.cc

@ -4244,6 +4244,11 @@ void Vehicle::_handleObstacleDistance(const mavlink_message_t& message) @@ -4244,6 +4244,11 @@ void Vehicle::_handleObstacleDistance(const mavlink_message_t& message)
_objectAvoidance->update(&o);
}
void Vehicle::updateFlightDistance(double distance)
{
_flightDistanceFact.setRawValue(_flightDistanceFact.rawValue().toDouble() + distance);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

2
src/Vehicle/Vehicle.h

@ -805,6 +805,8 @@ public: @@ -805,6 +805,8 @@ public:
JoystickModeMax
} JoystickMode_t;
void updateFlightDistance(double distance);
int joystickMode(void);
void setJoystickMode(int mode);

Loading…
Cancel
Save