Plane: Revert min throttle during transitions

This commit is contained in:
George Zogopoulos 2024-07-30 12:13:29 +02:00 committed by Andrew Tridgell
parent 548b871168
commit 85bb4ad88f
1 changed files with 10 additions and 4 deletions

View File

@ -521,12 +521,10 @@ float Plane::apply_throttle_limits(float throttle_in)
// Query the conditions where TKOFF_THR_MAX applies.
const bool use_takeoff_throttle =
#if HAL_QUADPLANE_ENABLED
quadplane.in_transition() ||
#endif
(flight_stage == AP_FixedWing::FlightStage::TAKEOFF) ||
(flight_stage == AP_FixedWing::FlightStage::ABORT_LANDING);
// Handle throttle limits for takeoff conditions.
if (use_takeoff_throttle) {
if (aparm.takeoff_throttle_max != 0) {
// Replace max throttle with the takeoff max throttle setting.
@ -534,7 +532,6 @@ float Plane::apply_throttle_limits(float throttle_in)
// Or (in contrast) to give some extra throttle during the initial climb.
max_throttle = aparm.takeoff_throttle_max.get();
}
// Do not allow min throttle to go below a lower threshold.
// This is typically done to protect against premature stalls close to the ground.
const bool use_throttle_range = (aparm.takeoff_options & (uint32_t)AP_FixedWing::TakeoffOption::THROTTLE_RANGE);
@ -556,6 +553,15 @@ float Plane::apply_throttle_limits(float throttle_in)
min_throttle = 0;
}
// Handle throttle limits for transition conditions.
#if HAL_QUADPLANE_ENABLED
if (quadplane.in_transition()) {
if (aparm.takeoff_throttle_max != 0) {
max_throttle = aparm.takeoff_throttle_max.get();
}
}
#endif
// Compensate the limits for battery voltage drop.
// This relaxes the limits when the battery is getting depleted.
g2.fwd_batt_cmp.apply_min_max(min_throttle, max_throttle);