Start working on GAS and DIL tables

Start work for gas1-5 and dil1-5.

Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
Joseph W. Joshua 2014-06-20 07:51:32 +03:00 committed by Thiago Macieira
parent d76881cb01
commit 045a6fb6b1
4 changed files with 428 additions and 233 deletions

View file

@ -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());

View file

@ -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)));
}

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>592</width>
<height>507</height>
<width>701</width>
<height>620</height>
</rect>
</property>
<property name="windowTitle">
@ -98,62 +98,38 @@
<string>HW OSTC 3</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="5" column="1">
<widget class="QSpinBox" name="lastDecoSpinBox">
<property name="suffix">
<string> m</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_14">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Dive Mode Colour:</string>
<string>Serial No.</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="4">
<widget class="QCheckBox" name="dateTimeSyncCheckBox">
<item row="0" column="1">
<widget class="QLineEdit" name="serialNoLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Sync dive computer time with PC</string>
<string>Firmware Version:</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_11">
<item row="1" column="1">
<widget class="QLineEdit" name="firmwareVersionLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Units:</string>
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Salinity (0-5%):</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QSpinBox" name="salinitySpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Language:</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Date Format:</string>
<string>Custom Text:</string>
</property>
</widget>
</item>
@ -167,97 +143,13 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<item row="2" column="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Custom Text:</string>
<string>Language:</string>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Compass Gain:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="firmwareVersionLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Last Deco:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="serialNoLineEdit">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="diveModeColour">
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Red</string>
</property>
</item>
<item>
<property name="text">
<string>Green</string>
</property>
</item>
<item>
<property name="text">
<string>Blue</string>
</property>
</item>
</widget>
</item>
<item row="10" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="dateFormatComboBox">
<item>
<property name="text">
<string>MMDDYY</string>
</property>
</item>
<item>
<property name="text">
<string>DDMMYY</string>
</property>
</item>
<item>
<property name="text">
<string>YYMMDD</string>
</property>
</item>
</widget>
</item>
<item row="2" column="3">
<widget class="QComboBox" name="languageComboBox">
<item>
@ -282,81 +174,6 @@
</item>
</widget>
</item>
<item row="6" column="3">
<widget class="QComboBox" name="unitsComboBox">
<item>
<property name="text">
<string>m/°C</string>
</property>
</item>
<item>
<property name="text">
<string>ft/°F</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Brightness:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Serial No.</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Sampling Rate:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="brightnessComboBox">
<item>
<property name="text">
<string>Eco</string>
</property>
</item>
<item>
<property name="text">
<string>Medium</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="samplingRateComboBox">
<item>
<property name="text">
<string>2s</string>
</property>
</item>
<item>
<property name="text">
<string>10s</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Firmware Version:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label">
<property name="text">
@ -388,6 +205,197 @@
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Saturation:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="saturationSpinBox">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Desaturation:</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="desaturationSpinBox">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_10">
<property name="text">
<string>Last Deco:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSpinBox" name="lastDecoSpinBox">
<property name="suffix">
<string> m</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Brightness:</string>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QComboBox" name="brightnessComboBox">
<item>
<property name="text">
<string>Eco</string>
</property>
</item>
<item>
<property name="text">
<string>Medium</string>
</property>
</item>
<item>
<property name="text">
<string>High</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Date Format:</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="dateFormatComboBox">
<item>
<property name="text">
<string>MMDDYY</string>
</property>
</item>
<item>
<property name="text">
<string>DDMMYY</string>
</property>
</item>
<item>
<property name="text">
<string>YYMMDD</string>
</property>
</item>
</widget>
</item>
<item row="6" column="2">
<widget class="QLabel" name="label_11">
<property name="text">
<string>Units:</string>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QComboBox" name="unitsComboBox">
<item>
<property name="text">
<string>m/°C</string>
</property>
</item>
<item>
<property name="text">
<string>ft/°F</string>
</property>
</item>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Sampling Rate:</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="samplingRateComboBox">
<item>
<property name="text">
<string>2s</string>
</property>
</item>
<item>
<property name="text">
<string>10s</string>
</property>
</item>
</widget>
</item>
<item row="7" column="2">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Salinity (0-5%):</string>
</property>
</widget>
</item>
<item row="7" column="3">
<widget class="QSpinBox" name="salinitySpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="maximum">
<number>5</number>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Dive Mode Colour:</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QComboBox" name="diveModeColour">
<item>
<property name="text">
<string>Standard</string>
</property>
</item>
<item>
<property name="text">
<string>Red</string>
</property>
</item>
<item>
<property name="text">
<string>Green</string>
</property>
</item>
<item>
<property name="text">
<string>Blue</string>
</property>
</item>
</widget>
</item>
<item row="8" column="2">
<widget class="QLabel" name="label_15">
<property name="text">
<string>Compass Gain:</string>
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QComboBox" name="compassGainComboBox">
<property name="sizePolicy">
@ -438,33 +446,183 @@
</item>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QTableWidget" name="ostc3GasTable">
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<column>
<property name="text">
<string>Gas No.</string>
</property>
</column>
<column>
<property name="text">
<string>%He</string>
</property>
</column>
<column>
<property name="text">
<string>%O2</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Change Depth</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>Gas 1</string>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>Gas 2</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>Gas 3</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>Gas 4</string>
</property>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Saturation:</string>
<string>Gas 5</string>
</property>
</item>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="saturationSpinBox">
<property name="suffix">
<string>%</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QLabel" name="label_16">
<item row="9" column="2" colspan="2">
<widget class="QTableWidget" name="ostc3DilTable">
<row>
<property name="text">
<string>Desaturation:</string>
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<row>
<property name="text">
<string/>
</property>
</row>
<column>
<property name="text">
<string>Gas No.</string>
</property>
</column>
<column>
<property name="text">
<string>%He</string>
</property>
</column>
<column>
<property name="text">
<string>%O2</string>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
</column>
<column>
<property name="text">
<string>Change Depth</string>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>Gas 1</string>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>Gas 2</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>Gas 3</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>Gas 4</string>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>Gas 5</string>
</property>
</item>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QCheckBox" name="dateTimeSyncCheckBox">
<property name="text">
<string>Sync dive computer time with PC</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QSpinBox" name="desaturationSpinBox">
<property name="suffix">
<string>%</string>
<item row="11" column="0" colspan="4">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>

View file

@ -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