ekf2: mag in air reset fall back to regular resetMagHeading() if realignYawGPS() fails

This commit is contained in:
Daniel Agar 2022-03-23 15:29:00 -04:00
parent 05133aed27
commit ecdade3638
1 changed files with 2 additions and 1 deletions

View File

@ -183,8 +183,9 @@ void Ekf::runInAirYawReset(const Vector3f &mag_sample)
if (_control_status.flags.gps && _control_status.flags.fixed_wing) {
has_realigned_yaw = realignYawGPS(mag_sample);
}
} else if (canResetMagHeading()) {
if (!has_realigned_yaw && canResetMagHeading()) {
has_realigned_yaw = resetMagHeading();
}