1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-1628 Added support for 'old' style auto update if board not connected.

This commit is contained in:
m_thread 2014-12-09 01:15:49 +01:00
parent ff1ad84302
commit db22fb7aa7
4 changed files with 21 additions and 11 deletions

View File

@ -17,7 +17,7 @@ AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
Q_ASSERT(uploader);
connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(disableButtons()));
connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(autoUpdate()));
connect(uploader, SIGNAL(autoUpdateSignal(uploader::ProgressStep, QVariant)), this, SLOT(updateStatus(uploader::ProgressStep, QVariant)));
connect(uploader, SIGNAL(progressUpdate(uploader::ProgressStep, QVariant)), this, SLOT(updateStatus(uploader::ProgressStep, QVariant)));
}
AutoUpdatePage::~AutoUpdatePage()

View File

@ -46,7 +46,7 @@ Core::IUAVGadget *UploaderGadgetFactory::createGadget(QWidget *parent)
isautocapable = gadgetWidget->autoUpdateCapable();
connect(this, SIGNAL(autoUpdate(bool)), gadgetWidget, SLOT(autoUpdate(bool)));
connect(this, SIGNAL(reboot()), gadgetWidget, SLOT(systemReset()));
connect(gadgetWidget, SIGNAL(autoUpdateSignal(uploader::ProgressStep, QVariant)), this, SIGNAL(autoUpdateSignal(uploader::ProgressStep, QVariant)));
connect(gadgetWidget, SIGNAL(progressUpdate(uploader::ProgressStep,QVariant)), this, SIGNAL(progressUpdate(uploader::ProgressStep, QVariant)));
return new UploaderGadget(QString("Uploader"), gadgetWidget, parent);
}

View File

@ -51,7 +51,7 @@ private:
bool isautocapable;
signals:
void autoUpdateSignal(uploader::ProgressStep, QVariant);
void progressUpdate(uploader::ProgressStep, QVariant);
void autoUpdate(bool erase);
void reboot();
};

View File

@ -618,17 +618,27 @@ bool UploaderGadgetWidget::autoUpdateCapable()
bool UploaderGadgetWidget::autoUpdate(bool erase)
{
ResultEventLoop eventLoop;
if (USBMonitor::instance()->availableDevices(0x20a0, -1, -1, -1).length() == 0) {
ConnectionWaiter waiter(1, BOARD_EVENT_TIMEOUT);
connect(&waiter, SIGNAL(timeChanged(int)), this, SLOT(autoUpdateConnectProgress(int)));
if (waiter.exec() == ConnectionWaiter::TimedOut) {
emit progressUpdate(FAILURE, QVariant(tr("Timed out while waiting for a board to be connected!")));
emit autoUpdateFailed();
return false;
}
} else {
ResultEventLoop eventLoop;
connect(this, SIGNAL(bootloaderSuccess()), &eventLoop, SLOT(success()));
connect(this, SIGNAL(bootloaderFailed()), &eventLoop, SLOT(fail()));
connect(this, SIGNAL(bootloaderSuccess()), &eventLoop, SLOT(success()));
connect(this, SIGNAL(bootloaderFailed()), &eventLoop, SLOT(fail()));
goToBootloader();
goToBootloader();
if (eventLoop.run(AUTOUPDATE_TIMEOUT) != 0) {
emit progressUpdate(FAILURE, QVariant());
emit autoUpdateFailed();
return false;
if (eventLoop.run(AUTOUPDATE_TIMEOUT) != 0) {
emit progressUpdate(FAILURE, QVariant());
emit autoUpdateFailed();
return false;
}
}
if (dfu) {