1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

OP-1150 UI for thermal calibration: Zero gyro/accel calibration before acquisition

This commit is contained in:
Alessio Morale 2014-01-27 00:25:16 +01:00
parent afb7ba7ea4
commit 159ba7f697

View File

@ -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);