Changeset 4714f50 in subsurface


Ignore:
Timestamp:
Jan 12, 2017, 2:15:53 PM (5 months ago)
Author:
Subsurface <dirk@…>
Branches:
master
Children:
9ec2896
Parents:
a5232a3
git-author:
Anton Lundin <glance@…> (12/28/16 07:49:14)
git-committer:
Subsurface <dirk@…> (01/12/17 14:15:53)
Message:

Notify Ostc 4 users about new firmwares

This adds support for notifying Ostc 4 users about new firmwares when
they download dives from their computers, gives them the option to
trigger the upgrade flow.

Signed-off-by: Anton Lundin <glance@…>

Location:
desktop-widgets
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • desktop-widgets/configuredivecomputerdialog.cpp

    rb511eb1 r4714f50  
    234234                url = QUrl("http://www.heinrichsweikamp.net/autofirmware/ostc_sport_changelog.txt");
    235235                latestFirmwareHexFile = QString("http://www.heinrichsweikamp.net/autofirmware/ostc_sport_firmware.hex");
     236        } else if (product == "OSTC 4") {
     237                url = QUrl("http://www.heinrichsweikamp.net/autofirmware/ostc4_changelog.txt");
     238                latestFirmwareHexFile = QString("http://www.heinrichsweikamp.net/autofirmware/ostc4_firmware.bin");
    236239        } else { // not one of the known dive computers
    237240                return;
     
    261264        // libdivecomputer gives us the firmware on device as an integer
    262265        // for the OSTC that means highbyte.lowbyte is the version number
    263         // For OSTC 4's there is actually a another minor, x.y.Z, but its not
    264         // exposed via libdivecomputer, so we won't trigger this update flow
    265         // when the Z changes
     266        // For OSTC 4's its stored as XXXX XYYY YYZZ ZZZB, -> X.Y.Z beta?
     267
    266268        int firmwareOnDevice = devData.libdc_firmware;
    267         QString firmwareOnDeviceString = QString("%1.%2").arg(firmwareOnDevice / 256).arg(firmwareOnDevice % 256);
    268 
     269        QString firmwareOnDeviceString;
    269270        // Convert the latestFirmwareAvailable to a integear we can compare with
    270271        QStringList fwParts = latestFirmwareAvailable.split(".");
    271         int latestFirmwareAvailableNumber = fwParts[0].toInt() * 256 + fwParts[1].toInt();
     272        int latestFirmwareAvailableNumber;
     273
     274        if (strcmp(data->product, "OSTC 4") == 0) {
     275                unsigned char X, Y, Z, beta;
     276                X = (firmwareOnDevice & 0xF800) >> 11;
     277                Y = (firmwareOnDevice & 0x07C0) >> 6;
     278                Z = (firmwareOnDevice & 0x003E) >> 1;
     279                beta = firmwareOnDevice & 0x0001;
     280                firmwareOnDeviceString = QString("%1.%2.%3%4").arg(X).arg(Y).arg(Z).arg(beta?" beta":"");
     281                latestFirmwareAvailableNumber = (fwParts[0].toInt() << 11) + (fwParts[1].toInt() << 6) + (fwParts[2].toInt() << 1);
     282        } else { // OSTC 3, Sport, Cr
     283                firmwareOnDeviceString = QString("%1.%2").arg(firmwareOnDevice / 256).arg(firmwareOnDevice % 256);
     284                latestFirmwareAvailableNumber = fwParts[0].toInt() * 256 + fwParts[1].toInt();
     285        }
     286
    272287        if (latestFirmwareAvailableNumber > firmwareOnDevice) {
    273288                QMessageBox response(parent);
     
    298313        filename = fi.absolutePath().append(QDir::separator()).append(saveFileName);
    299314        storeFirmware = QFileDialog::getSaveFileName(parent, tr("Save the downloaded firmware as"),
    300                                                      filename, tr("HEX files (*.hex)"));
     315                                                     filename, tr("Firmware files (*.hex *.bin)"));
    301316        if (storeFirmware.isEmpty())
    302317                return;
  • desktop-widgets/downloadfromdivecomputer.cpp

    ra5232a3 r4714f50  
    372372        QString product(ui.product->currentText());
    373373        if (product == "OSTC 3" || product == "OSTC 3+" ||
    374                         product == "OSTC Cr" || product == "OSTC Sport")
     374                        product == "OSTC Cr" || product == "OSTC Sport" ||
     375                        product == "OSTC 4")
    375376                ostcFirmwareCheck = new OstcFirmwareCheck(product);
    376377}
Note: See TracChangeset for help on using the changeset viewer.