1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

OP-1150: Try to fix some cases where Start in not enabled postponing m_thermalCalibrationModel->init()

This commit is contained in:
Alessio Morale 2014-02-06 01:40:22 +01:00
parent 128daa9f03
commit 19d1618996
3 changed files with 16 additions and 10 deletions

View File

@ -34,7 +34,8 @@
namespace OpenPilot {
ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) :
WizardModel(parent)
WizardModel(parent),
m_initDone(false)
{
m_helper.reset(new ThermalCalibrationHelper());
m_readyState = new WizardState(tr("Start"), this),
@ -68,13 +69,16 @@ ThermalCalibrationModel::ThermalCalibrationModel(QObject *parent) :
}
void ThermalCalibrationModel::init()
{
setStartEnabled(true);
setEndEnabled(false);
setCancelEnabled(false);
start();
setTemperature(0);
setTemperatureGradient(0);
emit instructionsChanged(instructions());
if(!m_initDone){
m_initDone = true;
setStartEnabled(true);
setEndEnabled(false);
setCancelEnabled(false);
start();
setTemperature(0);
setTemperatureGradient(0);
emit instructionsChanged(instructions());
}
}
void ThermalCalibrationModel::stepChanged(WizardState *state)

View File

@ -139,6 +139,7 @@ private:
bool m_startEnabled;
bool m_cancelEnabled;
bool m_endEnabled;
bool m_initDone;
int m_progress;
QString m_temperature;
QString m_temperatureGradient;

View File

@ -236,8 +236,7 @@ ConfigRevoWidget::ConfigRevoWidget(QWidget *parent) :
connect(m_thermalCalibrationModel, SIGNAL(temperatureChanged(QString)), m_ui->textTemperature, SLOT(setText(QString)));
connect(m_thermalCalibrationModel, SIGNAL(temperatureGradientChanged(QString)), m_ui->textThermalGradient, SLOT(setText(QString)));
connect(m_thermalCalibrationModel, SIGNAL(progressChanged(int)), m_ui->thermalBiasProgress, SLOT(setValue(int)));
m_thermalCalibrationModel->init();
//note: init for m_thermalCalibrationModel is done in showEvent to prevent cases wiht "Start" button not enabled due to some itming issue.
// Connect the signals
connect(m_ui->accelBiasStart, SIGNAL(clicked()), this, SLOT(doStartAccelGyroBiasCalibration()));
@ -273,6 +272,8 @@ void ConfigRevoWidget::showEvent(QShowEvent *event)
// the result is usually a sensorsBargraph that is way too small.
m_ui->sensorsBargraph->fitInView(sensorsBargraph, Qt::KeepAspectRatio);
m_ui->sixPointsHelp->fitInView(paperplane, Qt::KeepAspectRatio);
m_thermalCalibrationModel->init();
}
void ConfigRevoWidget::resizeEvent(QResizeEvent *event)