Connect up all the OSTC4 common settings

Connect up all the settings that are the same, and remove those who are
not, and correct those who only are minor differences.

Signed-off-by: Anton Lundin <glance@acc.umu.se>
This commit is contained in:
Anton Lundin 2017-04-27 21:21:00 +02:00 committed by Dirk Hohndel
parent 527763f306
commit 5a4e1a5586
3 changed files with 59 additions and 400 deletions

View file

@ -554,6 +554,31 @@ static dc_status_t read_ostc4_settings(dc_device_t *device, DeviceDetails *m_dev
EMIT_PROGRESS(); \
} while (0)
READ_SETTING(OSTC3_DIVE_MODE, diveMode);
READ_SETTING(OSTC3_LAST_DECO, lastDeco);
READ_SETTING(OSTC3_BRIGHTNESS, brightness);
READ_SETTING(OSTC3_UNITS, units);
READ_SETTING(OSTC3_SALINITY, salinity);
READ_SETTING(OSTC3_DIVEMODE_COLOR, diveModeColor);
READ_SETTING(OSTC3_LANGUAGE, language);
READ_SETTING(OSTC3_DATE_FORMAT, dateFormat);
READ_SETTING(OSTC3_SAFETY_STOP, safetyStop);
READ_SETTING(OSTC3_GF_HIGH, gfHigh);
READ_SETTING(OSTC3_GF_LOW, gfLow);
READ_SETTING(OSTC3_PPO2_MIN, ppO2Min);
READ_SETTING(OSTC3_PPO2_MAX, ppO2Max);
READ_SETTING(OSTC3_FUTURE_TTS, futureTTS);
READ_SETTING(OSTC3_CCR_MODE, ccrMode);
READ_SETTING(OSTC3_DECO_TYPE, decoType);
READ_SETTING(OSTC3_AGF_HIGH, aGFHigh);
READ_SETTING(OSTC3_AGF_LOW, aGFLow);
READ_SETTING(OSTC3_SETPOINT_FALLBACK, setPointFallback);
READ_SETTING(OSTC3_BOTTOM_GAS_CONSUMPTION, bottomGasConsumption);
READ_SETTING(OSTC3_DECO_GAS_CONSUMPTION, decoGasConsumption);
READ_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
READ_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength);
READ_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth);
#undef READ_SETTING
rc = hw_ostc3_device_config_read(device, OSTC3_PRESSURE_SENSOR_OFFSET, uData, sizeof(uData));
@ -792,6 +817,31 @@ static dc_status_t write_ostc4_settings(dc_device_t *device, DeviceDetails *m_de
EMIT_PROGRESS(); \
} while (0)
WRITE_SETTING(OSTC3_DIVE_MODE, diveMode);
WRITE_SETTING(OSTC3_LAST_DECO, lastDeco);
WRITE_SETTING(OSTC3_BRIGHTNESS, brightness);
WRITE_SETTING(OSTC3_UNITS, units);
WRITE_SETTING(OSTC3_SALINITY, salinity);
WRITE_SETTING(OSTC3_DIVEMODE_COLOR, diveModeColor);
WRITE_SETTING(OSTC3_LANGUAGE, language);
WRITE_SETTING(OSTC3_DATE_FORMAT, dateFormat);
WRITE_SETTING(OSTC3_SAFETY_STOP, safetyStop);
WRITE_SETTING(OSTC3_GF_HIGH, gfHigh);
WRITE_SETTING(OSTC3_GF_LOW, gfLow);
WRITE_SETTING(OSTC3_PPO2_MIN, ppO2Min);
WRITE_SETTING(OSTC3_PPO2_MAX, ppO2Max);
WRITE_SETTING(OSTC3_FUTURE_TTS, futureTTS);
WRITE_SETTING(OSTC3_CCR_MODE, ccrMode);
WRITE_SETTING(OSTC3_DECO_TYPE, decoType);
WRITE_SETTING(OSTC3_AGF_HIGH, aGFHigh);
WRITE_SETTING(OSTC3_AGF_LOW, aGFLow);
WRITE_SETTING(OSTC3_SETPOINT_FALLBACK, setPointFallback);
WRITE_SETTING(OSTC3_BOTTOM_GAS_CONSUMPTION, bottomGasConsumption);
WRITE_SETTING(OSTC3_DECO_GAS_CONSUMPTION, decoGasConsumption);
WRITE_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
WRITE_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength);
WRITE_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth);
#undef WRITE_SETTING
// OSTC3 stores the pressureSensorOffset in two-complement

View file

