[PATCH 5/5] configure OSTC/OSTC3: Add safety stop parameters

Anton Lundin glance at acc.umu.se
Fri Jan 22 05:17:50 PST 2016


This adds the configure parameters for safety stops on the hwOS(OSTC3)
and OSTC computers.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 desktop-widgets/configuredivecomputerdialog.cpp  |  16 +
 desktop-widgets/configuredivecomputerdialog.ui   | 706 +++++++++++++++++------
 subsurface-core/configuredivecomputerthreads.cpp |  35 +-
 subsurface-core/devicedetails.cpp                |   6 +-
 subsurface-core/devicedetails.h                  |   4 +
 5 files changed, 592 insertions(+), 175 deletions(-)

diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp
index 3fbb432..8df1847 100644
--- a/desktop-widgets/configuredivecomputerdialog.cpp
+++ b/desktop-widgets/configuredivecomputerdialog.cpp
@@ -471,6 +471,10 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
 	deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator->isChecked();
 	deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2->isChecked();
 	deviceDetails->tempSensorOffset = ui.tempSensorOffsetDoubleSpinBox->value() * 10;
+	deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox->value();
+	deviceDetails->safetyStopStartDepth = ui.safetyStopStartDepthDoubleSpinBox->value();
+	deviceDetails->safetyStopEndDepth = ui.safetyStopEndDepthDoubleSpinBox->value();
+	deviceDetails->safetyStopResetDepth = ui.safetyStopResetDepthDoubleSpinBox->value();
 
 	//set gas values
 	gas gas1;
@@ -600,6 +604,10 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
 	deviceDetails->bottomGasConsumption = ui.bottomGasConsumption_3->value();
 	deviceDetails->decoGasConsumption = ui.decoGasConsumption_3->value();
 	deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator_3->isChecked();
+	deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox_3->value();
+	deviceDetails->safetyStopStartDepth = ui.safetyStopStartDepthDoubleSpinBox_3->value();
+	deviceDetails->safetyStopEndDepth = ui.safetyStopEndDepthDoubleSpinBox_3->value();
+	deviceDetails->safetyStopResetDepth = ui.safetyStopResetDepthDoubleSpinBox_3->value();
 
 	//set gas values
 	gas gas1;
@@ -847,6 +855,10 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3()
 	ui.graphicalSpeedIndicator->setChecked(deviceDetails->graphicalSpeedIndicator);
 	ui.alwaysShowppO2->setChecked(deviceDetails->alwaysShowppO2);
 	ui.tempSensorOffsetDoubleSpinBox->setValue((double)deviceDetails->tempSensorOffset / 10.0);
+	ui.safetyStopLengthSpinBox->setValue(deviceDetails->safetyStopLength);
+	ui.safetyStopStartDepthDoubleSpinBox->setValue(deviceDetails->safetyStopStartDepth);
+	ui.safetyStopEndDepthDoubleSpinBox->setValue(deviceDetails->safetyStopEndDepth);
+	ui.safetyStopResetDepthDoubleSpinBox->setValue(deviceDetails->safetyStopResetDepth);
 
 	//load gas 1 values
 	ui.ostc3GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen)));
@@ -970,6 +982,10 @@ setNumberOfDives
 	ui.bottomGasConsumption_3->setValue(deviceDetails->bottomGasConsumption);
 	ui.decoGasConsumption_3->setValue(deviceDetails->decoGasConsumption);
 	ui.graphicalSpeedIndicator_3->setChecked(deviceDetails->graphicalSpeedIndicator);
+	ui.safetyStopLengthSpinBox_3->setValue(deviceDetails->safetyStopLength);
+	ui.safetyStopStartDepthDoubleSpinBox_3->setValue(deviceDetails->safetyStopStartDepth);
+	ui.safetyStopEndDepthDoubleSpinBox_3->setValue(deviceDetails->safetyStopEndDepth);
+	ui.safetyStopResetDepthDoubleSpinBox_3->setValue(deviceDetails->safetyStopResetDepth);
 
 	//load gas 1 values
 	ui.ostcGasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen)));
