diff --git a/libraries/AP_Motors/AP_MotorsHeli.h b/libraries/AP_Motors/AP_MotorsHeli.h index b78b7b4a6e..571d63645b 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.h +++ b/libraries/AP_Motors/AP_MotorsHeli.h @@ -130,6 +130,9 @@ public: // accessor to get the takeoff collective flag signifying that current collective is greater than collective required to indicate takeoff bool get_takeoff_collective() const { return _heliflags.takeoff_collective; } + // accessor to get the takeoff collective flag signifying that current collective is greater than collective required to indicate takeoff + bool get_below_mid_collective() const { return _heliflags.below_mid_collective; } + // support passing init_targets_on_arming flag to greater code bool init_targets_on_arming() const override { return _heliflags.init_targets_on_arming; } @@ -241,6 +244,7 @@ protected: uint8_t servo_test_running : 1; // true if servo_test is running uint8_t land_complete : 1; // true if aircraft is landed uint8_t takeoff_collective : 1; // true if collective is above 30% between H_COL_MID and H_COL_MAX + uint8_t below_mid_collective : 1; // true if collective is below H_COL_MID } _heliflags; // parameters diff --git a/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp b/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp index 581e969fba..45e8bcddd4 100644 --- a/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli_Dual.cpp @@ -552,6 +552,13 @@ void AP_MotorsHeli_Dual::move_actuators(float roll_out, float pitch_out, float c limit.throttle_lower = true; } + // updates below mid collective flag + if (collective_out <= _collective_mid_pct) { + _heliflags.below_mid_collective = true; + } else { + _heliflags.below_mid_collective = false; + } + // updates takeoff collective flag based on 50% hover collective update_takeoff_collective_flag(collective_out); diff --git a/libraries/AP_Motors/AP_MotorsHeli_Quad.cpp b/libraries/AP_Motors/AP_MotorsHeli_Quad.cpp index 9888253bf0..7c4f83a145 100644 --- a/libraries/AP_Motors/AP_MotorsHeli_Quad.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli_Quad.cpp @@ -230,6 +230,13 @@ void AP_MotorsHeli_Quad::move_actuators(float roll_out, float pitch_out, float c limit.throttle_lower = true; } + // updates below mid collective flag + if (collective_out <= _collective_mid_pct) { + _heliflags.below_mid_collective = true; + } else { + _heliflags.below_mid_collective = false; + } + // updates takeoff collective flag based on 50% hover collective update_takeoff_collective_flag(collective_out); diff --git a/libraries/AP_Motors/AP_MotorsHeli_Single.cpp b/libraries/AP_Motors/AP_MotorsHeli_Single.cpp index 882cbccb38..267438f5c3 100644 --- a/libraries/AP_Motors/AP_MotorsHeli_Single.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli_Single.cpp @@ -417,6 +417,14 @@ void AP_MotorsHeli_Single::move_actuators(float roll_out, float pitch_out, float if (_heliflags.landing_collective && collective_out < _collective_mid_pct && !_heliflags.in_autorotation) { collective_out = _collective_mid_pct; limit.throttle_lower = true; + + } + + // updates below mid collective flag + if (collective_out <= _collective_mid_pct) { + _heliflags.below_mid_collective = true; + } else { + _heliflags.below_mid_collective = false; } // updates takeoff collective flag based on 50% hover collective