Plane: Limit possible climb/sink rate in FBWB/CRUISE to TECS limits

This commit is contained in:
pieniacy 2024-04-20 14:08:45 +02:00 committed by Andrew Tridgell
parent d1d71db8a0
commit 4e29e1e6b0

View File

@ -401,7 +401,10 @@ void Plane::update_fbwb_speed_height(void)
set_target_altitude_current();
}
int32_t alt_change_cm = g.flybywire_climb_rate * elevator_input * dt * 100;
float climb_rate = g.flybywire_climb_rate * elevator_input;
climb_rate = constrain_float(climb_rate, -TECS_controller.get_max_sinkrate(), TECS_controller.get_max_climbrate());
int32_t alt_change_cm = climb_rate * dt * 100;
change_target_altitude(alt_change_cm);
#if HAL_SOARING_ENABLED