diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp index bd0a65796..cb2fec593 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.cpp @@ -364,7 +364,6 @@ void ThermalCalibrationHelper::calculate() .arg(m_results.accelOutSigma[0]).arg(m_results.accelOutSigma[1]).arg(m_results.accelOutSigma[2]) + QChar::CarriageReturn; qDebug() << str; m_debugStream << str; - copyResultToSettings(); emit calculationCompleted(); closeDebugLog(); } diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h index a01242d0e..ad88227cd 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationhelper.h @@ -116,6 +116,8 @@ public: return m_results.baroCalibrated && ((m_results.baroTempMax - m_results.baroTempMin) > TargetTempDelta); } + void copyResultToSettings(); + signals: void instructionsAdded(QString text, WizardModel::MessageType type = WizardModel::Info); void statusRestoreCompleted(bool succesful); diff --git a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h index f3abd49ca..30b78e3b8 100644 --- a/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h +++ b/ground/openpilotgcs/src/plugins/config/calibration/thermal/thermalcalibrationmodel.h @@ -88,6 +88,12 @@ public: } } + bool dirty() + { + return m_dirty; + } + + public slots: int progress() { @@ -131,6 +137,7 @@ private: bool m_cancelEnabled; bool m_endEnabled; bool m_initDone; + bool m_dirty; int m_progress; float m_temperature; float m_temperatureGradient; @@ -197,6 +204,7 @@ public slots: } void startWizard() { + m_dirty = false; setStartEnabled(false); setEndEnabled(true); setCancelEnabled(true); @@ -204,11 +212,19 @@ public slots: } void stopWizard() { + m_dirty = m_helper->calibrationSuccessful(); setStartEnabled(true); setEndEnabled(false); setCancelEnabled(false); wizardStopped(); } + void save() + { + if (m_dirty) { + m_dirty = false; + m_helper->copyResultToSettings(); + } + } }; } diff --git a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp index 22a37254a..a554a00a0 100644 --- a/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configrevowidget.cpp @@ -329,6 +329,9 @@ void ConfigRevoWidget::updateObjectsFromWidgets() if (m_gyroBiasCalibrationModel->dirty()) { m_gyroBiasCalibrationModel->save(); } + if (m_thermalCalibrationModel->dirty()) { + m_thermalCalibrationModel->save(); + } } void ConfigRevoWidget::clearHomeLocation() @@ -363,7 +366,7 @@ void ConfigRevoWidget::enableAllCalibrations() { // TODO should use a signal instead if (m_accelCalibrationModel->dirty() || m_magCalibrationModel->dirty() || m_levelCalibrationModel->dirty() - || m_gyroBiasCalibrationModel->dirty()) { + || m_gyroBiasCalibrationModel->dirty() || m_thermalCalibrationModel->dirty()) { widgetsContentsChanged(); }