@ -792,17 +792,13 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC4()
{
deviceDetails->customText = ui.customTextLlineEdit_4->text();
deviceDetails->diveMode = ui.diveModeComboBox_4->currentIndex();
deviceDetails->saturation = ui.saturationSpinBox_4->value();
deviceDetails->desaturation = ui.desaturationSpinBox_4->value();
deviceDetails->lastDeco = ui.lastDecoSpinBox_4->value();
deviceDetails->brightness = ui.brightnessComboBox_4->currentIndex();
deviceDetails->units = ui.unitsComboBox_4->currentIndex();
deviceDetails->samplingRate = ui.samplingRateComboBox_4->currentIndex();
deviceDetails->salinity = ui.salinitySpinBox_4->value();
deviceDetails->diveModeColor = ui.diveModeColour_4->currentIndex();
deviceDetails->language = ui.languageComboBox_4->currentIndex();
deviceDetails->dateFormat = ui.dateFormatComboBox_4->currentIndex();
deviceDetails->compassGain = ui.compassGainComboBox_4->currentIndex();
deviceDetails->syncTime = ui.dateTimeSyncCheckBox_4->isChecked();
deviceDetails->safetyStop = ui.safetyStopCheckBox_4->isChecked();
deviceDetails->gfHigh = ui.gfHighSpinBox_4->value();
@ -813,25 +809,15 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC4()
deviceDetails->futureTTS = ui.futureTTSSpinBox_4->value();
deviceDetails->ccrMode = ui.ccrModeComboBox_4->currentIndex();
deviceDetails->decoType = ui.decoTypeComboBox_4->currentIndex();
deviceDetails->aGFSelectable = ui.aGFSelectableCheckBox_4->isChecked();
deviceDetails->aGFHigh = ui.aGFHighSpinBox_4->value();
deviceDetails->aGFLow = ui.aGFLowSpinBox_4->value();
deviceDetails->calibrationGas = ui.calibrationGasSpinBox_4->value();
deviceDetails->flipScreen = ui.flipScreenCheckBox_4->isChecked();
deviceDetails->setPointFallback = ui.setPointFallbackCheckBox_4->isChecked();
deviceDetails->leftButtonSensitivity = ui.leftButtonSensitivity_4->value();
deviceDetails->rightButtonSensitivity = ui.rightButtonSensitivity_4->value();
deviceDetails->bottomGasConsumption = ui.bottomGasConsumption_4->value();
deviceDetails->decoGasConsumption = ui.decoGasConsumption_4->value();
deviceDetails->modWarning = ui.modWarning_4->isChecked();
deviceDetails->dynamicAscendRate = ui.dynamicAscendRate_4->isChecked();
deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator_4->isChecked();
deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2_4->isChecked();
deviceDetails->tempSensorOffset = lrint(ui.tempSensorOffsetDoubleSpinBox_4->value() * 10);
deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox_4->value();
deviceDetails->safetyStopStartDepth = lrint(ui.safetyStopStartDepthDoubleSpinBox_4->value() * 10);
deviceDetails->safetyStopEndDepth = lrint(ui.safetyStopEndDepthDoubleSpinBox_4->value() * 10);
deviceDetails->safetyStopResetDepth = lrint(ui.safetyStopResetDepthDoubleSpinBox_4->value() * 10);
//set gas values
gas gas1;
@ -1312,17 +1298,13 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC4()
ui.customTextLlineEdit_4->setText(deviceDetails->customText);
ui.modelLineEdit_4->setText(deviceDetails->model);
ui.diveModeComboBox_4->setCurrentIndex(deviceDetails->diveMode);
ui.saturationSpinBox_4->setValue(deviceDetails->saturation);
ui.desaturationSpinBox_4->setValue(deviceDetails->desaturation);
ui.lastDecoSpinBox_4->setValue(deviceDetails->lastDeco);
ui.brightnessComboBox_4->setCurrentIndex(deviceDetails->brightness);
ui.unitsComboBox_4->setCurrentIndex(deviceDetails->units);
ui.samplingRateComboBox_4->setCurrentIndex(deviceDetails->samplingRate);
ui.salinitySpinBox_4->setValue(deviceDetails->salinity);
ui.diveModeColour_4->setCurrentIndex(deviceDetails->diveModeColor);
ui.languageComboBox_4->setCurrentIndex(deviceDetails->language);
ui.dateFormatComboBox_4->setCurrentIndex(deviceDetails->dateFormat);
ui.compassGainComboBox_4->setCurrentIndex(deviceDetails->compassGain);
ui.safetyStopCheckBox_4->setChecked(deviceDetails->safetyStop);
ui.gfHighSpinBox_4->setValue(deviceDetails->gfHigh);
ui.gfLowSpinBox_4->setValue(deviceDetails->gfLow);
@ -1332,25 +1314,15 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC4()
ui.futureTTSSpinBox_4->setValue(deviceDetails->futureTTS);
ui.ccrModeComboBox_4->setCurrentIndex(deviceDetails->ccrMode);
ui.decoTypeComboBox_4->setCurrentIndex(deviceDetails->decoType);
ui.aGFSelectableCheckBox_4->setChecked(deviceDetails->aGFSelectable);
ui.aGFHighSpinBox_4->setValue(deviceDetails->aGFHigh);
ui.aGFLowSpinBox_4->setValue(deviceDetails->aGFLow);
ui.calibrationGasSpinBox_4->setValue(deviceDetails->calibrationGas);
ui.flipScreenCheckBox_4->setChecked(deviceDetails->flipScreen);
ui.setPointFallbackCheckBox_4->setChecked(deviceDetails->setPointFallback);
ui.leftButtonSensitivity_4->setValue(deviceDetails->leftButtonSensitivity);
ui.rightButtonSensitivity_4->setValue(deviceDetails->rightButtonSensitivity);
ui.bottomGasConsumption_4->setValue(deviceDetails->bottomGasConsumption);
ui.decoGasConsumption_4->setValue(deviceDetails->decoGasConsumption);
ui.modWarning_4->setChecked(deviceDetails->modWarning);
ui.dynamicAscendRate_4->setChecked(deviceDetails->dynamicAscendRate);
ui.graphicalSpeedIndicator_4->setChecked(deviceDetails->graphicalSpeedIndicator);
ui.alwaysShowppO2_4->setChecked(deviceDetails->alwaysShowppO2);
ui.tempSensorOffsetDoubleSpinBox_4->setValue((double)deviceDetails->tempSensorOffset / 10.0);
ui.safetyStopLengthSpinBox_4->setValue(deviceDetails->safetyStopLength);
ui.safetyStopStartDepthDoubleSpinBox_4->setValue(deviceDetails->safetyStopStartDepth / 10.0);
ui.safetyStopEndDepthDoubleSpinBox_4->setValue(deviceDetails->safetyStopEndDepth / 10.0);
ui.safetyStopResetDepthDoubleSpinBox_4->setValue(deviceDetails->safetyStopResetDepth / 10.0);
//load gas 1 values
ui.ostc4GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen)));

