From af43666b6a884acf7f1161d5f48af2713d690453 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Wed, 26 Jul 2017 19:36:57 +0900 Subject: [PATCH] Copter: battery arming checks call parent AP_Arming --- ArduCopter/AP_Arming.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ArduCopter/AP_Arming.cpp b/ArduCopter/AP_Arming.cpp index f48bcadd74..f9d9a7658c 100644 --- a/ArduCopter/AP_Arming.cpp +++ b/ArduCopter/AP_Arming.cpp @@ -200,12 +200,30 @@ bool AP_Arming_Copter::board_voltage_checks(bool display_failure) // check battery voltage if ((checks_to_perform == ARMING_CHECK_ALL) || (checks_to_perform & ARMING_CHECK_VOLTAGE)) { - if (copter.failsafe.battery || (!copter.ap.usb_connected && copter.battery.exhausted(g.fs_batt_voltage, g.fs_batt_mah))) { + if (copter.failsafe.battery) { + if (display_failure) { + gcs().send_text(MAV_SEVERITY_CRITICAL,"PreArm: Battery failsafe"); + } + return false; + } + + // all following checks are skipped if USB is connected + if (copter.ap.usb_connected) { + return true; + } + + // check if battery is exhausted + if (copter.battery.exhausted(g.fs_batt_voltage, g.fs_batt_mah)) { if (display_failure) { gcs_send_text(MAV_SEVERITY_CRITICAL,"PreArm: Check Battery"); } return false; } + + // call parent battery checks + if (!AP_Arming::battery_checks(display_failure)) { + return false; + } } return true;