diff --git a/desktop-widgets/configuredivecomputerdialog.ui b/desktop-widgets/configuredivecomputerdialog.ui
index ac177a2..a37b5ec 100644
--- a/desktop-widgets/configuredivecomputerdialog.ui
+++ b/desktop-widgets/configuredivecomputerdialog.ui
@@ -253,6 +253,35 @@
             <string>Basic settings</string>
            </attribute>
            <layout class="QGridLayout" name="gridLayout">
+            <item row="5" column="4">
+             <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="4">
+             <widget class="QSpinBox" name="salinitySpinBox">
+              <property name="suffix">
+               <string>%</string>
+              </property>
+              <property name="maximum">
+               <number>5</number>
+              </property>
+             </widget>
+            </item>
             <item row="2" column="4">
              <widget class="QComboBox" name="languageComboBox">
               <item>
@@ -324,23 +353,6 @@
               </property>
              </widget>
             </item>
-            <item row="0" column="4">
-             <widget class="QLineEdit" name="firmwareVersionLineEdit">
-              <property name="readOnly">
-               <bool>true</bool>
-              </property>
-             </widget>
-            </item>
-            <item row="2" column="3">
-             <widget class="QLabel" name="label_5">
-              <property name="text">
-               <string>Language</string>
-              </property>
-              <property name="buddy">
-               <cstring>languageComboBox</cstring>
-              </property>
-             </widget>
-            </item>
             <item row="3" column="4">
              <widget class="QComboBox" name="dateFormatComboBox">
               <item>
@@ -360,23 +372,21 @@
               </item>
              </widget>
             </item>
-            <item row="5" column="4">
-             <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>
+            <item row="0" column="4">
+             <widget class="QLineEdit" name="firmwareVersionLineEdit">
+              <property name="readOnly">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="3">
+             <widget class="QLabel" name="label_5">
+              <property name="text">
+               <string>Language</string>
+              </property>
+              <property name="buddy">
+               <cstring>languageComboBox</cstring>
+              </property>
              </widget>
             </item>
             <item row="3" column="3">
@@ -419,13 +429,13 @@
               </property>
              </widget>
             </item>
-            <item row="7" column="4">
-             <widget class="QSpinBox" name="salinitySpinBox">
-              <property name="suffix">
-               <string>%</string>
+            <item row="14" column="3" colspan="2">
+             <widget class="QPushButton" name="resetButton">
+              <property name="enabled">
+               <bool>false</bool>
               </property>
-              <property name="maximum">
-               <number>5</number>
+              <property name="text">
+               <string>Reset device to default settings</string>
               </property>
              </widget>
             </item>
@@ -479,7 +489,7 @@
               </item>
              </widget>
             </item>
-            <item row="9" column="2">
+            <item row="12" column="2">
              <spacer name="verticalSpacer1">
               <property name="orientation">
                <enum>Qt::Vertical</enum>
@@ -492,13 +502,16 @@
               </property>
              </spacer>
             </item>
-            <item row="11" column="3" colspan="2">
-             <widget class="QPushButton" name="resetButton">
-              <property name="enabled">
-               <bool>false</bool>
+            <item row="1" column="1" colspan="2">
+             <widget class="QLineEdit" name="customTextLlineEdit">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                <horstretch>1</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
               </property>
-              <property name="text">
-               <string>Reset device to default settings</string>
+              <property name="maxLength">
+               <number>60</number>
               </property>
              </widget>
             </item>
@@ -512,6 +525,13 @@
               </property>
              </widget>
             </item>
+            <item row="1" column="3">
+             <widget class="QLabel" name="label_62">
+              <property name="text">
+               <string>Computer model</string>
+              </property>
+             </widget>
+            </item>
             <item row="1" column="0">
              <widget class="QLabel" name="label_4">
               <property name="text">
@@ -522,26 +542,6 @@
               </property>
              </widget>
             </item>
-            <item row="1" column="1" colspan="2">
-             <widget class="QLineEdit" name="customTextLlineEdit">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-                <horstretch>1</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="maxLength">
-               <number>60</number>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="3">
-             <widget class="QLabel" name="label_62">
-              <property name="text">
-               <string>Computer model</string>
-              </property>
-             </widget>
-            </item>
             <item row="1" column="4">
              <widget class="QLineEdit" name="modelLineEdit">
               <property name="readOnly">
