control: do not constantly ask for mag reset if yaw not aligned

This also prevents triggering the `_mag_yaw_reset_req` flag in magless
mode; preventing the GNSS fustion from starting.
This commit is contained in:
bresch 2021-07-27 10:15:46 +02:00 committed by Mathieu Bresciani
parent 639e0a39cf
commit 521b9f5dcc
1 changed files with 2 additions and 3 deletions

View File

@ -529,8 +529,7 @@ void Ekf::controlGpsFusion()
// If the heading is not aligned, reset the yaw and magnetic field states
// Do not use external vision for yaw if using GPS because yaw needs to be
// defined relative to an NED reference frame
if (!_control_status.flags.yaw_align
|| _control_status.flags.ev_yaw
if (_control_status.flags.ev_yaw
|| _mag_inhibit_yaw_reset_req
|| _mag_yaw_reset_req) {
@ -540,7 +539,7 @@ void Ekf::controlGpsFusion()
stopEvYawFusion();
_inhibit_ev_yaw_use = true;
} else {
} else if (_control_status.flags.yaw_align) {
// If the heading is valid start using gps aiding
startGpsFusion();
}