From 045a6fb6b16ae402588484fb8361f15f8978bdd3 Mon Sep 17 00:00:00 2001 From: "Joseph W. Joshua" Date: Fri, 20 Jun 2014 07:51:32 +0300 Subject: Start working on GAS and DIL tables Start work for gas1-5 and dil1-5. Signed-off-by: Joseph W. Joshua Signed-off-by: Thiago Macieira --- qt-ui/configuredivecomputer.cpp | 4 + qt-ui/configuredivecomputerdialog.cpp | 10 +- qt-ui/configuredivecomputerdialog.ui | 474 ++++++++++++++++++++++----------- qt-ui/configuredivecomputerthreads.cpp | 25 ++ 4 files changed, 354 insertions(+), 159 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/configuredivecomputer.cpp b/qt-ui/configuredivecomputer.cpp index a91a48d25..01df1c744 100644 --- a/qt-ui/configuredivecomputer.cpp +++ b/qt-ui/configuredivecomputer.cpp @@ -63,6 +63,7 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai xml += addSettingToXML("CustomText", details->customText()); xml += addSettingToXML("DiveMode", details->diveMode()); xml += addSettingToXML("Saturation", details->saturation()); + xml += addSettingToXML("Desaturation", details->desaturation()); xml += addSettingToXML("LastDeco", details->lastDeco()); xml += addSettingToXML("Brightness", details->brightness()); xml += addSettingToXML("Units", details->units()); @@ -131,6 +132,9 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de if (settingName == "Saturation") details->setSaturation(keyString.toInt()); + if (settingName == "Desaturation") + details->setDesaturation(keyString.toInt()); + if (settingName == "DiveMode") details->setDiveMode(keyString.toInt()); diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index 769f2cdc8..ece02a3d0 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -118,6 +118,7 @@ void ConfigureDiveComputerDialog::populateDeviceDetails() deviceDetails->setCustomText(ui->customTextLlineEdit->text()); deviceDetails->setDiveMode(ui->diveModeComboBox->currentIndex()); deviceDetails->setSaturation(ui->saturationSpinBox->value()); + deviceDetails->setDesaturation(ui->desaturationSpinBox->value()); deviceDetails->setLastDeco(ui->lastDecoSpinBox->value()); deviceDetails->setBrightness(ui->brightnessComboBox->currentIndex()); deviceDetails->setUnits(ui->unitsComboBox->currentIndex()); @@ -168,7 +169,7 @@ void ConfigureDiveComputerDialog::on_cancel_clicked() void ConfigureDiveComputerDialog::deviceReadFinished() { - + ui->statusLabel->setText(tr("Dive computer details read successfully.")); } void ConfigureDiveComputerDialog::on_saveSettingsPushButton_clicked() @@ -191,6 +192,7 @@ void ConfigureDiveComputerDialog::reloadValues() ui->customTextLlineEdit->setText(deviceDetails->customText()); ui->diveModeComboBox->setCurrentIndex(deviceDetails->diveMode()); ui->saturationSpinBox->setValue(deviceDetails->saturation()); + ui->desaturationSpinBox->setValue(deviceDetails->desaturation()); ui->lastDecoSpinBox->setValue(deviceDetails->lastDeco()); ui->brightnessComboBox->setCurrentIndex(deviceDetails->brightness()); ui->unitsComboBox->setCurrentIndex(deviceDetails->units()); @@ -200,6 +202,12 @@ void ConfigureDiveComputerDialog::reloadValues() ui->languageComboBox->setCurrentIndex(deviceDetails->language()); ui->dateFormatComboBox->setCurrentIndex(deviceDetails->dateFormat()); ui->compassGainComboBox->setCurrentIndex(deviceDetails->compassGain()); + + //load gas 1 values + ui->ostc3GasTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen))); + ui->ostc3GasTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium))); + ui->ostc3GasTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type))); + ui->ostc3GasTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth))); } diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui index 076b66fd1..6099535e8 100644 --- a/qt-ui/configuredivecomputerdialog.ui +++ b/qt-ui/configuredivecomputerdialog.ui @@ -6,8 +6,8 @@ 0 0 - 592 - 507 + 701 + 620 @@ -98,48 +98,48 @@ HW OSTC 3 - - - - m + + + + Serial No. - - - - Dive Mode Colour: + + + + true - - + + - Sync dive computer time with PC + Firmware Version: - - - - Units: + + + + true - - + + - Salinity (0-5%): + Custom Text: - - - - % - - - 5 + + + + + 1 + 0 + @@ -150,41 +150,86 @@ - - + + + + + English + + + + + German + + + + + French + + + + + Italian + + + + + + - Date Format: + Dive Mode: - - - - - 1 - 0 - - + + + + + OC + + + + + CC + + + + + Gauge + + + + + Apnea + + - - + + - Custom Text: + Saturation: - - + + + + % + + + + + - Compass Gain: + Desaturation: - - - - true + + + + % @@ -195,49 +240,45 @@ - - - - true + + + + m - - - - - Standard - - + + + + Brightness: + + + + + - Red + Eco - Green + Medium - Blue + High - - - - Qt::Vertical - - - - 20 - 40 - + + + + Date Format: - + @@ -258,28 +299,11 @@ - - - - - English - - - - - German - - - - - French - - - - - Italian - - + + + + Units: + @@ -296,20 +320,6 @@ - - - - Brightness: - - - - - - - Serial No. - - - @@ -317,25 +327,6 @@ - - - - - Eco - - - - - Medium - - - - - High - - - - @@ -350,44 +341,61 @@ - - + + - Firmware Version: + Salinity (0-5%): - - + + + + % + + + 5 + + + + + - Dive Mode: + Dive Mode Colour: - - + + - OC + Standard - CC + Red - Gauge + Green - Apnea + Blue + + + + Compass Gain: + + + @@ -438,33 +446,183 @@ - - - - Saturation: - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gas No. + + + + + %He + + + + + %O2 + + + + + Type + + + + + Change Depth + + + + + Gas 1 + + + + + Gas 2 + + + + + Gas 3 + + + + + Gas 4 + + + + + Gas 5 + + - - - - % - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Gas No. + + + + + %He + + + + + %O2 + + + + + Type + + + + + Change Depth + + + + + Gas 1 + + + + + Gas 2 + + + + + Gas 3 + + + + + Gas 4 + + + + + Gas 5 + + - - + + - Desaturation: + Sync dive computer time with PC - - - - % + + + + Qt::Vertical - + + + 20 + 40 + + + diff --git a/qt-ui/configuredivecomputerthreads.cpp b/qt-ui/configuredivecomputerthreads.cpp index f0e2bde6e..3afb11bc5 100644 --- a/qt-ui/configuredivecomputerthreads.cpp +++ b/qt-ui/configuredivecomputerthreads.cpp @@ -32,6 +32,31 @@ void ReadSettingsThread::run() m_deviceDetails->setSamplingRate(0); m_deviceDetails->setUnits(0); + + //Gread gas mixes + gas gas1; + gas gas2; + gas gas3; + gas gas4; + gas gas5; + //Gas 1 + unsigned char gasData[4] = {0,0,0,0}; + rc = hw_ostc3_device_config_read(m_data->device, 0x10, gasData, sizeof(gasData)); + if (rc == DC_STATUS_SUCCESS) { + //Gas 1 read successful + gas gas1; + gas1.depth = gasData[3]; + gas1.oxygen = gasData[0]; + gas1.helium = gasData[1]; + gas1.type = gasData[2]; + } + + m_deviceDetails->setGas1(gas1); + m_deviceDetails->setGas2(gas2); + m_deviceDetails->setGas3(gas3); + m_deviceDetails->setGas4(gas4); + m_deviceDetails->setGas5(gas5); + //Read general settings unsigned char uData[1] = {0}; //DiveMode -- cgit v1.2.3-70-g09d2