@@ -549,16 +549,6 @@
               </property>
              </widget>
             </item>
-            <item row="2" column="0">
-             <widget class="QLabel" name="label">
-              <property name="text">
-               <string>Dive mode</string>
-              </property>
-              <property name="buddy">
-               <cstring>diveModeComboBox</cstring>
-              </property>
-             </widget>
-            </item>
             <item row="2" column="1">
              <widget class="QComboBox" name="diveModeComboBox">
               <item>
@@ -583,13 +573,13 @@
               </item>
              </widget>
             </item>
-            <item row="3" column="0">
-             <widget class="QLabel" name="label_11">
+            <item row="2" column="0">
+             <widget class="QLabel" name="label">
               <property name="text">
-               <string>Sampling rate</string>
+               <string>Dive mode</string>
               </property>
               <property name="buddy">
-               <cstring>samplingRateComboBox</cstring>
+               <cstring>diveModeComboBox</cstring>
               </property>
              </widget>
             </item>
@@ -607,13 +597,13 @@
               </item>
              </widget>
             </item>
-            <item row="5" column="0">
-             <widget class="QLabel" name="label_13">
+            <item row="3" column="0">
+             <widget class="QLabel" name="label_11">
               <property name="text">
-               <string>Dive mode color</string>
+               <string>Sampling rate</string>
               </property>
               <property name="buddy">
-               <cstring>diveModeColour</cstring>
+               <cstring>samplingRateComboBox</cstring>
               </property>
              </widget>
             </item>
@@ -648,6 +638,16 @@
               </property>
              </widget>
             </item>
+            <item row="5" column="0">
+             <widget class="QLabel" name="label_13">
+              <property name="text">
+               <string>Dive mode color</string>
+              </property>
+              <property name="buddy">
+               <cstring>diveModeColour</cstring>
+              </property>
+             </widget>
+            </item>
             <item row="7" column="0" colspan="3">
              <widget class="QCheckBox" name="safetyStopCheckBox">
               <property name="text">
@@ -655,6 +655,122 @@
               </property>
              </widget>
             </item>
+            <item row="10" column="0">
+             <widget class="QLabel" name="label_65">
+              <property name="text">
+               <string>End Depth</string>
+              </property>
+             </widget>
+            </item>
+            <item row="8" column="1">
+             <widget class="QSpinBox" name="safetyStopLengthSpinBox">
+              <property name="enabled">
+               <bool>false</bool>
+              </property>
+              <property name="suffix">
+               <string> s</string>
+              </property>
+              <property name="minimum">
+               <number>60</number>
+              </property>
+              <property name="maximum">
+               <number>240</number>
+              </property>
+              <property name="value">
+               <number>180</number>
+              </property>
+             </widget>
+            </item>
+            <item row="8" column="0">
+             <widget class="QLabel" name="label_63">
+              <property name="text">
+               <string>Length</string>
+              </property>
+             </widget>
+            </item>
+            <item row="9" column="0">
+             <widget class="QLabel" name="label_64">
+              <property name="text">
+               <string>Start Depth</string>
+              </property>
+             </widget>
+            </item>
+            <item row="11" column="0">
+             <widget class="QLabel" name="label_66">
+              <property name="text">
+               <string>Reset Depth</string>
+              </property>
+             </widget>
+            </item>
+            <item row="9" column="1">
+             <widget class="QDoubleSpinBox" name="safetyStopStartDepthDoubleSpinBox">
+              <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>2.100000000000000</double>
+              </property>
+              <property name="maximum">
+               <double>6.100000000000000</double>
+              </property>
+              <property name="singleStep">
+               <double>0.100000000000000</double>
+              </property>
+              <property name="value">
+               <double>5.100000000000000</double>
+              </property>
+             </widget>
+            </item>
+            <item row="10" column="1">
+             <widget class="QDoubleSpinBox" name="safetyStopEndDepthDoubleSpinBox">
+              <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">
+              <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">
@@ -1821,27 +1937,31 @@
             <string>Basic settings</string>
            </attribute>
            <layout class="QGridLayout" name="gridLayout_4">
