diff --git a/src/modules/ekf2/EKF/position_fusion.cpp b/src/modules/ekf2/EKF/position_fusion.cpp index cd11355578b..7e88ad46445 100644 --- a/src/modules/ekf2/EKF/position_fusion.cpp +++ b/src/modules/ekf2/EKF/position_fusion.cpp @@ -201,13 +201,25 @@ void Ekf::resetAltitudeTo(const float new_altitude, float new_vert_pos_var) updateVerticalPositionResetStatus(delta_z); #if defined(CONFIG_EKF2_BAROMETER) - _baro_b_est.setBias(_baro_b_est.getBias() + delta_z); + + if (_control_status.flags.baro_hgt) { + _baro_b_est.setBias(_baro_b_est.getBias() + delta_z); + } + #endif // CONFIG_EKF2_BAROMETER #if defined(CONFIG_EKF2_EXTERNAL_VISION) - _ev_hgt_b_est.setBias(_ev_hgt_b_est.getBias() - delta_z); + + if (_control_status.flags.ev_hgt) { + _ev_hgt_b_est.setBias(_ev_hgt_b_est.getBias() - delta_z); + } + #endif // CONFIG_EKF2_EXTERNAL_VISION #if defined(CONFIG_EKF2_GNSS) - _gps_hgt_b_est.setBias(_gps_hgt_b_est.getBias() + delta_z); + + if (_control_status.flags.gps_hgt) { + _gps_hgt_b_est.setBias(_gps_hgt_b_est.getBias() + delta_z); + } + #endif // CONFIG_EKF2_GNSS #if defined(CONFIG_EKF2_TERRAIN)