mirror of https://github.com/ArduPilot/ardupilot
Plane: ignore invalid pilot throttle
This commit is contained in:
parent
97417a1038
commit
483ef18087
|
@ -125,6 +125,10 @@ bool Plane::have_reverse_thrust(void) const
|
||||||
*/
|
*/
|
||||||
float Plane::get_throttle_input(bool no_deadzone) const
|
float Plane::get_throttle_input(bool no_deadzone) const
|
||||||
{
|
{
|
||||||
|
if (!rc().has_valid_input()) {
|
||||||
|
// Return 0 if there is no valid input
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
float ret;
|
float ret;
|
||||||
if (no_deadzone) {
|
if (no_deadzone) {
|
||||||
ret = channel_throttle->get_control_in_zero_dz();
|
ret = channel_throttle->get_control_in_zero_dz();
|
||||||
|
@ -143,6 +147,10 @@ float Plane::get_throttle_input(bool no_deadzone) const
|
||||||
*/
|
*/
|
||||||
float Plane::get_adjusted_throttle_input(bool no_deadzone) const
|
float Plane::get_adjusted_throttle_input(bool no_deadzone) const
|
||||||
{
|
{
|
||||||
|
if (!rc().has_valid_input()) {
|
||||||
|
// Return 0 if there is no valid input
|
||||||
|
return 0.0;
|
||||||
|
}
|
||||||
if ((plane.channel_throttle->get_type() != RC_Channel::ControlType::RANGE) ||
|
if ((plane.channel_throttle->get_type() != RC_Channel::ControlType::RANGE) ||
|
||||||
(flight_option_enabled(FlightOptions::CENTER_THROTTLE_TRIM)) == 0) {
|
(flight_option_enabled(FlightOptions::CENTER_THROTTLE_TRIM)) == 0) {
|
||||||
return get_throttle_input(no_deadzone);
|
return get_throttle_input(no_deadzone);
|
||||||
|
|
|
@ -551,9 +551,7 @@ void Plane::set_servos_controlled(void)
|
||||||
control_mode == &mode_fbwa ||
|
control_mode == &mode_fbwa ||
|
||||||
control_mode == &mode_autotune) {
|
control_mode == &mode_autotune) {
|
||||||
// a manual throttle mode
|
// a manual throttle mode
|
||||||
if (!rc().has_valid_input()) {
|
if (g.throttle_passthru_stabilize) {
|
||||||
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, g.throttle_passthru_stabilize ? 0.0 : MAX(min_throttle,0));
|
|
||||||
} else if (g.throttle_passthru_stabilize) {
|
|
||||||
// manual pass through of throttle while in FBWA or
|
// manual pass through of throttle while in FBWA or
|
||||||
// STABILIZE mode with THR_PASS_STAB set
|
// STABILIZE mode with THR_PASS_STAB set
|
||||||
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, get_throttle_input(true));
|
SRV_Channels::set_output_scaled(SRV_Channel::k_throttle, get_throttle_input(true));
|
||||||
|
|
Loading…
Reference in New Issue