Cleaner device reattachment after firmware update
This commit is contained in:
parent
394facf2ed
commit
707975b037
@ -90,18 +90,28 @@ void FirmwareUpdateDialog::abortWithError(QString error)
|
|||||||
|
|
||||||
void FirmwareUpdateDialog::timerCallback()
|
void FirmwareUpdateDialog::timerCallback()
|
||||||
{
|
{
|
||||||
if(state != State::WaitingForReboot) {
|
switch(state) {
|
||||||
abortWithError("Response timed out");
|
case State::WaitingForReboot: {
|
||||||
} else {
|
|
||||||
// Currently waiting for the reboot, check device list
|
// Currently waiting for the reboot, check device list
|
||||||
auto devices = Device::GetDevices();
|
auto devices = Device::GetDevices();
|
||||||
if(devices.find(serialnumber) != devices.end()) {
|
if(devices.find(serialnumber) != devices.end()) {
|
||||||
// the device rebooted and is available again
|
// the device rebooted and is available again
|
||||||
addStatus("...device enumerated, update complete");
|
addStatus("...device enumerated, update complete");
|
||||||
timer.stop();
|
state = State::WaitBeforeInitializing;
|
||||||
emit DeviceRebooted(serialnumber);
|
timer.start(3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
case State::WaitBeforeInitializing:
|
||||||
|
// Device had enough time to initialize, indicate that rebooted device is ready
|
||||||
|
timer.stop();
|
||||||
|
emit DeviceRebooted(serialnumber);
|
||||||
|
delete this;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
abortWithError("Response timed out");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwareUpdateDialog::receivedAck()
|
void FirmwareUpdateDialog::receivedAck()
|
||||||
|
@ -51,6 +51,7 @@ private:
|
|||||||
TransferringData,
|
TransferringData,
|
||||||
TriggeringUpdate,
|
TriggeringUpdate,
|
||||||
WaitingForReboot,
|
WaitingForReboot,
|
||||||
|
WaitBeforeInitializing,
|
||||||
};
|
};
|
||||||
State state;
|
State state;
|
||||||
unsigned int transferredBytes;
|
unsigned int transferredBytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user