mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-03 11:24:10 +01:00
OP-1628 Added support for 'old' style auto update if board not connected.
This commit is contained in:
parent
ff1ad84302
commit
db22fb7aa7
@ -17,7 +17,7 @@ AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
|
|||||||
Q_ASSERT(uploader);
|
Q_ASSERT(uploader);
|
||||||
connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(disableButtons()));
|
connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(disableButtons()));
|
||||||
connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(autoUpdate()));
|
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()
|
AutoUpdatePage::~AutoUpdatePage()
|
||||||
|
@ -46,7 +46,7 @@ Core::IUAVGadget *UploaderGadgetFactory::createGadget(QWidget *parent)
|
|||||||
isautocapable = gadgetWidget->autoUpdateCapable();
|
isautocapable = gadgetWidget->autoUpdateCapable();
|
||||||
connect(this, SIGNAL(autoUpdate(bool)), gadgetWidget, SLOT(autoUpdate(bool)));
|
connect(this, SIGNAL(autoUpdate(bool)), gadgetWidget, SLOT(autoUpdate(bool)));
|
||||||
connect(this, SIGNAL(reboot()), gadgetWidget, SLOT(systemReset()));
|
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);
|
return new UploaderGadget(QString("Uploader"), gadgetWidget, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ private:
|
|||||||
bool isautocapable;
|
bool isautocapable;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void autoUpdateSignal(uploader::ProgressStep, QVariant);
|
void progressUpdate(uploader::ProgressStep, QVariant);
|
||||||
void autoUpdate(bool erase);
|
void autoUpdate(bool erase);
|
||||||
void reboot();
|
void reboot();
|
||||||
};
|
};
|
||||||
|
@ -618,17 +618,27 @@ bool UploaderGadgetWidget::autoUpdateCapable()
|
|||||||
|
|
||||||
bool UploaderGadgetWidget::autoUpdate(bool erase)
|
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(bootloaderSuccess()), &eventLoop, SLOT(success()));
|
||||||
connect(this, SIGNAL(bootloaderFailed()), &eventLoop, SLOT(fail()));
|
connect(this, SIGNAL(bootloaderFailed()), &eventLoop, SLOT(fail()));
|
||||||
|
|
||||||
goToBootloader();
|
goToBootloader();
|
||||||
|
|
||||||
if (eventLoop.run(AUTOUPDATE_TIMEOUT) != 0) {
|
if (eventLoop.run(AUTOUPDATE_TIMEOUT) != 0) {
|
||||||
emit progressUpdate(FAILURE, QVariant());
|
emit progressUpdate(FAILURE, QVariant());
|
||||||
emit autoUpdateFailed();
|
emit autoUpdateFailed();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dfu) {
|
if (dfu) {
|
||||||
|
Loading…
Reference in New Issue
Block a user