1
0
Fork 0

Fix normalization of heading-mag-deg

This commit is contained in:
James Turner 2020-04-26 12:24:57 +01:00
parent 1f07a8eba8
commit b69055ffca

View file

@ -463,8 +463,11 @@ FGProperties::update (double dt)
_rwday->setIntValue(r->tm_wday);
const double magvar = _magVar->getDoubleValue();
_headingMagnetic->setDoubleValue(_trueHeading->getDoubleValue() - magvar);
_trackMagnetic->setDoubleValue(_trueTrack->getDoubleValue() - magvar);
const auto hdgMag = SGMiscd::normalizePeriodic(0, 360.0, _trueHeading->getDoubleValue() - magvar);
_headingMagnetic->setDoubleValue(hdgMag);
const auto trackMag = SGMiscd::normalizePeriodic(0, 360.0, _trueTrack->getDoubleValue() - magvar);
_trackMagnetic->setDoubleValue(trackMag);
}