mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Finish off the firmware update code.
This code connects the final parts of the generic firmware update code. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
c11e2fbb6f
commit
adf03c7845
2 changed files with 24 additions and 1 deletions
|
@ -13,7 +13,8 @@ ConfigureDiveComputer::ConfigureDiveComputer(QObject *parent) :
|
|||
QObject(parent),
|
||||
readThread(0),
|
||||
writeThread(0),
|
||||
resetThread(0)
|
||||
resetThread(0),
|
||||
firmwareThread(0)
|
||||
{
|
||||
setState(INITIAL);
|
||||
}
|
||||
|
@ -512,7 +513,17 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
|
|||
|
||||
void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data)
|
||||
{
|
||||
setState(FWUPDATE);
|
||||
|
||||
if (firmwareThread)
|
||||
firmwareThread->deleteLater();
|
||||
|
||||
firmwareThread = new FirmwareUpdateThread(this, data, fileName);
|
||||
connect(firmwareThread, SIGNAL(finished()),
|
||||
this, SLOT(firmwareThreadFinished()), Qt::QueuedConnection);
|
||||
connect(firmwareThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
||||
|
||||
firmwareThread->start();
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::resetSettings(device_data_t *data)
|
||||
|
@ -557,6 +568,15 @@ void ConfigureDiveComputer::writeThreadFinished()
|
|||
}
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::firmwareThreadFinished()
|
||||
{
|
||||
setState(DONE);
|
||||
if (resetThread->lastError.isEmpty()) {
|
||||
//No error
|
||||
emit message(tr("Device firmware successfully updated"));
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigureDiveComputer::resetThreadFinished()
|
||||
{
|
||||
setState(DONE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue