1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-975 Calibrating a single sensor doesn't mean reset the other...

This commit is contained in:
Alessio Morale 2014-04-09 19:57:23 +02:00
parent 6c0851769e
commit 1f0885dd4f
2 changed files with 23 additions and 7 deletions

View File

@ -435,8 +435,10 @@ void ConfigRevoWidget::doStartSixPointCalibration(bool calibrateAccel, bool cali
Q_ASSERT(revoCalibration); Q_ASSERT(revoCalibration);
Q_ASSERT(homeLocation); Q_ASSERT(homeLocation);
RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData(); RevoCalibration::DataFields revoCalibrationData = revoCalibration->getData();
savedSettings.revoCalibration = revoCalibration->getData();
HomeLocation::DataFields homeLocationData = homeLocation->getData(); HomeLocation::DataFields homeLocationData = homeLocation->getData();
AccelGyroSettings::DataFields accelGyroSettingsData = accelGyroSettings->getData(); AccelGyroSettings::DataFields accelGyroSettingsData = accelGyroSettings->getData();
savedSettings.accelGyroSettings = accelGyroSettings->getData();
// check if Homelocation is set // check if Homelocation is set
if (!homeLocationData.Set) { if (!homeLocationData.Set) {
@ -721,14 +723,22 @@ void ConfigRevoWidget::computeScaleBias(bool mag, bool accel)
accelGyroSettingsData.accel_bias[AccelGyroSettings::ACCEL_BIAS_Z]; accelGyroSettingsData.accel_bias[AccelGyroSettings::ACCEL_BIAS_Z];
} }
if (good_calibration) { if (good_calibration) {
revoCalibration->setData(revoCalibrationData); if(mag){
accelGyroSettings->setData(accelGyroSettingsData); revoCalibration->setData(revoCalibrationData);
} else {
revoCalibration->setData(savedSettings.revoCalibration);
}
if(accel){
accelGyroSettings->setData(accelGyroSettingsData);
} else {
accelGyroSettings->setData(savedSettings.accelGyroSettings);
}
m_ui->sixPointCalibInstructions->append("Computed sensor scale and bias..."); m_ui->sixPointCalibInstructions->append("Computed sensor scale and bias...");
} else {
revoCalibrationData = revoCalibration->getData();
accelGyroSettingsData = accelGyroSettings->getData();
m_ui->sixPointCalibInstructions->append("Bad calibration. Please repeat.");
} }
m_ui->sixPointCalibInstructions->append("Bad calibration. Please repeat.");
position = -1; // set to run again position = -1; // set to run again
} }

View File

@ -43,9 +43,13 @@
#include "calibration/thermal/thermalcalibrationmodel.h" #include "calibration/thermal/thermalcalibrationmodel.h"
class Ui_Widget; class Ui_Widget;
class ConfigRevoWidget : public ConfigTaskWidget { class ConfigRevoWidget : public ConfigTaskWidget {
Q_OBJECT Q_OBJECT
typedef struct {
RevoCalibration::DataFields revoCalibration;
AccelGyroSettings::DataFields accelGyroSettings;
} SavedSettings;
public: public:
ConfigRevoWidget(QWidget *parent = 0); ConfigRevoWidget(QWidget *parent = 0);
~ConfigRevoWidget(); ~ConfigRevoWidget();
@ -56,6 +60,8 @@ private:
// ! Computes the scale and bias of the mag based on collected data // ! Computes the scale and bias of the mag based on collected data
void computeScaleBias(bool mag, bool accel); void computeScaleBias(bool mag, bool accel);
SavedSettings savedSettings;
OpenPilot::ThermalCalibrationModel *m_thermalCalibrationModel; OpenPilot::ThermalCalibrationModel *m_thermalCalibrationModel;
Ui_RevoSensorsWidget *m_ui; Ui_RevoSensorsWidget *m_ui;
QMutex sensorsUpdateLock; QMutex sensorsUpdateLock;