From fb8bba4bec447f888995941a748ed5c479e2afa0 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Fri, 31 Jan 2014 21:01:59 +0100 Subject: [PATCH] OP-1150 UI for thermal calibration: fill calibration extent fields for accel/gyro --- .../calibration/thermal/thermalcalibrationhelper.cpp | 10 +++++++++- .../calibration/thermal/thermalcalibrationhelper.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp index d72aabf85..3f6e8eaa3 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp @@ -76,6 +76,10 @@ bool ThermalCalibrationHelper::setupBoardForCalibration() for (int i = 0; i < AccelGyroSettings::GYRO_TEMP_COEFF_NUMELEM; i++) { data.gyro_temp_coeff[i] = 0.0f; } + + data.temp_calibrated_extent[0] = 0.0f; + data.temp_calibrated_extent[1] = 0.0f; + accelGyroSettings->setData(data); // clean any correction before calibrating @@ -316,7 +320,8 @@ void ThermalCalibrationHelper::calculate() } m_results.gyroCalibrated = ThermalCalibration::GyroscopeCalibration(datax, datay, dataz, datat, m_results.gyro, m_results.gyroInSigma, m_results.gyroOutSigma); - + m_results.accelGyroTempMin = datat.array().minCoeff(); + m_results.accelGyroTempMax = datat.array().maxCoeff(); // TODO: sanity checks needs to be enforced before accel calibration can be enabled and usable. /* setProcessPercentage(processPercentage() + 2); @@ -472,6 +477,9 @@ void ThermalCalibrationHelper::copyResultToSettings() data.accel_temp_coeff[1] = m_results.gyro[1]; data.accel_temp_coeff[2] = m_results.gyro[2]; } + data.temp_calibrated_extent[0] = m_results.accelGyroTempMin; + data.temp_calibrated_extent[1] = m_results.accelGyroTempMax; + accelGyroSettings->setData(data); accelGyroSettings->updated(); } diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h index 79bb62f3a..628a5816d 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h @@ -79,6 +79,8 @@ typedef struct { float gyroOutSigma[3]; float baroTempMin; float baroTempMax; + float accelGyroTempMin; + float accelGyroTempMax; } thermalCalibrationResults; class ThermalCalibrationHelper : public QObject { Q_OBJECT