mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-20 06:45:27 +00:00
Only suggest OSTC3 fw upgrade on newer version
Previous code suggested a "upgrade" if your firmware where other than whats parsed from the autofirmware call. This switches that logic into only suggesting firmware upgrade if the found firmware is newer than the firmware your device runs. The previous logic was very annoying if you have a device running a development version of the firmware. If you have taken that step of the guided path, you shouldn't be told to "upgrade" to something older every time you download from your computer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4f8536c253
commit
8a5f2ef52f
1 changed files with 11 additions and 4 deletions
|
@ -227,15 +227,22 @@ void OstcFirmwareCheck::checkLatest(QWidget *_parent, device_data_t *data)
|
|||
{
|
||||
devData = *data;
|
||||
parent = _parent;
|
||||
// If we didn't find a current firmware version stop this hole thing here.
|
||||
if (latestFirmwareAvailable.isEmpty())
|
||||
return;
|
||||
|
||||
// for now libdivecomputer gives us the firmware on device undecoded as integer
|
||||
// for the OSTC that means highbyte.lowbyte is the version number
|
||||
int firmwareOnDevice = devData.libdc_firmware;
|
||||
QString firmware;
|
||||
firmware = QString("%1.%2").arg(firmwareOnDevice / 256).arg(firmwareOnDevice % 256);
|
||||
if (!latestFirmwareAvailable.isEmpty() && latestFirmwareAvailable != firmware) {
|
||||
QString firmwareOnDeviceString = QString("%1.%2").arg(firmwareOnDevice / 256).arg(firmwareOnDevice % 256);
|
||||
|
||||
// Convert the latestFirmwareAvailable to a integear we can compare with
|
||||
QStringList fwParts = latestFirmwareAvailable.split(".");
|
||||
int latestFirmwareAvailableNumber = fwParts[0].toInt() * 256 + fwParts[1].toInt();
|
||||
if (latestFirmwareAvailableNumber > firmwareOnDevice) {
|
||||
QMessageBox response(parent);
|
||||
QString message = tr("You should update the firmware on your dive computer: you have version %1 but the latest stable version is %2")
|
||||
.arg(firmware)
|
||||
.arg(firmwareOnDeviceString)
|
||||
.arg(latestFirmwareAvailable);
|
||||
if (strcmp(data->product, "OSTC Sport") == 0)
|
||||
message += tr("\n\nPlease start Bluetooth on your OSTC Sport and do the same preparations as for a logbook download before continuing with the update");
|
||||
|
|
Loading…
Add table
Reference in a new issue