Fix some GPS issues discovered while testing
- set wp[1] properties immediately (don’t require an update cycle) - direct-to course-error is correct when init-ing the Direct-To; it was previously wrong when beginning the DTO, due to invalid course between identical SGGeods.
This commit is contained in:
parent
604a23166b
commit
317e9f8cc0
2 changed files with 16 additions and 3 deletions
|
@ -860,6 +860,14 @@ void GPS::wp1Changed()
|
|||
} else {
|
||||
_wayptController->update(0.0);
|
||||
_legDistanceNm = _wayptController->distanceToWayptM() * SG_METER_TO_NM;
|
||||
|
||||
// synchronise these properties immediately
|
||||
SGGeod p(_wayptController->position());
|
||||
_currentWayptNode->setDoubleValue("longitude-deg", p.getLongitudeDeg());
|
||||
_currentWayptNode->setDoubleValue("latitude-deg", p.getLatitudeDeg());
|
||||
_currentWayptNode->setDoubleValue("altitude-ft", p.getElevationFt());
|
||||
|
||||
_desiredCourse = getLegMagCourse();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -688,9 +688,14 @@ void DirectToController::init()
|
|||
void DirectToController::update(double)
|
||||
{
|
||||
double courseOriginToAircraft;
|
||||
|
||||
courseOriginToAircraft = SGGeodesy::courseDeg(_origin,_rnav->position());
|
||||
|
||||
double az2, distanceOriginToAircraft;
|
||||
SGGeodesy::inverse(_origin,_rnav->position(), courseOriginToAircraft, az2, distanceOriginToAircraft);
|
||||
if (distanceOriginToAircraft < 100.0) {
|
||||
// if we are very close to the origin point, use the target track so
|
||||
// course deviation comes out as zero
|
||||
courseOriginToAircraft = _targetTrack;
|
||||
}
|
||||
|
||||
_courseAircraftToTarget = SGGeodesy::courseDeg(_rnav->position(),_waypt->position());
|
||||
_distanceAircraftTargetMeter = SGGeodesy::distanceM(_rnav->position(),_waypt->position());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue