From 3f0af2ce29034750bec010b7f3600a18e748d005 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 11 Apr 2019 19:51:25 +1000 Subject: [PATCH] AP_InertialSensor: skip gyro cal on watchdog reset --- libraries/AP_InertialSensor/AP_InertialSensor.cpp | 11 +++++++++++ libraries/AP_InertialSensor/AP_InertialSensor.h | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.cpp b/libraries/AP_InertialSensor/AP_InertialSensor.cpp index 30ecce8a29..3a129f9bab 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor.cpp @@ -1986,6 +1986,17 @@ MAV_RESULT AP_InertialSensor::simple_accel_cal() return result; } +/* + see if gyro calibration should be performed + */ +AP_InertialSensor::Gyro_Calibration_Timing AP_InertialSensor::gyro_calibration_timing() +{ + if (hal.util->was_watchdog_reset()) { + return GYRO_CAL_NEVER; + } + return (Gyro_Calibration_Timing)_gyro_cal_timing.get(); +} + namespace AP { diff --git a/libraries/AP_InertialSensor/AP_InertialSensor.h b/libraries/AP_InertialSensor/AP_InertialSensor.h index 5f8615a8a8..1cc571a95e 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor.h +++ b/libraries/AP_InertialSensor/AP_InertialSensor.h @@ -135,7 +135,7 @@ public: bool gyro_calibrated_ok(uint8_t instance) const { return _gyro_cal_ok[instance]; } bool gyro_calibrated_ok_all() const; bool use_gyro(uint8_t instance) const; - Gyro_Calibration_Timing gyro_calibration_timing() { return (Gyro_Calibration_Timing)_gyro_cal_timing.get(); } + Gyro_Calibration_Timing gyro_calibration_timing(); bool get_accel_health(uint8_t instance) const { return (instance<_accel_count) ? _accel_healthy[instance] : false; } bool get_accel_health(void) const { return get_accel_health(_primary_accel); }