diff --git a/src/modules/vtol_att_control/standard.cpp b/src/modules/vtol_att_control/standard.cpp index 37dd6b319a..6a90bf7509 100644 --- a/src/modules/vtol_att_control/standard.cpp +++ b/src/modules/vtol_att_control/standard.cpp @@ -205,7 +205,7 @@ void Standard::update_transition_state() { const hrt_abstime now = hrt_absolute_time(); float mc_weight = 1.0f; - float time_since_trans_start = (float)(now - _vtol_schedule.transition_start) * 1e-6f; + const float time_since_trans_start = (float)(now - _vtol_schedule.transition_start) * 1e-6f; VtolType::update_transition_state(); @@ -213,7 +213,7 @@ void Standard::update_transition_state() // in any other case the fixed wing attitude controller publishes attitude setpoint from manual stick input. if (_v_control_mode->flag_control_climb_rate_enabled) { // we need the incoming (virtual) attitude setpoints (both mc and fw) to be recent, otherwise return (means the previous setpoint stays active) - if (_mc_virtual_att_sp->timestamp < (now - 1_s) && _fw_virtual_att_sp->timestamp < (now - 1_s)) { + if (_mc_virtual_att_sp->timestamp < (now - 1_s) || _fw_virtual_att_sp->timestamp < (now - 1_s)) { return; } diff --git a/src/modules/vtol_att_control/tiltrotor.cpp b/src/modules/vtol_att_control/tiltrotor.cpp index 3ce0ecbe91..3d2c2e2aa3 100644 --- a/src/modules/vtol_att_control/tiltrotor.cpp +++ b/src/modules/vtol_att_control/tiltrotor.cpp @@ -286,7 +286,7 @@ void Tiltrotor::update_transition_state() // in any other case the fixed wing attitude controller publishes attitude setpoint from manual stick input. if (_v_control_mode->flag_control_climb_rate_enabled) { // we need the incoming (virtual) attitude setpoints (both mc and fw) to be recent, otherwise return (means the previous setpoint stays active) - if (_mc_virtual_att_sp->timestamp < (now - 1_s) && _fw_virtual_att_sp->timestamp < (now - 1_s)) { + if (_mc_virtual_att_sp->timestamp < (now - 1_s) || _fw_virtual_att_sp->timestamp < (now - 1_s)) { return; } @@ -304,7 +304,7 @@ void Tiltrotor::update_transition_state() _thrust_transition = _fw_virtual_att_sp->thrust_body[0]; } - float time_since_trans_start = (float)(now - _vtol_schedule.transition_start) * 1e-6f; + const float time_since_trans_start = (float)(now - _vtol_schedule.transition_start) * 1e-6f; if (_vtol_schedule.flight_mode == vtol_mode::TRANSITION_FRONT_P1) { // for the first part of the transition all rotors are enabled