-            <item row="5" column="3">
-             <widget class="QLabel" name="label_45">
+            <item row="0" column="0" colspan="2">
+             <widget class="QLabel" name="label_38">
               <property name="text">
-               <string>Salinity</string>
+               <string>Serial No.</string>
               </property>
               <property name="buddy">
-               <cstring>salinitySpinBox</cstring>
+               <cstring>serialNoLineEdit</cstring>
               </property>
              </widget>
             </item>
-            <item row="0" column="0">
-             <widget class="QLabel" name="label_38">
+            <item row="6" column="0">
+             <widget class="QLabel" name="label_68">
               <property name="text">
-               <string>Serial No.</string>
+               <string>Length</string>
               </property>
-              <property name="buddy">
-               <cstring>serialNoLineEdit</cstring>
+             </widget>
+            </item>
+            <item row="0" column="6">
+             <widget class="QLineEdit" name="firmwareVersionLineEdit_3">
+              <property name="readOnly">
+               <bool>true</bool>
               </property>
              </widget>
             </item>
-            <item row="0" column="1" colspan="2">
+            <item row="0" column="2" colspan="2">
              <widget class="QLineEdit" name="serialNoLineEdit_3">
               <property name="sizePolicy">
                <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
@@ -1854,7 +1974,7 @@
               </property>
              </widget>
             </item>
-            <item row="0" column="3">
+            <item row="0" column="5">
              <widget class="QLabel" name="label_39">
               <property name="text">
                <string>Firmware version</string>
@@ -1864,37 +1984,126 @@
               </property>
              </widget>
             </item>
-            <item row="0" column="4">
-             <widget class="QLineEdit" name="firmwareVersionLineEdit_3">
-              <property name="readOnly">
-               <bool>true</bool>
+            <item row="1" column="0" colspan="2">
+             <widget class="QLabel" name="label_40">
+              <property name="text">
+               <string>Custom text</string>
+              </property>
+              <property name="buddy">
+               <cstring>customTextLlineEdit_3</cstring>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="2" colspan="2">
+             <widget class="QLineEdit" name="customTextLlineEdit_3">
+              <property name="sizePolicy">
+               <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+                <horstretch>1</horstretch>
+                <verstretch>0</verstretch>
+               </sizepolicy>
+              </property>
+              <property name="maxLength">
+               <number>23</number>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="5">
+             <widget class="QLabel" name="label_41">
+              <property name="text">
+               <string>Number of dives</string>
+              </property>
+             </widget>
+            </item>
+            <item row="4" column="0" rowspan="2" colspan="4">
+             <widget class="QCheckBox" name="safetyStopCheckBox_3">
+              <property name="text">
+               <string>Show safety stop</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="6">
+             <widget class="QSpinBox" name="numberOfDivesSpinBox_3">
+              <property name="readOnly">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="0" colspan="2">
+             <widget class="QLabel" name="label_47">
+              <property name="text">
+               <string>Sampling rate</string>
+              </property>
+              <property name="buddy">
+               <cstring>samplingRateComboBox</cstring>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="2" colspan="2">
+             <widget class="QSpinBox" name="samplingRateSpinBox_3">
+              <property name="minimumSize">
+               <size>
+                <width>0</width>
+                <height>0</height>
+               </size>
+              </property>
+              <property name="minimum">
+               <number>1</number>
+              </property>
+              <property name="maximum">
+               <number>120</number>
+              </property>
+              <property name="value">
+               <number>10</number>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="5">
+             <widget class="QLabel" name="label_42">
+              <property name="text">
+               <string>Date format</string>
+              </property>
+              <property name="buddy">
+               <cstring>dateFormatComboBox</cstring>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="6">
+             <widget class="QComboBox" name="dateFormatComboBox_3">
+              <item>
+               <property name="text">
+                <string>MM/DD/YY</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>DD/MM/YY</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>YY/MM/DD</string>
+               </property>
+              </item>
+             </widget>
+            </item>
+            <item row="3" column="0" colspan="4">
+             <widget class="QCheckBox" name="dateTimeSyncCheckBox_3">
+              <property name="text">
+               <string>Sync dive computer time with PC</string>
               </property>
              </widget>
             </item>
