diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.cpp index 988312bef..c31cda0c6 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.cpp @@ -66,20 +66,28 @@ void FlashPage::writeToController() return; } - ui->saveButton->setEnabled(false); - getWizard()->button(QWizard::CancelButton)->setEnabled(false); - setCommitPage(true); + enableButtons(false); VehicleConfigurationHelper helper(getWizard()); connect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString))); + m_successfulWrite = helper.setupVehicle(); + disconnect(&helper, SIGNAL(saveProgress(int, int, QString)),this, SLOT(saveProgress(int, int, QString))); ui->saveProgressLabel->setText(QString("%2").arg(m_successfulWrite ? "green" : "red", ui->saveProgressLabel->text())); - ui->saveButton->setEnabled(true); - getWizard()->button(QWizard::CancelButton)->setEnabled(true); - setCommitPage(false); + enableButtons(true); + emit completeChanged(); } +void FlashPage::enableButtons(bool enable) +{ + ui->saveButton->setEnabled(enable); + getWizard()->button(QWizard::NextButton)->setEnabled(enable); + getWizard()->button(QWizard::CancelButton)->setEnabled(enable); + getWizard()->button(QWizard::BackButton)->setEnabled(enable); + QApplication::processEvents(); +} + void FlashPage::saveProgress(int total, int current, QString description) { if(ui->saveProgressBar->maximum() != total) { diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.h index 45e83ed61..6602926ea 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/flashpage.h @@ -44,9 +44,10 @@ public: bool validatePage(); bool isComplete() const; -private: +private: Ui::FlashPage *ui; bool m_successfulWrite; + void enableButtons(bool enable); private slots: void writeToController(); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp index 1384865a6..6d7340f4e 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/levellingpage.cpp @@ -85,7 +85,6 @@ void LevellingPage::performLevelling() { m_levellingUtil = new LevellingUtil(BIAS_CYCLES, BIAS_RATE); } - emit completeChanged(); connect(m_levellingUtil, SIGNAL(progress(long,long)), this, SLOT(levellingProgress(long,long))); connect(m_levellingUtil, SIGNAL(done(accelGyroBias)), this, SLOT(levellingDone(accelGyroBias))); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index a74c026f2..a7b24ec50 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -53,7 +53,7 @@ SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfiguratio setWindowTitle(tr("OpenPilot Setup Wizard")); setOption(QWizard::IndependentPages, false); setFixedSize(640, 530); - for(int i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++) + for(quint16 i = 0; i < ActuatorSettings::CHANNELMAX_NUMELEM; i++) { m_actuatorSettings << actuatorChannelSettings(); }