diff --git a/libraries/AP_Motors/AP_MotorsHeli.cpp b/libraries/AP_Motors/AP_MotorsHeli.cpp index a2b42fde66..8353c64e57 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli.cpp @@ -176,6 +176,9 @@ void AP_MotorsHeli::output() output_logic(); if (_flags.armed) { + //block servo_test from happening at disarm + _servo_test_cycle_counter = 0; + calculate_armed_scalars(); if (!_flags.interlock) { output_armed_zero_throttle(); @@ -216,9 +219,13 @@ void AP_MotorsHeli::output_armed_zero_throttle() void AP_MotorsHeli::output_disarmed() { if (_servo_test_cycle_counter > 0){ + //set servo_test_flag + _heliflags.servo_test_running = true; // perform boot-up servo test cycle if enabled servo_test(); } else { + //set servo_test flag + _heliflags.servo_test_running = false; // manual override (i.e. when setting up swash) switch (_servo_mode) { case SERVO_CONTROL_MODE_MANUAL_PASSTHROUGH: diff --git a/libraries/AP_Motors/AP_MotorsHeli.h b/libraries/AP_Motors/AP_MotorsHeli.h index 90b8be5fd7..cdaa465547 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.h +++ b/libraries/AP_Motors/AP_MotorsHeli.h @@ -130,6 +130,9 @@ public: // set_enable_bailout - allows main code to set when RSC can immediately ramp engine instantly void set_enable_bailout(bool bailout) { _heliflags.enable_bailout = bailout; } + // return true if the servo test is still running/pending + bool servo_test_running() const { return _heliflags.servo_test_running; } + // var_info for holding Parameter information static const struct AP_Param::GroupInfo var_info[]; @@ -199,6 +202,7 @@ protected: uint8_t save_rsc_mode : 1; // used to determine the rsc mode needs to be saved while disarmed uint8_t in_autorotation : 1; // true if aircraft is in autorotation uint8_t enable_bailout : 1; // true if allowing RSC to quickly ramp up engine + uint8_t servo_test_running : 1; // true if servo_test is running } _heliflags; // parameters