-            <item row="1" column="0">
-             <widget class="QLabel" name="label_40">
+            <item row="3" column="5">
+             <widget class="QLabel" name="label_45">
               <property name="text">
-               <string>Custom text</string>
+               <string>Salinity</string>
               </property>
               <property name="buddy">
-               <cstring>customTextLlineEdit_3</cstring>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="1" colspan="2">
-             <widget class="QLineEdit" name="customTextLlineEdit_3">
-              <property name="sizePolicy">
-               <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
-                <horstretch>1</horstretch>
-                <verstretch>0</verstretch>
-               </sizepolicy>
-              </property>
-              <property name="maxLength">
-               <number>23</number>
+               <cstring>salinitySpinBox</cstring>
               </property>
              </widget>
             </item>
-            <item row="5" column="4">
+            <item row="3" column="6">
              <widget class="QDoubleSpinBox" name="salinityDoubleSpinBox_3">
               <property name="suffix">
                <string>kg/ℓ</string>
@@ -1910,7 +2119,7 @@
               </property>
              </widget>
             </item>
-            <item row="7" column="2">
+            <item row="10" column="3">
              <spacer name="verticalSpacer">
               <property name="orientation">
                <enum>Qt::Vertical</enum>
@@ -1923,89 +2132,112 @@
               </property>
              </spacer>
             </item>
-            <item row="5" column="0" colspan="3">
-             <widget class="QCheckBox" name="dateTimeSyncCheckBox_3">
+            <item row="7" column="0">
+             <widget class="QLabel" name="label_67">
               <property name="text">
-               <string>Sync dive computer time with PC</string>
+               <string>Start Depth</string>
               </property>
              </widget>
             </item>
-            <item row="6" column="0" colspan="3">
-             <widget class="QCheckBox" name="safetyStopCheckBox_3">
+            <item row="8" column="0">
+             <widget class="QLabel" name="label_69">
               <property name="text">
-               <string>Show safety stop</string>
+               <string>End Depth</string>
               </property>
              </widget>
             </item>
-            <item row="2" column="4">
-             <widget class="QComboBox" name="dateFormatComboBox_3">
-              <item>
-               <property name="text">
-                <string>MM/DD/YY</string>
-               </property>
-              </item>
-              <item>
-               <property name="text">
-                <string>DD/MM/YY</string>
-               </property>
-              </item>
-              <item>
-               <property name="text">
-                <string>YY/MM/DD</string>
-               </property>
-              </item>
-             </widget>
-            </item>
-            <item row="1" column="3">
-             <widget class="QLabel" name="label_41">
+            <item row="9" column="0">
+             <widget class="QLabel" name="label_70">
               <property name="text">
-               <string>Number of dives</string>
+               <string>Reset Depth</string>
               </property>
              </widget>
             </item>
-            <item row="1" column="4">
-             <widget class="QSpinBox" name="numberOfDivesSpinBox_3">
-              <property name="readOnly">
-               <bool>true</bool>
+            <item row="6" column="2">
+             <widget class="QSpinBox" name="safetyStopLengthSpinBox_3">
+              <property name="enabled">
+               <bool>false</bool>
+              </property>
+              <property name="suffix">
+               <string> s</string>
+              </property>
+              <property name="minimum">
+               <number>10</number>
+              </property>
+              <property name="maximum">
+               <number>250</number>
+              </property>
+              <property name="value">
+               <number>180</number>
               </property>
              </widget>
             </item>
-            <item row="2" column="1">
-             <widget class="QSpinBox" name="samplingRateSpinBox_3">
-              <property name="minimumSize">
-               <size>
-                <width>0</width>
-                <height>0</height>
-               </size>
+            <item row="7" column="2">
+             <widget class="QDoubleSpinBox" name="safetyStopStartDepthDoubleSpinBox_3">
+              <property name="enabled">
+               <bool>false</bool>
               </property>
-              <property name="minimum">
+              <property name="suffix">
+               <string> m</string>
+              </property>
+              <property name="decimals">
                <number>1</number>
               </property>
+              <property name="minimum">
+               <double>3.000000000000000</double>
+              </property>
               <property name="maximum">