View file

@ -3064,56 +3064,6 @@
</property>
</widget>
</item>
<item row="8" column="4">
<widget class="QComboBox" name="compassGainComboBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>230LSB/Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>330LSB/Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>390LSB/Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>440LSB/Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>660LSB/Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>820LSB/Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>1090LSB/Gauss</string>
</property>
</item>
<item>
<property name="text">
<string>1370LSB/Gauss</string>
</property>
</item>
</widget>
</item>
<item row="12" column="2">
<spacer>
<property name="orientation">
@ -3140,16 +3090,6 @@
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QLabel">
<property name="text">
<string>Compass gain</string>
</property>
<property name="buddy">
<cstring>compassGainComboBox_4</cstring>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel">
<property name="text">
@ -3208,30 +3148,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="samplingRateComboBox_4">
<item>
<property name="text">
<string>2s</string>
</property>
</item>
<item>
<property name="text">
<string>10s</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel">
<property name="text">
<string>Sampling rate</string>
</property>
<property name="buddy">
<cstring>samplingRateComboBox_4</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="diveModeColour_4">
<item>
@ -3280,13 +3196,6 @@
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel">
<property name="text">
<string>End Depth</string>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QSpinBox" name="safetyStopLengthSpinBox_4">
<property name="enabled">
@ -3299,7 +3208,7 @@
<number>60</number>
</property>
<property name="maximum">
<number>240</number>
<number>255</number>
</property>
<property name="value">
<number>180</number>
@ -3320,13 +3229,6 @@
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel">
<property name="text">
<string>Reset Depth</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QDoubleSpinBox" name="safetyStopStartDepthDoubleSpinBox_4">
<property name="enabled">
@ -3339,10 +3241,10 @@
<number>1</number>
</property>
<property name="minimum">
<double>2.100000000000000</double>
<double>3.000000000000000</double>
</property>
<property name="maximum">
<double>6.100000000000000</double>
<double>6.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
@ -3352,50 +3254,6 @@
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QDoubleSpinBox" name="safetyStopEndDepthDoubleSpinBox_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>1.900000000000000</double>
</property>
<property name="maximum">
<double>3.000000000000000</double>
</property>
<property name="value">
<double>2.900000000000000</double>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QDoubleSpinBox" name="safetyStopResetDepthDoubleSpinBox_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string> m</string>
</property>
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>8.100000000000000</double>
</property>
<property name="maximum">
<double>15.100000000000000</double>
</property>
<property name="value">
<double>10.100000000000000</double>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="advancedSettings_4">
@ -3403,27 +3261,13 @@
<string>Advanced settings</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_8">
<item row="10" column="3">
<widget class="QLabel">
<property name="text">
<string>Left button sensitivity</string>
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<item row="12" column="0" colspan="2">
<widget class="QCheckBox" name="alwaysShowppO2_4">
<property name="text">
<string>Always show pO₂</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="aGFSelectableCheckBox_4">
<property name="text">
<string>Alt GF can be selected underwater</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel">
<property name="text">
@ -3484,32 +3328,6 @@
</property>
</widget>
</item>
<item row="9" column="3">
<widget class="QLabel">
<property name="text">
<string>Desaturation</string>
</property>
<property name="buddy">
<cstring>desaturationSpinBox_4</cstring>
</property>
</widget>
</item>
<item row="9" column="4">
<widget class="QSpinBox" name="desaturationSpinBox_4">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>60</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>90</number>
</property>
</widget>
</item>
<item row="14" column="0">
<spacer>
<property name="orientation">
@ -3545,9 +3363,6 @@
</item>
<item row="3" column="4">
<widget class="QSpinBox" name="aGFLowSpinBox_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string>%</string>
</property>
@ -3590,6 +3405,11 @@
<string>ZH-L16+GF</string>
</property>
</item>
<item>
<property name="text">
<string>VPM</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
@ -3612,22 +3432,6 @@
</property>
</widget>
</item>
<item row="8" column="4">
<widget class="QSpinBox" name="saturationSpinBox_4">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>100</number>
</property>
<property name="maximum">
<number>140</number>
</property>
<property name="value">
<number>110</number>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel">
<property name="text">
@ -3637,9 +3441,6 @@
</item>
<item row="6" column="4">
<widget class="QSpinBox" name="aGFHighSpinBox_4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="suffix">
<string>%</string>
</property>
@ -3661,51 +3462,6 @@
</property>
</widget>
</item>
<item row="8" column="3">
<widget class="QLabel">
<property name="text">
<string>Saturation</string>
</property>
<property name="buddy">
<cstring>saturationSpinBox_4</cstring>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="flipScreenCheckBox_4">
<property name="text">
<string>Flip screen</string>
</property>
</widget>
</item>
<item row="11" column="3">
<widget class="QLabel">
<property name="text">
<string>Right button sensitivity</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QCheckBox" name="modWarning_4">
<property name="text">
<string>MOD warning</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QCheckBox" name="graphicalSpeedIndicator_4">
<property name="text">
<string>Graphical speed indicator</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QCheckBox" name="dynamicAscendRate_4">
<property name="text">
<string>Dynamic ascent rate</string>
</property>
</widget>
</item>
<item row="12" column="3">
<widget class="QLabel">
<property name="text">
@ -3720,38 +3476,6 @@
</property>
</widget>
</item>
<item row="10" column="4">
<widget class="QSpinBox" name="leftButtonSensitivity_4">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>40</number>
</property>
</widget>
</item>
<item row="11" column="4">
<widget class="QSpinBox" name="rightButtonSensitivity_4">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>20</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>40</number>
</property>
</widget>
</item>
<item row="12" column="4">
<widget class="QSpinBox" name="bottomGasConsumption_4">
<property name="suffix">
@ -4062,29 +3786,6 @@
</item>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel">
<property name="text">
<string>O₂ in calibration gas</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QSpinBox" name="calibrationGasSpinBox_4">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>21</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>21</number>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QComboBox" name="ccrModeComboBox_4">
<item>
@ -4457,38 +4158,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>aGFSelectableCheckBox_4</sender>
<signal>toggled(bool)</signal>
<receiver>aGFHighSpinBox_4</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>340</x>
<y>229</y>
</hint>
<hint type="destinationlabel">
<x>686</x>
<y>265</y>
</hint>
</hints>
</connection>
<connection>
<sender>aGFSelectableCheckBox_4</sender>
<signal>toggled(bool)</signal>
<receiver>aGFLowSpinBox_4</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>340</x>
<y>229</y>
</hint>
<hint type="destinationlabel">
<x>686</x>
<y>229</y>
</hint>
</hints>
</connection>
<connection>
<sender>safetyStopCheckBox_4</sender>
<signal>toggled(bool)</signal>
@ -4521,37 +4190,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>safetyStopCheckBox_4</sender>
<signal>toggled(bool)</signal>
<receiver>safetyStopEndDepthDoubleSpinBox_4</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>safetyStopCheckBox_4</sender>
<signal>toggled(bool)</signal>
<receiver>safetyStopResetDepthDoubleSpinBox_4</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel">
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections>
</ui>