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:
parent
db22fb7aa7
commit
8d4adeae13
@ -67,7 +67,7 @@ void AutoUpdatePage::updateStatus(uploader::ProgressStep status, QVariant value)
|
|||||||
case uploader::JUMP_TO_BL:
|
case uploader::JUMP_TO_BL:
|
||||||
ui->levellinProgressBar->setValue(value.toInt());
|
ui->levellinProgressBar->setValue(value.toInt());
|
||||||
ui->levellinProgressBar->setMaximum(5);
|
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;
|
break;
|
||||||
case uploader::LOADING_FW:
|
case uploader::LOADING_FW:
|
||||||
ui->statusLabel->setText(tr("Loading firmware."));
|
ui->statusLabel->setText(tr("Loading firmware."));
|
||||||
@ -81,7 +81,7 @@ void AutoUpdatePage::updateStatus(uploader::ProgressStep status, QVariant value)
|
|||||||
ui->statusLabel->setText(tr("Uploading description."));
|
ui->statusLabel->setText(tr("Uploading description."));
|
||||||
break;
|
break;
|
||||||
case uploader::BOOTING:
|
case uploader::BOOTING:
|
||||||
ui->statusLabel->setText(tr("Booting the board."));
|
ui->statusLabel->setText(tr("Booting the board%. Please wait").arg(value.toString()));
|
||||||
break;
|
break;
|
||||||
case uploader::SUCCESS:
|
case uploader::SUCCESS:
|
||||||
enableButtons(true);
|
enableButtons(true);
|
||||||
|
@ -639,6 +639,9 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
|
|||||||
emit autoUpdateFailed();
|
emit autoUpdateFailed();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
disconnect(this, SIGNAL(bootloaderSuccess()), &eventLoop, SLOT(success()));
|
||||||
|
disconnect(this, SIGNAL(bootloaderFailed()), &eventLoop, SLOT(fail()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dfu) {
|
if (dfu) {
|
||||||
@ -646,7 +649,7 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
|
|||||||
dfu = NULL;
|
dfu = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
|
Core::ConnectionManager *connectionManager = Core::ICore::instance()->connectionManager();
|
||||||
dfu = new DFUObject(DFU_DEBUG, false, QString());
|
dfu = new DFUObject(DFU_DEBUG, false, QString());
|
||||||
dfu->AbortOperation();
|
dfu->AbortOperation();
|
||||||
emit progressUpdate(JUMP_TO_BL, QVariant());
|
emit progressUpdate(JUMP_TO_BL, QVariant());
|
||||||
@ -655,7 +658,7 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
|
|||||||
(dfu->numberOfDevices != 1) || dfu->numberOfDevices > 5) {
|
(dfu->numberOfDevices != 1) || dfu->numberOfDevices > 5) {
|
||||||
delete dfu;
|
delete dfu;
|
||||||
dfu = NULL;
|
dfu = NULL;
|
||||||
cm->resumePolling();
|
connectionManager->resumePolling();
|
||||||
emit progressUpdate(FAILURE, QVariant());
|
emit progressUpdate(FAILURE, QVariant());
|
||||||
emit autoUpdateFailed();
|
emit autoUpdateFailed();
|
||||||
return false;
|
return false;
|
||||||
@ -725,7 +728,31 @@ bool UploaderGadgetWidget::autoUpdate(bool erase)
|
|||||||
emit autoUpdateFailed();
|
emit autoUpdateFailed();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
commonSystemBoot(false, erase);
|
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 progressUpdate(SUCCESS, QVariant());
|
||||||
emit autoUpdateSuccess();
|
emit autoUpdateSuccess();
|
||||||
return true;
|
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));
|
m_config->autoUpdateProgressBar->setFormat(tr("Timing out in %1 seconds").arg(remaining));
|
||||||
break;
|
break;
|
||||||
case uploader::JUMP_TO_BL:
|
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->setFormat(tr("Step %1").arg(value.toInt()));
|
||||||
m_config->autoUpdateProgressBar->setMaximum(5);
|
m_config->autoUpdateProgressBar->setMaximum(5);
|
||||||
m_config->autoUpdateProgressBar->setValue(value.toInt());
|
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."));
|
m_config->autoUpdateLabel->setText(tr("Uploading description of the new firmware to the board."));
|
||||||
break;
|
break;
|
||||||
case uploader::BOOTING:
|
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;
|
break;
|
||||||
case uploader::SUCCESS:
|
case uploader::SUCCESS:
|
||||||
m_config->autoUpdateProgressBar->setValue(m_config->autoUpdateProgressBar->maximum());
|
m_config->autoUpdateProgressBar->setValue(m_config->autoUpdateProgressBar->maximum());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user