-               <number>120</number>
+               <double>6.500000000000000</double>
+              </property>
+              <property name="singleStep">
+               <double>0.100000000000000</double>
               </property>
               <property name="value">
-               <number>10</number>
+               <double>5.100000000000000</double>
               </property>
              </widget>
             </item>
-            <item row="2" column="0">
-             <widget class="QLabel" name="label_47">
-              <property name="text">
-               <string>Sampling rate</string>
+            <item row="8" column="2">
+             <widget class="QDoubleSpinBox" name="safetyStopEndDepthDoubleSpinBox_3">
+              <property name="enabled">
+               <bool>false</bool>
               </property>
-              <property name="buddy">
-               <cstring>samplingRateComboBox</cstring>
+              <property name="suffix">
+               <string> m</string>
+              </property>
+              <property name="decimals">
+               <number>1</number>
+              </property>
+              <property name="minimum">
+               <double>2.500000000000000</double>
+              </property>
+              <property name="maximum">
+               <double>5.000000000000000</double>
+              </property>
+              <property name="value">
+               <double>2.900000000000000</double>
               </property>
              </widget>
             </item>
-            <item row="2" column="3">
-             <widget class="QLabel" name="label_42">
-              <property name="text">
-               <string>Date format</string>
+            <item row="9" column="2">
+             <widget class="QDoubleSpinBox" name="safetyStopResetDepthDoubleSpinBox_3">
+              <property name="enabled">
+               <bool>false</bool>
               </property>
-              <property name="buddy">
-               <cstring>dateFormatComboBox</cstring>
+              <property name="suffix">
+               <string> m</string>
+              </property>
+              <property name="decimals">
+               <number>1</number>
+              </property>
+              <property name="minimum">
+               <double>7.500000000000000</double>
+              </property>
+              <property name="maximum">
+               <double>20.100000000000001</double>
+              </property>
+              <property name="value">
+               <double>10.100000000000000</double>
               </property>
              </widget>
             </item>
@@ -2780,5 +3012,133 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>safetyStopCheckBox</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopLengthSpinBox</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</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopStartDepthDoubleSpinBox</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</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopEndDepthDoubleSpinBox</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</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopResetDepthDoubleSpinBox</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_3</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopLengthSpinBox_3</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_3</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopStartDepthDoubleSpinBox_3</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_3</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopEndDepthDoubleSpinBox_3</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_3</sender>
+   <signal>toggled(bool)</signal>
+   <receiver>safetyStopResetDepthDoubleSpinBox_3</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>
diff --git a/subsurface-core/configuredivecomputerthreads.cpp b/subsurface-core/configuredivecomputerthreads.cpp
index 7c5c7b9..53a8aa7 100644
--- a/subsurface-core/configuredivecomputerthreads.cpp
+++ b/subsurface-core/configuredivecomputerthreads.cpp
@@ -53,6 +53,10 @@
 #define OSTC3_GRAPHICAL_SPEED_INDICATOR	0x40
 #define OSTC3_ALWAYS_SHOW_PPO2		0x41
 #define OSTC3_TEMP_SENSOR_OFFSET	0x42
+#define OSTC3_SAFETY_STOP_LENGTH	0x43
+#define OSTC3_SAFETY_STOP_START_DEPTH	0x44
+#define OSTC3_SAFETY_STOP_END_DEPTH	0x45
+#define OSTC3_SAFETY_STOP_RESET_DEPTH	0x46
 
 #define OSTC3_HW_OSTC_3			0x0A
 #define OSTC3_HW_OSTC_3P		0x1A
@@ -407,7 +411,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
 	dc_status_t rc;
 	dc_event_progress_t progress;
 	progress.current = 0;
-	progress.maximum = 53;
+	progress.maximum = 57;
 	unsigned char hardware[1];
 
 	//Read hardware type
@@ -650,6 +654,10 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
 	READ_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate);
 	READ_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR, graphicalSpeedIndicator);
 	READ_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
+	READ_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength);
+	READ_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth);
+	READ_SETTING(OSTC3_SAFETY_STOP_END_DEPTH, safetyStopEndDepth);
+	READ_SETTING(OSTC3_SAFETY_STOP_RESET_DEPTH, safetyStopResetDepth);
 
 #undef READ_SETTING
 
