From f22a1d3e6d4af2cf4fd15aa84a66661c085d3b47 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Sep 2015 12:02:52 +1000 Subject: [PATCH] AP_Motors: display message in heli parameter_check() --- libraries/AP_Motors/AP_MotorsHeli.cpp | 15 ++++++++++++++- libraries/AP_Motors/AP_MotorsHeli.h | 2 +- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Motors/AP_MotorsHeli.cpp b/libraries/AP_Motors/AP_MotorsHeli.cpp index e8d6d98129..a31bd6831f 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.cpp +++ b/libraries/AP_Motors/AP_MotorsHeli.cpp @@ -22,6 +22,7 @@ #include #include #include "AP_MotorsHeli.h" +#include extern const AP_HAL::HAL& hal; @@ -272,25 +273,37 @@ void AP_MotorsHeli::output_disarmed() } // parameter_check - check if helicopter specific parameters are sensible -bool AP_MotorsHeli::parameter_check() const +bool AP_MotorsHeli::parameter_check(bool display_msg) const { // returns false if _rsc_setpoint is not higher than _rsc_critical as this would not allow rotor_runup_complete to ever return true if (_rsc_critical >= _rsc_setpoint) { + if (display_msg) { + GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, PSTR("PreArm: H_RSC_CRITICAL too large")); + } return false; } // returns false if RSC Mode is not set to a valid control mode if (_rsc_mode <= (int8_t)ROTOR_CONTROL_MODE_DISABLED || _rsc_mode > (int8_t)ROTOR_CONTROL_MODE_CLOSED_LOOP_POWER_OUTPUT) { + if (display_msg) { + GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, PSTR("PreArm: H_RSC_MODE invalid")); + } return false; } // returns false if RSC Runup Time is less than Ramp time as this could cause undesired behaviour of rotor speed estimate if (_rsc_runup_time <= _rsc_ramp_time){ + if (display_msg) { + GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, PSTR("PreArm: H_RUNUP_TIME too small")); + } return false; } // returns false if idle output is higher than critical rotor speed as this could block runup_complete from going false if ( _rsc_idle_output >= _rsc_critical){ + if (display_msg) { + GCS_MAVLINK::send_statustext_all(MAV_SEVERITY_CRITICAL, PSTR("PreArm: H_RSC_IDLE too large")); + } return false; } diff --git a/libraries/AP_Motors/AP_MotorsHeli.h b/libraries/AP_Motors/AP_MotorsHeli.h index b404fb7686..a58a0988b5 100644 --- a/libraries/AP_Motors/AP_MotorsHeli.h +++ b/libraries/AP_Motors/AP_MotorsHeli.h @@ -102,7 +102,7 @@ public: virtual bool allow_arming() const = 0; // parameter_check - returns true if helicopter specific parameters are sensible, used for pre-arm check - bool parameter_check() const; + bool parameter_check(bool display_msg) const; // has_flybar - returns true if we have a mechical flybar virtual bool has_flybar() const { return AP_MOTORS_HELI_NOFLYBAR; }