Skip to content

Commit

Permalink
Plane: move manual mode throttle limits to main throttle limit function.
Browse files Browse the repository at this point in the history
  • Loading branch information
IamPete1 committed Feb 21, 2024
1 parent dc19629 commit 855831d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ArduPlane/mode.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ class ModeManual : public Mode
void run() override;

// true if throttle min/max limits should be applied
bool use_throttle_limits() const override { return false; }
bool use_throttle_limits() const override;

// true if voltage correction should be applied to throttle
bool use_battery_compensation() const override { return false; }
Expand Down
27 changes: 12 additions & 15 deletions ArduPlane/mode_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,8 @@ void ModeManual::update()
SRV_Channels::set_output_scaled(SRV_Channel::k_aileron, plane.roll_in_expo(false));
SRV_Channels::set_output_scaled(SRV_Channel::k_elevator, plane.pitch_in_expo(false));
output_rudder_and_steering(plane.rudder_in_expo(false));
float throttle = plane.get_throttle_input(true);


#if HAL_QUADPLANE_ENABLED
if (quadplane.available() && quadplane.option_is_set(QuadPlane::OPTION::IDLE_GOV_MANUAL)) {
// for quadplanes it can be useful to run the idle governor in MANUAL mode
// as it prevents the VTOL motors from running
int8_t min_throttle = plane.aparm.throttle_min.get();

// apply idle governor
#if AP_ICENGINE_ENABLED
plane.g2.ice_control.update_idle_governor(min_throttle);
#endif
throttle = MAX(throttle, min_throttle);
}
#endif
const float throttle = plane.get_throttle_input(true);
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, throttle);

plane.nav_roll_cd = ahrs.roll_sensor;
Expand All @@ -32,3 +18,14 @@ void ModeManual::run()
{
reset_controllers();
}

// true if throttle min/max limits should be applied
bool ModeManual::use_throttle_limits() const
{
#if HAL_QUADPLANE_ENABLED
if (quadplane.available() && quadplane.option_is_set(QuadPlane::OPTION::IDLE_GOV_MANUAL)) {
return true;
}
#endif
return false;
}

0 comments on commit 855831d

Please sign in to comment.