@@ -913,6 +921,11 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
 	WRITE_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate);
 	WRITE_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR, graphicalSpeedIndicator);
 	WRITE_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
+	WRITE_SETTING(OSTC3_TEMP_SENSOR_OFFSET, tempSensorOffset);
+	WRITE_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength);
+	WRITE_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth);
+	WRITE_SETTING(OSTC3_SAFETY_STOP_END_DEPTH, safetyStopEndDepth);
+	WRITE_SETTING(OSTC3_SAFETY_STOP_RESET_DEPTH, safetyStopResetDepth);
 
 #undef WRITE_SETTING
 
@@ -1256,6 +1269,16 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi
 	m_deviceDetails->aGFHigh = read_ostc_cf(data, 68);
 	// CF69: Allow Gradient Factor change
 	m_deviceDetails->aGFSelectable = read_ostc_cf(data, 69);
+	// CF70: Safety Stop Duration [s]
+	m_deviceDetails->safetyStopLength = read_ostc_cf(data, 70);
+	// CF71: Safety Stop Start Depth [m]
+	m_deviceDetails->safetyStopStartDepth = read_ostc_cf(data, 71);
+	// CF72: Safety Stop End Depth [m]
+	m_deviceDetails->safetyStopEndDepth = read_ostc_cf(data, 72);
+	// CF73: Safety Stop Reset Depth [m]
+	m_deviceDetails->safetyStopResetDepth = read_ostc_cf(data, 73);
+	// CF74: Battery Timeout [min]
+
 #ifdef DEBUG_OSTC_CF
 	for (int cf = 64; cf <= 95 && cf <= max_CF; cf++)
 		printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
@@ -1557,6 +1580,16 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev
 	write_ostc_cf(data, 68, max_CF, m_deviceDetails->aGFHigh);
 	// CF69: Allow Gradient Factor change
 	write_ostc_cf(data, 69, max_CF, m_deviceDetails->aGFSelectable);
+	// CF70: Safety Stop Duration [s]
+	write_ostc_cf(data, 70, max_CF, m_deviceDetails->safetyStopLength);
+	// CF71: Safety Stop Start Depth [m]
+	write_ostc_cf(data, 71, max_CF, m_deviceDetails->safetyStopStartDepth);
+	// CF72: Safety Stop End Depth [m]
+	write_ostc_cf(data, 72, max_CF, m_deviceDetails->safetyStopEndDepth);
+	// CF73: Safety Stop Reset Depth [m]
+	write_ostc_cf(data, 73, max_CF, m_deviceDetails->safetyStopResetDepth);
+	// CF74: Battery Timeout [min]
+
 #ifdef DEBUG_OSTC_CF
 	for (int cf = 64; cf <= 95 && cf <= max_CF; cf++)
 		printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
diff --git a/subsurface-core/devicedetails.cpp b/subsurface-core/devicedetails.cpp
index e5c33e4..a2da0d5 100644
--- a/subsurface-core/devicedetails.cpp
+++ b/subsurface-core/devicedetails.cpp
@@ -74,6 +74,10 @@ DeviceDetails::DeviceDetails(QObject *parent) :
 	dynamicAscendRate(false),
 	graphicalSpeedIndicator(false),
 	alwaysShowppO2(false),
-	tempSensorOffset(0)
+	tempSensorOffset(0),
+	safetyStopLength(0),
+	safetyStopStartDepth(0),
+	safetyStopEndDepth(0),
+	safetyStopResetDepth(0)
 {
 }
diff --git a/subsurface-core/devicedetails.h b/subsurface-core/devicedetails.h
index 0d929c0..b5e59af 100644
--- a/subsurface-core/devicedetails.h
+++ b/subsurface-core/devicedetails.h
@@ -92,6 +92,10 @@ public:
 	bool graphicalSpeedIndicator;
 	bool alwaysShowppO2;
 	int tempSensorOffset;
+	unsigned safetyStopLength;
+	unsigned safetyStopStartDepth;
+	unsigned safetyStopEndDepth;
+	unsigned safetyStopResetDepth;
 };
 
 
-- 
2.5.0



More information about the subsurface mailing list