diff --git a/CHANGELOG.md b/CHANGELOG.md index d3d137fd8..27c14a783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +desktop: add option to force firmware update on OSTC4 desktop: add column for dive notes to the dive list table desktop: fix bug when printing a dive plan with multiple segments desktop: fix bug in bailout gas selection for CCR dives diff --git a/core/configuredivecomputer.cpp b/core/configuredivecomputer.cpp index ad82fe1b8..d3a398933 100644 --- a/core/configuredivecomputer.cpp +++ b/core/configuredivecomputer.cpp @@ -491,13 +491,13 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de return true; } -void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data) +void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data, bool forceUpdate) { setState(FWUPDATE); if (firmwareThread) firmwareThread->deleteLater(); - firmwareThread = new FirmwareUpdateThread(this, data, fileName); + firmwareThread = new FirmwareUpdateThread(this, data, fileName, forceUpdate); connectThreadSignals(firmwareThread); firmwareThread->start(); diff --git a/core/configuredivecomputer.h b/core/configuredivecomputer.h index 1bdc03549..04a18be4b 100644 --- a/core/configuredivecomputer.h +++ b/core/configuredivecomputer.h @@ -36,7 +36,7 @@ public: void fetchDeviceDetails(); bool saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data); bool restoreXMLBackup(QString fileName, DeviceDetails *details); - void startFirmwareUpdate(QString fileName, device_data_t *data); + void startFirmwareUpdate(QString fileName, device_data_t *data, bool forceUpdate); void resetSettings(device_data_t *data); QString dc_open(device_data_t *data); diff --git a/core/configuredivecomputerthreads.cpp b/core/configuredivecomputerthreads.cpp index c22494526..72ef227e4 100644 --- a/core/configuredivecomputerthreads.cpp +++ b/core/configuredivecomputerthreads.cpp @@ -2203,7 +2203,7 @@ void WriteSettingsThread::run() } -FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName) : DeviceThread(parent, data), m_fileName(fileName) +FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName, bool forceUpdate) : DeviceThread(parent, data), m_fileName(fileName), m_forceUpdate(forceUpdate) { } @@ -2218,7 +2218,7 @@ void FirmwareUpdateThread::run() } switch (dc_device_get_type(m_data->device)) { case DC_FAMILY_HW_OSTC3: - rc = hw_ostc3_device_fwupdate(m_data->device, qPrintable(m_fileName)); + rc = hw_ostc3_device_fwupdate(m_data->device, qPrintable(m_fileName), m_forceUpdate); break; case DC_FAMILY_HW_OSTC: rc = hw_ostc_device_fwupdate(m_data->device, qPrintable(m_fileName)); diff --git a/core/configuredivecomputerthreads.h b/core/configuredivecomputerthreads.h index 50ad8c0ce..c6dcefe23 100644 --- a/core/configuredivecomputerthreads.h +++ b/core/configuredivecomputerthreads.h @@ -44,11 +44,12 @@ private: class FirmwareUpdateThread : public DeviceThread { Q_OBJECT public: - FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName); + FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName, bool forceUpdate); void run(); private: QString m_fileName; + bool m_forceUpdate; }; class ResetSettingsThread : public DeviceThread { diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp index 80c04cf92..8ae6b0a40 100644 --- a/desktop-widgets/configuredivecomputerdialog.cpp +++ b/desktop-widgets/configuredivecomputerdialog.cpp @@ -346,7 +346,7 @@ void OstcFirmwareCheck::saveOstcFirmware(QNetworkReply *reply) connect(config, &ConfigureDiveComputer::error, dialog, &QProgressDialog::setLabelText); connect(config, &ConfigureDiveComputer::progress, dialog, &QProgressDialog::setValue); config->dc_open(&devData); - config->startFirmwareUpdate(storeFirmware, &devData); + config->startFirmwareUpdate(storeFirmware, &devData, false); } ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog() @@ -869,6 +869,7 @@ void ConfigureDiveComputerDialog::readSettings() ui.progressBar->setTextVisible(true); // Fw update is no longer a option, needs to be done on a untouched device ui.updateFirmwareButton->setEnabled(false); + ui.forceUpdateFirmware->setEnabled(false); config->readSettings(&device_data); } @@ -1387,6 +1388,7 @@ void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked() if (!restorePath.isEmpty()) { // Fw update is no longer a option, needs to be done on a untouched device ui.updateFirmwareButton->setEnabled(false); + ui.forceUpdateFirmware->setEnabled(false); if (!config->restoreXMLBackup(restorePath, deviceDetails)) { QMessageBox::critical(this, tr("XML restore error"), tr("An error occurred while restoring the backup file.\n%1") @@ -1411,7 +1413,7 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked() ui.progressBar->setFormat("%p%"); ui.progressBar->setTextVisible(true); - config->startFirmwareUpdate(firmwarePath, &device_data); + config->startFirmwareUpdate(firmwarePath, &device_data, ui.forceUpdateFirmware->isChecked()); } } @@ -1503,7 +1505,6 @@ void ConfigureDiveComputerDialog::dc_open() ui.retrieveDetails->setEnabled(true); ui.resetButton->setEnabled(true); ui.resetButton_4->setEnabled(true); - ui.updateFirmwareButton->setEnabled(true); ui.disconnectButton->setEnabled(true); ui.restoreBackupButton->setEnabled(true); ui.connectButton->setEnabled(false); @@ -1511,6 +1512,7 @@ void ConfigureDiveComputerDialog::dc_open() ui.DiveComputerList->setEnabled(false); ui.logToFile->setEnabled(false); ui.updateFirmwareButton->setEnabled(fw_upgrade_possible); + ui.forceUpdateFirmware->setEnabled(selected_product == "OSTC 4"); ui.progressBar->setFormat(tr("Connected to device")); } @@ -1521,7 +1523,6 @@ void ConfigureDiveComputerDialog::dc_close() ui.retrieveDetails->setEnabled(false); ui.resetButton->setEnabled(false); ui.resetButton_4->setEnabled(false); - ui.updateFirmwareButton->setEnabled(false); ui.disconnectButton->setEnabled(false); ui.connectButton->setEnabled(true); ui.bluetoothMode->setEnabled(true); @@ -1531,6 +1532,7 @@ void ConfigureDiveComputerDialog::dc_close() ui.DiveComputerList->setEnabled(true); ui.logToFile->setEnabled(true); ui.updateFirmwareButton->setEnabled(false); + ui.forceUpdateFirmware->setEnabled(false); ui.progressBar->setFormat(tr("Disconnected from device")); ui.progressBar->setValue(0); } diff --git a/desktop-widgets/configuredivecomputerdialog.ui b/desktop-widgets/configuredivecomputerdialog.ui index 0725d5c85..51e7db89d 100644 --- a/desktop-widgets/configuredivecomputerdialog.ui +++ b/desktop-widgets/configuredivecomputerdialog.ui @@ -71,6 +71,29 @@ + + + + false + + + Update firmware + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + @@ -94,19 +117,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -130,20 +140,20 @@ - - - - false - - - Update firmware - - - + + + + false + + + Force reinstall firmware + + +