From 159ba7f69757d91d0a3edf73991add1a62cab6d1 Mon Sep 17 00:00:00 2001 From: Alessio Morale Date: Mon, 27 Jan 2014 00:25:16 +0100 Subject: [PATCH] OP-1150 UI for thermal calibration: Zero gyro/accel calibration before acquisition --- .../thermal/thermalcalibrationhelper.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp index b084dcae5..b733330d5 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp @@ -65,6 +65,20 @@ bool ThermalCalibrationHelper::setupBoardForCalibration() Q_ASSERT(baroSensor); setMetadataForCalibration(baroSensor); + // Clean up any gyro/accel correction before calibrating + AccelGyroSettings *accelGyroSettings = AccelGyroSettings::GetInstance(objManager); + Q_ASSERT(accelGyroSettings); + AccelGyroSettings::DataFields data = accelGyroSettings->getData(); + for(int i = 0; i < AccelGyroSettings::ACCEL_TEMP_COEFF_NUMELEM; i++){ + data.accel_temp_coeff[i] = 0.0f; + } + + for(int i = 0; i < AccelGyroSettings::GYRO_TEMP_COEFF_NUMELEM; i++){ + data.gyro_temp_coeff[i] = 0.0f; + } + + accelGyroSettings->setData(data); + // clean any correction before calibrating RevoSettings *revoSettings = RevoSettings::GetInstance(objManager); Q_ASSERT(revoSettings); @@ -102,6 +116,11 @@ bool ThermalCalibrationHelper::saveBoardInitialSettings() Q_ASSERT(baroSensor); m_boardInitialSettings.baroensorMeta = baroSensor->getMetadata(); + // accelGyroSettings data + AccelGyroSettings *accelGyroSettings = AccelGyroSettings::GetInstance(objManager); + Q_ASSERT(accelGyroSettings); + m_boardInitialSettings.accelGyroSettings = accelGyroSettings->getData(); + // revoSettings data RevoSettings *revoSettings = RevoSettings::GetInstance(objManager); Q_ASSERT(revoSettings); @@ -147,6 +166,11 @@ bool ThermalCalibrationHelper::restoreInitialSettings() Q_ASSERT(baroSensor); baroSensor->setMetadata(m_boardInitialSettings.baroensorMeta); + // AccelGyroSettings data + AccelGyroSettings *accelGyroSettings = AccelGyroSettings::GetInstance(objManager); + Q_ASSERT(accelGyroSettings); + accelGyroSettings->setData(m_boardInitialSettings.accelGyroSettings); + // revoSettings data RevoSettings *revoSettings = RevoSettings::GetInstance(objManager); Q_ASSERT(revoSettings);