From 1a911553eb81404325235f4c7910e81b4eac84e4 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Mon, 13 Jul 2015 09:21:32 +0900 Subject: [PATCH] Copter: allow disabling ESC calibration --- ArduCopter/Parameters.cpp | 2 +- ArduCopter/esc_calibration.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ArduCopter/Parameters.cpp b/ArduCopter/Parameters.cpp index 8287925950..e02d271b41 100644 --- a/ArduCopter/Parameters.cpp +++ b/ArduCopter/Parameters.cpp @@ -357,7 +357,7 @@ const AP_Param::Info Copter::var_info[] PROGMEM = { // @DisplayName: ESC Calibration // @Description: Controls whether ArduCopter will enter ESC calibration on the next restart. Do not adjust this parameter manually. // @User: Advanced - // @Values: 0:Normal Start-up, 1:Start-up in ESC Calibration mode if throttle high, 2:Start-up in ESC Calibration mode regardless of throttle + // @Values: 0:Normal Start-up, 1:Start-up in ESC Calibration mode if throttle high, 2:Start-up in ESC Calibration mode regardless of throttle, 9:Disabled GSCALAR(esc_calibrate, "ESC", 0), // @Param: TUNE diff --git a/ArduCopter/esc_calibration.cpp b/ArduCopter/esc_calibration.cpp index e9fa650465..f17063c84a 100644 --- a/ArduCopter/esc_calibration.cpp +++ b/ArduCopter/esc_calibration.cpp @@ -13,7 +13,8 @@ enum ESCCalibrationModes { ESCCAL_NONE = 0, ESCCAL_PASSTHROUGH_IF_THROTTLE_HIGH = 1, ESCCAL_PASSTHROUGH_ALWAYS = 2, - ESCCAL_AUTO = 3 + ESCCAL_AUTO = 3, + ESCCAL_DISABLED = 9, }; // check if we should enter esc calibration mode @@ -23,7 +24,7 @@ void Copter::esc_calibration_startup_check() pre_arm_rc_checks(); if (!ap.pre_arm_rc_check) { // clear esc flag for next time - if (g.esc_calibrate != ESCCAL_NONE) { + if ((g.esc_calibrate != ESCCAL_NONE) && (g.esc_calibrate != ESCCAL_DISABLED)) { g.esc_calibrate.set_and_save(ESCCAL_NONE); } return; @@ -59,12 +60,16 @@ void Copter::esc_calibration_startup_check() // perform automatic ESC calibration esc_calibration_auto(); break; + case ESCCAL_DISABLED: default: // do nothing break; } + // clear esc flag for next time - g.esc_calibrate.set_and_save(ESCCAL_NONE); + if (g.esc_calibrate != ESCCAL_DISABLED) { + g.esc_calibrate.set_and_save(ESCCAL_NONE); + } } // esc_calibration_passthrough - pass through pilot throttle to escs