From c33f54378f8ca24dbcf6aa09b1cd64c6f3023be8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 21 Nov 2014 14:46:42 +1100 Subject: [PATCH] Plane: changed preflight calibration to prevent accel cal from MP MissionPlanner sends param1=1 and param3=1 for preflight calibration. This was having the effect of redoing the accel calibration as 1D cal on every flight! --- ArduPlane/GCS_Mavlink.pde | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ArduPlane/GCS_Mavlink.pde b/ArduPlane/GCS_Mavlink.pde index da1ed7c53b..2bda15cfc7 100644 --- a/ArduPlane/GCS_Mavlink.pde +++ b/ArduPlane/GCS_Mavlink.pde @@ -1008,22 +1008,21 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg) break; case MAV_CMD_PREFLIGHT_CALIBRATION: - if (packet.param1 == 1 || - packet.param2 == 1) { - startup_INS_ground(true); - } else if (packet.param3 == 1) { + if (packet.param3 == 1) { in_calibration = true; init_barometer(); if (airspeed.enabled()) { zero_airspeed(false); } in_calibration = false; - } - if (packet.param4 == 1) { + } else if (packet.param1 == 1 || + packet.param2 == 1) { + startup_INS_ground(true); + } else if (packet.param4 == 1) { trim_radio(); - } + } #if !defined( __AVR_ATmega1280__ ) - if (packet.param5 == 1) { + else if (packet.param5 == 1) { float trim_roll, trim_pitch; AP_InertialSensor_UserInteract_MAVLink interact(chan); if(ins.calibrate_accel(&interact, trim_roll, trim_pitch)) { @@ -1032,6 +1031,9 @@ void GCS_MAVLINK::handleMessage(mavlink_message_t* msg) } } #endif + else { + send_text_P(SEVERITY_LOW, PSTR("Unsupported preflight calibration")); + } result = MAV_RESULT_ACCEPTED; break;