From c3d21a457ff10185a52940972640ab0dda7e3f5b Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Tue, 28 May 2013 21:50:31 +0900 Subject: [PATCH] Copter: add pre-arm board voltage check Copter will not arm unless board voltage is over 4.5V --- ArduCopter/config.h | 4 ++++ ArduCopter/motors.pde | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/ArduCopter/config.h b/ArduCopter/config.h index 4ce6654c95..62aae16f7c 100644 --- a/ArduCopter/config.h +++ b/ArduCopter/config.h @@ -382,6 +382,10 @@ # define HIGH_DISCHARGE 1760 #endif +#ifndef BOARD_VOLTAGE_MIN + # define BOARD_VOLTAGE_MIN 4500 // min board voltage in milli volts for pre-arm checks +#endif + // Battery failsafe #ifndef FS_BATTERY # define FS_BATTERY DISABLED diff --git a/ArduCopter/motors.pde b/ArduCopter/motors.pde index 66c591b892..dffbc14877 100644 --- a/ArduCopter/motors.pde +++ b/ArduCopter/motors.pde @@ -264,6 +264,14 @@ static void pre_arm_checks(bool display_failure) } #endif + // check board voltage + if(board_voltage() < BOARD_VOLTAGE_MIN) { + if (display_failure) { + gcs_send_text_P(SEVERITY_HIGH,PSTR("PreArm: Low Board Voltage")); + } + return; + } + // if we've gotten this far then pre arm checks have completed ap.pre_arm_check = true; }