From 1ff443d667cc835ec12d401123796f8d41ba486c Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 13 Apr 2015 13:11:28 +0900 Subject: [PATCH] Copter: add rangefinder pre-arm check --- ArduCopter/motors.pde | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ArduCopter/motors.pde b/ArduCopter/motors.pde index e8976f0ef7..3f6c960b4b 100644 --- a/ArduCopter/motors.pde +++ b/ArduCopter/motors.pde @@ -439,6 +439,16 @@ static bool pre_arm_checks(bool display_failure) } return false; } + +#if CONFIG_SONAR == ENABLED + // check range finder + if (!sonar.pre_arm_check()) { + if (display_failure) { + gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: check range finder")); + } + return false; + } +#endif } // if we've gotten this far then pre arm checks have completed