TECS: set true airspeed rate setpoint to zero if airspeed is not enabled

Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
RomanBapst
2022-07-12 09:07:20 +02:00
committed by Martina Rivizzigno
parent 6dbea21ef5
commit b57d3c6d74
+7 -1
View File
@@ -170,7 +170,13 @@ void TECS::_update_speed_setpoint()
_TAS_setpoint_adj = constrain(_TAS_setpoint, _TAS_min, _TAS_max);
// calculate the demanded true airspeed rate of change based on first order response of true airspeed error
_TAS_rate_setpoint = constrain((_TAS_setpoint_adj - _tas_state) * _airspeed_error_gain, velRateMin, velRateMax);
// if airspeed measurement is not enabled then always set the rate setpoint to zero in order to avoid constant rate setpoints
if (airspeed_sensor_enabled()) {
_TAS_rate_setpoint = constrain((_TAS_setpoint_adj - _tas_state) * _airspeed_error_gain, velRateMin, velRateMax);
} else {
_TAS_rate_setpoint = 0.0f;
}
}