Skip to content

Commit

Permalink
Plane: move guided throttle passthrough to mode_guided
Browse files Browse the repository at this point in the history
  • Loading branch information
IamPete1 authored and tridge committed Jan 31, 2024
1 parent 98c5912 commit b119a2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 10 additions & 2 deletions ArduPlane/mode_guided.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,21 @@ void ModeGuided::update()
plane.calc_nav_pitch();
}

// Received an external msg that guides throttle in the last 3 seconds?
if (plane.aparm.throttle_cruise > 1 &&
// Throttle output
if (plane.guided_throttle_passthru) {
// manual passthrough of throttle in fence breach
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, plane.get_throttle_input(true));

} else if (plane.aparm.throttle_cruise > 1 &&
plane.guided_state.last_forced_throttle_ms > 0 &&
millis() - plane.guided_state.last_forced_throttle_ms < 3000) {
// Received an external msg that guides throttle in the last 3 seconds?
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, plane.guided_state.forced_throttle);

} else {
// TECS control
plane.calc_throttle();

}

}
Expand Down
4 changes: 0 additions & 4 deletions ArduPlane/servos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,10 +601,6 @@ void Plane::set_throttle(void)
// get throttle, but adjust center to output TRIM_THROTTLE if flight option set
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, get_adjusted_throttle_input(true));
}
} else if (control_mode->is_guided_mode() &&
guided_throttle_passthru) {
// manual pass through of throttle while in GUIDED
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, get_throttle_input(true));
}

if (control_mode->use_battery_compensation()) {
Expand Down

0 comments on commit b119a2a

Please sign in to comment.