mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Merge branch 'add_ostc4_force_firmware_update' of https://github.com/mikeller/subsurface
together with the libdc change this should now work Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
commit
ad8aa988f0
7 changed files with 47 additions and 33 deletions
|
@ -1,4 +1,5 @@
|
||||||
core: fix bug when save sea water salinity given by DC
|
core: fix bug when save sea water salinity given by DC
|
||||||
|
desktop: add option to force firmware update on OSTC4
|
||||||
desktop: add column for dive notes to the dive list table
|
desktop: add column for dive notes to the dive list table
|
||||||
desktop: Add an option for printing in landscape mode
|
desktop: Add an option for printing in landscape mode
|
||||||
desktop: fix bug when printing a dive plan with multiple segments
|
desktop: fix bug when printing a dive plan with multiple segments
|
||||||
|
|
|
@ -491,13 +491,13 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data)
|
void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data, bool forceUpdate)
|
||||||
{
|
{
|
||||||
setState(FWUPDATE);
|
setState(FWUPDATE);
|
||||||
if (firmwareThread)
|
if (firmwareThread)
|
||||||
firmwareThread->deleteLater();
|
firmwareThread->deleteLater();
|
||||||
|
|
||||||
firmwareThread = new FirmwareUpdateThread(this, data, fileName);
|
firmwareThread = new FirmwareUpdateThread(this, data, fileName, forceUpdate);
|
||||||
connectThreadSignals(firmwareThread);
|
connectThreadSignals(firmwareThread);
|
||||||
|
|
||||||
firmwareThread->start();
|
firmwareThread->start();
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
void fetchDeviceDetails();
|
void fetchDeviceDetails();
|
||||||
bool saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data);
|
bool saveXMLBackup(QString fileName, DeviceDetails *details, device_data_t *data);
|
||||||
bool restoreXMLBackup(QString fileName, DeviceDetails *details);
|
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);
|
void resetSettings(device_data_t *data);
|
||||||
|
|
||||||
QString dc_open(device_data_t *data);
|
QString dc_open(device_data_t *data);
|
||||||
|
|
|
@ -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)) {
|
switch (dc_device_get_type(m_data->device)) {
|
||||||
case DC_FAMILY_HW_OSTC3:
|
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;
|
break;
|
||||||
case DC_FAMILY_HW_OSTC:
|
case DC_FAMILY_HW_OSTC:
|
||||||
rc = hw_ostc_device_fwupdate(m_data->device, qPrintable(m_fileName));
|
rc = hw_ostc_device_fwupdate(m_data->device, qPrintable(m_fileName));
|
||||||
|
|
|
@ -44,11 +44,12 @@ private:
|
||||||
class FirmwareUpdateThread : public DeviceThread {
|
class FirmwareUpdateThread : public DeviceThread {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName);
|
FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName, bool forceUpdate);
|
||||||
void run();
|
void run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
|
bool m_forceUpdate;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ResetSettingsThread : public DeviceThread {
|
class ResetSettingsThread : public DeviceThread {
|
||||||
|
|
|
@ -346,7 +346,7 @@ void OstcFirmwareCheck::saveOstcFirmware(QNetworkReply *reply)
|
||||||
connect(config, &ConfigureDiveComputer::error, dialog, &QProgressDialog::setLabelText);
|
connect(config, &ConfigureDiveComputer::error, dialog, &QProgressDialog::setLabelText);
|
||||||
connect(config, &ConfigureDiveComputer::progress, dialog, &QProgressDialog::setValue);
|
connect(config, &ConfigureDiveComputer::progress, dialog, &QProgressDialog::setValue);
|
||||||
config->dc_open(&devData);
|
config->dc_open(&devData);
|
||||||
config->startFirmwareUpdate(storeFirmware, &devData);
|
config->startFirmwareUpdate(storeFirmware, &devData, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog()
|
ConfigureDiveComputerDialog::~ConfigureDiveComputerDialog()
|
||||||
|
@ -869,6 +869,7 @@ void ConfigureDiveComputerDialog::readSettings()
|
||||||
ui.progressBar->setTextVisible(true);
|
ui.progressBar->setTextVisible(true);
|
||||||
// Fw update is no longer a option, needs to be done on a untouched device
|
// Fw update is no longer a option, needs to be done on a untouched device
|
||||||
ui.updateFirmwareButton->setEnabled(false);
|
ui.updateFirmwareButton->setEnabled(false);
|
||||||
|
ui.forceUpdateFirmware->setEnabled(false);
|
||||||
|
|
||||||
config->readSettings(&device_data);
|
config->readSettings(&device_data);
|
||||||
}
|
}
|
||||||
|
@ -1387,6 +1388,7 @@ void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
|
||||||
if (!restorePath.isEmpty()) {
|
if (!restorePath.isEmpty()) {
|
||||||
// Fw update is no longer a option, needs to be done on a untouched device
|
// Fw update is no longer a option, needs to be done on a untouched device
|
||||||
ui.updateFirmwareButton->setEnabled(false);
|
ui.updateFirmwareButton->setEnabled(false);
|
||||||
|
ui.forceUpdateFirmware->setEnabled(false);
|
||||||
if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
|
if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
|
||||||
QMessageBox::critical(this, tr("XML restore error"),
|
QMessageBox::critical(this, tr("XML restore error"),
|
||||||
tr("An error occurred while restoring the backup file.\n%1")
|
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->setFormat("%p%");
|
||||||
ui.progressBar->setTextVisible(true);
|
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.retrieveDetails->setEnabled(true);
|
||||||
ui.resetButton->setEnabled(true);
|
ui.resetButton->setEnabled(true);
|
||||||
ui.resetButton_4->setEnabled(true);
|
ui.resetButton_4->setEnabled(true);
|
||||||
ui.updateFirmwareButton->setEnabled(true);
|
|
||||||
ui.disconnectButton->setEnabled(true);
|
ui.disconnectButton->setEnabled(true);
|
||||||
ui.restoreBackupButton->setEnabled(true);
|
ui.restoreBackupButton->setEnabled(true);
|
||||||
ui.connectButton->setEnabled(false);
|
ui.connectButton->setEnabled(false);
|
||||||
|
@ -1511,6 +1512,7 @@ void ConfigureDiveComputerDialog::dc_open()
|
||||||
ui.DiveComputerList->setEnabled(false);
|
ui.DiveComputerList->setEnabled(false);
|
||||||
ui.logToFile->setEnabled(false);
|
ui.logToFile->setEnabled(false);
|
||||||
ui.updateFirmwareButton->setEnabled(fw_upgrade_possible);
|
ui.updateFirmwareButton->setEnabled(fw_upgrade_possible);
|
||||||
|
ui.forceUpdateFirmware->setEnabled(selected_product == "OSTC 4");
|
||||||
ui.progressBar->setFormat(tr("Connected to device"));
|
ui.progressBar->setFormat(tr("Connected to device"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1521,7 +1523,6 @@ void ConfigureDiveComputerDialog::dc_close()
|
||||||
ui.retrieveDetails->setEnabled(false);
|
ui.retrieveDetails->setEnabled(false);
|
||||||
ui.resetButton->setEnabled(false);
|
ui.resetButton->setEnabled(false);
|
||||||
ui.resetButton_4->setEnabled(false);
|
ui.resetButton_4->setEnabled(false);
|
||||||
ui.updateFirmwareButton->setEnabled(false);
|
|
||||||
ui.disconnectButton->setEnabled(false);
|
ui.disconnectButton->setEnabled(false);
|
||||||
ui.connectButton->setEnabled(true);
|
ui.connectButton->setEnabled(true);
|
||||||
ui.bluetoothMode->setEnabled(true);
|
ui.bluetoothMode->setEnabled(true);
|
||||||
|
@ -1531,6 +1532,7 @@ void ConfigureDiveComputerDialog::dc_close()
|
||||||
ui.DiveComputerList->setEnabled(true);
|
ui.DiveComputerList->setEnabled(true);
|
||||||
ui.logToFile->setEnabled(true);
|
ui.logToFile->setEnabled(true);
|
||||||
ui.updateFirmwareButton->setEnabled(false);
|
ui.updateFirmwareButton->setEnabled(false);
|
||||||
|
ui.forceUpdateFirmware->setEnabled(false);
|
||||||
ui.progressBar->setFormat(tr("Disconnected from device"));
|
ui.progressBar->setFormat(tr("Disconnected from device"));
|
||||||
ui.progressBar->setValue(0);
|
ui.progressBar->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,29 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="updateFirmwareButton">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Update firmware</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="retrieveDetails">
|
<widget class="QPushButton" name="retrieveDetails">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -94,19 +117,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="backupButton">
|
<widget class="QPushButton" name="backupButton">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -130,20 +140,20 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="updateFirmwareButton">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Update firmware</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="forceUpdateFirmware">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Force reinstall firmware</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
Loading…
Reference in a new issue