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

OP-1628 The autoupdater should wait for board to boot and connect before returning.

This commit is contained in:
m_thread 2014-12-16 14:18:43 +01:00
parent db22fb7aa7
commit 8d4adeae13
2 changed files with 33 additions and 6 deletions

View File

@ -67,7 +67,7 @@ void AutoUpdatePage::updateStatus(uploader::ProgressStep status, QVariant value)
case uploader::JUMP_TO_BL:
ui->levellinProgressBar->setValue(value.toInt());
ui->levellinProgressBar->setMaximum(5);
ui->statusLabel->setText(tr("Board going into bootloader mode."));
ui->statusLabel->setText(tr("Board going into bootloader mode. Please wait."));
break;
case uploader::LOADING_FW:
ui->statusLabel->setText(tr("Loading firmware."));
@ -81,7 +81,7 @@ void AutoUpdatePage::updateStatus(uploader::ProgressStep status, QVariant value)
ui->statusLabel->setText(tr("Uploading description."));
break;
case uploader::BOOTING:
ui->statusLabel->setText(tr("Booting the board."));
ui->statusLabel->setText(tr("Booting the board%. Please wait").arg(value.toString()));
break;
case uploader::SUCCESS:
enableButtons(true);

View File

@ -639,6 +639,9 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
emit autoUpdateFailed();
return false;
}
disconnect(this, SIGNAL(bootloaderSuccess()), &eventLoop, SLOT(success()));
disconnect(this, SIGNAL(bootloaderFailed()), &eventLoop, SLOT(fail()));
}
if (dfu) {
@ -646,7 +649,7 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
dfu = NULL;
}
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
Core::ConnectionManager *connectionManager = Core::ICore::instance()->connectionManager();
dfu = new DFUObject(DFU_DEBUG, false, QString());
dfu->AbortOperation();
emit progressUpdate(JUMP_TO_BL, QVariant());
@ -655,7 +658,7 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
(dfu->numberOfDevices != 1) || dfu->numberOfDevices > 5) {
delete dfu;
dfu = NULL;
cm->resumePolling();
connectionManager->resumePolling();
emit progressUpdate(FAILURE, QVariant());
emit autoUpdateFailed();
return false;
@ -725,7 +728,31 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
emit autoUpdateFailed();
return false;
}
commonSystemBoot(false, erase);
// Wait for board to connect to GCS again after boot and erase
// For older board like CC3D this can take some time
ExtensionSystem::PluginManager *pluginManager = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pluginManager);
TelemetryManager *telemetryManager = pluginManager->getObject<TelemetryManager>();
Q_ASSERT(telemetryManager);
if(!telemetryManager->isConnected()) {
progressUpdate(BOOTING, erase ? tr(" and erasing settings") : QVariant());
ResultEventLoop eventLoop;
connect(telemetryManager, SIGNAL(connected()), &eventLoop, SLOT(success()));
if (eventLoop.run(AUTOUPDATE_TIMEOUT) != 0) {
emit progressUpdate(FAILURE, QVariant());
emit autoUpdateFailed();
return false;
}
disconnect(telemetryManager, SIGNAL(connected()), &eventLoop, SLOT(success()));
}
emit progressUpdate(SUCCESS, QVariant());
emit autoUpdateSuccess();
return true;
@ -956,7 +983,7 @@ void UploaderGadgetWidget::autoUpdateStatus(uploader::ProgressStep status, QVari
m_config->autoUpdateProgressBar->setFormat(tr("Timing out in %1 seconds").arg(remaining));
break;
case uploader::JUMP_TO_BL:
m_config->autoUpdateLabel->setText(tr("Bringing the board into boot loader mode."));
m_config->autoUpdateLabel->setText(tr("Bringing the board into boot loader mode. Please wait."));
m_config->autoUpdateProgressBar->setFormat(tr("Step %1").arg(value.toInt()));
m_config->autoUpdateProgressBar->setMaximum(5);
m_config->autoUpdateProgressBar->setValue(value.toInt());
@ -974,7 +1001,7 @@ void UploaderGadgetWidget::autoUpdateStatus(uploader::ProgressStep status, QVari
m_config->autoUpdateLabel->setText(tr("Uploading description of the new firmware to the board."));
break;
case uploader::BOOTING:
m_config->autoUpdateLabel->setText(tr("Rebooting the board."));
m_config->autoUpdateLabel->setText(tr("Rebooting the board%1. Please wait.").arg(value.toString()));
break;
case uploader::SUCCESS:
m_config->autoUpdateProgressBar->setValue(m_config->autoUpdateProgressBar->maximum());