[PATCH 2/5] Enable the configuration of more OSTC3 settings

Steve stevewilliams at internode.on.net
Fri Sep 4 00:05:42 PDT 2015


-----Original Message-----
From: subsurface [mailto:subsurface-bounces at subsurface-divelog.org] On Behalf Of Anton Lundin
Sent: Thursday, 3 September 2015 7:30 AM
To: Subsurface Mailing List <subsurface at subsurface-divelog.org>
Subject: [PATCH 2/5] Enable the configuration of more OSTC3 settings

This enables enables you to configure a couple of new settings in the
OSTC3 devices.


This is great, thanks. I will test it out later tonight.
Can work with the direct Bluetooth connection?

Steve


Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 configuredivecomputer.cpp             |  32 ++++
 configuredivecomputerthreads.cpp      |  24 +++
 devicedetails.cpp                     |  10 +-
 devicedetails.h                       |   8 +
 qt-ui/configuredivecomputerdialog.cpp |  16 ++  qt-ui/configuredivecomputerdialog.ui  | 330 +++++++++++++++++++++++-----------
 6 files changed, 314 insertions(+), 106 deletions(-)

diff --git a/configuredivecomputer.cpp b/configuredivecomputer.cpp index 0d61ff4..65cf3ce 100644
--- a/configuredivecomputer.cpp
+++ b/configuredivecomputer.cpp
@@ -182,6 +182,14 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
 	writer.writeTextElement("CalibrationGas", QString::number(details->calibrationGas));
 	writer.writeTextElement("FlipScreen", QString::number(details->flipScreen));
 	writer.writeTextElement("SetPointFallback", QString::number(details->setPointFallback));
+	writer.writeTextElement("LeftButtonSensitivity", QString::number(details->leftButtonSensitivity));
+	writer.writeTextElement("RightButtonSensitivity", QString::number(details->rightButtonSensitivity));
+	writer.writeTextElement("BottomGasConsumption", QString::number(details->bottomGasConsumption));
+	writer.writeTextElement("DecoGasConsumption", QString::number(details->decoGasConsumption));
+	writer.writeTextElement("ModWarning", QString::number(details->modWarning));
+	writer.writeTextElement("DynamicAscendRate", QString::number(details->dynamicAscendRate));
+	writer.writeTextElement("GraphicalSpeedIndicator", QString::number(details->graphicalSpeedIndicator));
+	writer.writeTextElement("AlwaysShowppO2", 
+QString::number(details->alwaysShowppO2));
 
 	// Suunto vyper settings.
 	writer.writeTextElement("Altitude", QString::number(details->altitude));
@@ -463,6 +471,30 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
 			if (settingName == "SetPointFallback")
 				details->setPointFallback = keyString.toInt();
 
+			if (settingName == "LeftButtonSensitivity")
+				details->leftButtonSensitivity = keyString.toInt();
+
+			if (settingName == "RightButtonSensitivity")
+				details->rightButtonSensitivity = keyString.toInt();
+
+			if (settingName == "BottomGasConsumption")
+				details->bottomGasConsumption = keyString.toInt();
+
+			if (settingName == "DecoGasConsumption")
+				details->decoGasConsumption = keyString.toInt();
+
+			if (settingName == "ModWarning")
+				details->modWarning = keyString.toInt();
+
+			if (settingName == "DynamicAscendRate")
+				details->dynamicAscendRate = keyString.toInt();
+
+			if (settingName == "GraphicalSpeedIndicator")
+				details->graphicalSpeedIndicator = keyString.toInt();
+
+			if (settingName == "AlwaysShowppO2")
+				details->alwaysShowppO2 = keyString.toInt();
+
 			if (settingName == "Altitude")
 				details->altitude = keyString.toInt();
 
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index cbd81c8..0941d25 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -46,6 +46,14 @@
 #define OSTC3_CALIBRATION_GAS_O2	0x37
 #define OSTC3_SETPOINT_FALLBACK	0x38
 #define OSTC3_FLIP_SCREEN	0x39
+#define OSTC3_LEFT_BUTTON_SENSIVITY	0x3A
+#define OSTC3_RIGHT_BUTTON_SENSIVITY	0x3A
+#define OSTC3_BOTTOM_GAS_CONSUMPTION	0x3C
+#define OSTC3_DECO_GAS_CONSUMPTION	0x3D
+#define OSTC3_MOD_WARNING		0x3E
+#define OSTC3_DYNAMIC_ASCEND_RATE	0x3F
+#define OSTC3_GRAPHICAL_SPEED_INDICATOR	0x40
+#define OSTC3_ALWAYS_SHOW_PPO2		0x41
 
 #define SUUNTO_VYPER_MAXDEPTH             0x1e
 #define SUUNTO_VYPER_TOTAL_TIME           0x20
@@ -582,6 +590,14 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
 	READ_SETTING(OSTC3_CALIBRATION_GAS_O2, calibrationGas);
 	READ_SETTING(OSTC3_FLIP_SCREEN, flipScreen);
 	READ_SETTING(OSTC3_SETPOINT_FALLBACK, setPointFallback);
+	READ_SETTING(OSTC3_LEFT_BUTTON_SENSIVITY, leftButtonSensitivity);
+	READ_SETTING(OSTC3_RIGHT_BUTTON_SENSIVITY, rightButtonSensitivity);
+	READ_SETTING(OSTC3_BOTTOM_GAS_CONSUMPTION, bottomGasConsumption);
+	READ_SETTING(OSTC3_DECO_GAS_CONSUMPTION, decoGasConsumption);
+	READ_SETTING(OSTC3_MOD_WARNING, modWarning);
+	READ_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate);
+	READ_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR, graphicalSpeedIndicator);
+	READ_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
 
 #undef READ_SETTING
 
@@ -808,6 +824,14 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
 	WRITE_SETTING(OSTC3_CALIBRATION_GAS_O2, calibrationGas);
 	WRITE_SETTING(OSTC3_FLIP_SCREEN, flipScreen);
 	WRITE_SETTING(OSTC3_SETPOINT_FALLBACK, setPointFallback);
+	WRITE_SETTING(OSTC3_LEFT_BUTTON_SENSIVITY, leftButtonSensitivity);
+	WRITE_SETTING(OSTC3_RIGHT_BUTTON_SENSIVITY, rightButtonSensitivity);
+	WRITE_SETTING(OSTC3_BOTTOM_GAS_CONSUMPTION, bottomGasConsumption);
+	WRITE_SETTING(OSTC3_DECO_GAS_CONSUMPTION, decoGasConsumption);
+	WRITE_SETTING(OSTC3_MOD_WARNING, modWarning);
+	WRITE_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate);
+	WRITE_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR, graphicalSpeedIndicator);
+	WRITE_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2);
 
 #undef WRITE_SETTING
 
diff --git a/devicedetails.cpp b/devicedetails.cpp index 458491e..1ac5637 100644
--- a/devicedetails.cpp
+++ b/devicedetails.cpp
@@ -65,6 +65,14 @@ DeviceDetails::DeviceDetails(QObject *parent) :
 	alarmTimeEnabled(false),
 	alarmTime(0),
 	alarmDepthEnabled(false),
-	alarmDepth(0)
+	alarmDepth(0),
+	leftButtonSensitivity(0),
+	rightButtonSensitivity(0),
+	bottomGasConsumption(0),
+	decoGasConsumption(0),
+	modWarning(false),
+	dynamicAscendRate(false),
+	graphicalSpeedIndicator(false),
+	alwaysShowppO2(false)
 {
 }
diff --git a/devicedetails.h b/devicedetails.h index 48d7283..1ed9914 100644
--- a/devicedetails.h
+++ b/devicedetails.h
@@ -83,6 +83,14 @@ public:
 	int alarmTime;
 	bool alarmDepthEnabled;
 	int alarmDepth;
+	int leftButtonSensitivity;
+	int rightButtonSensitivity;
+	int bottomGasConsumption;
+	int decoGasConsumption;
+	bool modWarning;
+	bool dynamicAscendRate;
+	bool graphicalSpeedIndicator;
+	bool alwaysShowppO2;
 };
 
 
diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp
index 0ac8ff7..6e01202 100644
--- a/qt-ui/configuredivecomputerdialog.cpp
+++ b/qt-ui/configuredivecomputerdialog.cpp
@@ -432,6 +432,14 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
 	deviceDetails->calibrationGas = ui.calibrationGasSpinBox->value();
 	deviceDetails->flipScreen = ui.flipScreenCheckBox->isChecked();
 	deviceDetails->setPointFallback = ui.setPointFallbackCheckBox->isChecked();
+	deviceDetails->leftButtonSensitivity = ui.leftButtonSensitivity->value();
+	deviceDetails->rightButtonSensitivity = ui.rightButtonSensitivity->value();
+	deviceDetails->bottomGasConsumption = ui.bottomGasConsumption->value();
+	deviceDetails->decoGasConsumption = ui.decoGasConsumption->value();
+	deviceDetails->modWarning = ui.modWarning->isChecked();
+	deviceDetails->dynamicAscendRate = ui.dynamicAscendRate->isChecked();
+	deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator->isChecked();
+	deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2->isChecked();
 
 	//set gas values
 	gas gas1;
@@ -796,6 +804,14 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3()
 	ui.calibrationGasSpinBox->setValue(deviceDetails->calibrationGas);
 	ui.flipScreenCheckBox->setChecked(deviceDetails->flipScreen);
 	ui.setPointFallbackCheckBox->setChecked(deviceDetails->setPointFallback);
+	ui.leftButtonSensitivity->setValue(deviceDetails->leftButtonSensitivity);
+	ui.rightButtonSensitivity->setValue(deviceDetails->rightButtonSensitivity);
+	ui.bottomGasConsumption->setValue(deviceDetails->bottomGasConsumption);
+	ui.decoGasConsumption->setValue(deviceDetails->decoGasConsumption);
+	ui.modWarning->setChecked(deviceDetails->modWarning);
+	ui.dynamicAscendRate->setChecked(deviceDetails->dynamicAscendRate);
+	ui.graphicalSpeedIndicator->setChecked(deviceDetails->graphicalSpeedIndicator);
+	ui.alwaysShowppO2->setChecked(deviceDetails->alwaysShowppO2);
 
 	//load gas 1 values
 	ui.ostc3GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen)));
diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui
index 22450f2..d5381cb 100644
--- a/qt-ui/configuredivecomputerdialog.ui
+++ b/qt-ui/configuredivecomputerdialog.ui
@@ -224,6 +224,44 @@
             <string>Basic settings</string>
            </attribute>
            <layout class="QGridLayout" name="gridLayout">
+            <item row="1" column="4">
+             <widget class="QComboBox" name="languageComboBox">
+              <item>
+               <property name="text">
+                <string>English</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>German</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>French</string>
+               </property>
+              </item>
+              <item>
+               <property name="text">
+                <string>Italian</string>
+               </property>
+              </item>
+             </widget>
+            </item>
+            <item row="5" column="4">
+             <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="0" column="0">
              <widget class="QLabel" name="label_2">
               <property name="text">
@@ -297,26 +335,26 @@
               </property>
              </widget>
             </item>
-            <item row="1" column="4">
-             <widget class="QComboBox" name="languageComboBox">
+            <item row="2" column="1">
+             <widget class="QComboBox" name="diveModeComboBox">
               <item>
                <property name="text">
-                <string>English</string>
+                <string>OC</string>
                </property>
               </item>
               <item>
                <property name="text">
-                <string>German</string>
+                <string>CC</string>
                </property>
               </item>
               <item>
                <property name="text">
-                <string>French</string>
+                <string>Gauge</string>
                </property>
               </item>
               <item>
                <property name="text">
-                <string>Italian</string>
+                <string>Apnea</string>
                </property>
               </item>
              </widget>
@@ -331,26 +369,21 @@
               </property>
              </widget>
             </item>
-            <item row="2" column="1">
-             <widget class="QComboBox" name="diveModeComboBox">
-              <item>
-               <property name="text">
-                <string>OC</string>
-               </property>
-              </item>
+            <item row="2" column="4">
+             <widget class="QComboBox" name="dateFormatComboBox">
               <item>
                <property name="text">
-                <string>CC</string>
+                <string>MMDDYY</string>
                </property>
               </item>
               <item>
                <property name="text">
-                <string>Gauge</string>
+                <string>DDMMYY</string>
                </property>
               </item>
               <item>
                <property name="text">
-                <string>Apnea</string>
+                <string>YYMMDD</string>
                </property>
               </item>
              </widget>
@@ -365,21 +398,21 @@
               </property>
              </widget>
             </item>
-            <item row="2" column="4">
-             <widget class="QComboBox" name="dateFormatComboBox">
+            <item row="4" column="4">
+             <widget class="QComboBox" name="brightnessComboBox">
               <item>
                <property name="text">
-                <string>MMDDYY</string>
+                <string>Eco</string>
                </property>
               </item>
               <item>
                <property name="text">
-                <string>DDMMYY</string>
+                <string>Medium</string>
                </property>
               </item>
               <item>
                <property name="text">
-                <string>YYMMDD</string>
+                <string>High</string>
                </property>
               </item>
              </widget>
@@ -394,25 +427,6 @@
               </property>
              </widget>
             </item>
-            <item row="4" 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="5" column="3">
              <widget class="QLabel" name="label_12">
               <property name="text">
@@ -423,20 +437,6 @@
               </property>
              </widget>
             </item>
-            <item row="5" column="4">
-             <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="6" column="3">
              <widget class="QLabel" name="label_14">
               <property name="text">
@@ -457,14 +457,18 @@
               </property>
              </widget>
             </item>
-            <item row="7" column="3">
-             <widget class="QLabel" name="label_15">
-              <property name="text">
-               <string>Compass gain</string>
-              </property>
-              <property name="buddy">
-               <cstring>compassGainComboBox</cstring>
-              </property>
+            <item row="4" 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="4">
@@ -540,30 +544,6 @@
               </property>
              </widget>
             </item>
-            <item row="4" 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="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="5" column="1">
              <widget class="QComboBox" name="diveModeColour">
               <item>
@@ -595,6 +575,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">
@@ -612,6 +602,16 @@
               </property>
              </widget>
             </item>
+            <item row="7" column="3">
+             <widget class="QLabel" name="label_15">
+              <property name="text">
+               <string>Compass gain</string>
+              </property>
+              <property name="buddy">
+               <cstring>compassGainComboBox</cstring>
+              </property>
+             </widget>
+            </item>
            </layout>
           </widget>
           <widget class="QWidget" name="advancedSettings"> @@ -619,6 +619,20 @@
             <string>Advanced settings</string>
            </attribute>
            <layout class="QGridLayout" name="gridLayout1">
+            <item row="10" column="3">
+             <widget class="QLabel" name="label_43">
+              <property name="text">
+               <string>Left button sensitivity</string>
+              </property>
+             </widget>
+            </item>
+            <item row="11" column="0" colspan="2">
+             <widget class="QCheckBox" name="alwaysShowppO2">
+              <property name="text">
+               <string>Always show ppO2</string>
+              </property>
+             </widget>
+            </item>
             <item row="3" column="0" colspan="2">
              <widget class="QCheckBox" name="aGFSelectableCheckBox">
               <property name="text">
@@ -712,7 +726,7 @@
               </property>
              </widget>
             </item>
-            <item row="13" column="0">
+            <item row="14" column="0">
              <spacer name="verticalSpacer_4">
               <property name="orientation">
                <enum>Qt::Vertical</enum> @@ -777,16 +791,6 @@
               </property>
              </widget>
             </item>
-            <item row="1" column="1">
-             <widget class="QSpinBox" name="futureTTSSpinBox">
-              <property name="suffix">
-               <string> min</string>
-              </property>
-              <property name="maximum">
-               <number>9</number>
-              </property>
-             </widget>
-            </item>
             <item row="0" column="1">
              <widget class="QComboBox" name="decoTypeComboBox">
               <property name="currentIndex"> @@ -804,6 +808,16 @@
               </item>
              </widget>
             </item>
+            <item row="1" column="1">
+             <widget class="QSpinBox" name="futureTTSSpinBox">
+              <property name="suffix">
+               <string> min</string>
+              </property>
+              <property name="maximum">
+               <number>9</number>
+              </property>
+             </widget>
+            </item>
             <item row="2" column="0">
              <widget class="QLabel" name="label_9">
               <property name="text">
@@ -830,6 +844,13 @@
               </property>
              </widget>
             </item>
+            <item row="3" column="3">
+             <widget class="QLabel" name="label_36">
+              <property name="text">
+               <string>Alt GFLow</string>
+              </property>
+             </widget>
+            </item>
             <item row="6" column="4">
              <widget class="QSpinBox" name="aGFHighSpinBox">
               <property name="enabled"> @@ -849,6 +870,13 @@
               </property>
              </widget>
             </item>
+            <item row="6" column="3">
+             <widget class="QLabel" name="label_37">
+              <property name="text">
+               <string>Alt GFHigh</string>
+              </property>
+             </widget>
+            </item>
             <item row="8" column="3">
              <widget class="QLabel" name="label_7">
               <property name="text">
@@ -859,24 +887,116 @@
               </property>
              </widget>
             </item>
-            <item row="3" column="3">
-             <widget class="QLabel" name="label_36">
+            <item row="6" column="0">
+             <widget class="QCheckBox" name="flipScreenCheckBox">
               <property name="text">
-               <string>Alt GFLow</string>
+               <string>Flip screen</string>
               </property>
              </widget>
             </item>
-            <item row="6" column="3">
-             <widget class="QLabel" name="label_37">
+            <item row="11" column="3">
+             <widget class="QLabel" name="label_44">
               <property name="text">
-               <string>Alt GFHigh</string>
+               <string>Right button sensitivity</string>
               </property>
              </widget>
             </item>
             <item row="8" column="0">
-             <widget class="QCheckBox" name="flipScreenCheckBox">
+             <widget class="QCheckBox" name="modWarning">
               <property name="text">
-               <string>Flip screen</string>
+               <string>Mod warning</string>
+              </property>
+             </widget>
+            </item>
+            <item row="10" column="0" colspan="2">
+             <widget class="QCheckBox" name="graphicalSpeedIndicator">
+              <property name="text">
+               <string>Graphical speed indicator</string>
+              </property>
+             </widget>
+            </item>
+            <item row="9" column="0" colspan="2">
+             <widget class="QCheckBox" name="dynamicAscendRate">
+              <property name="text">
+               <string>Dynamic acend rate</string>
+              </property>
+             </widget>
+            </item>
+            <item row="12" column="3">
+             <widget class="QLabel" name="label_46">
+              <property name="text">
+               <string>Bottom gas consumption</string>
+              </property>
+             </widget>
+            </item>
+            <item row="13" column="3">
+             <widget class="QLabel" name="label_48">
+              <property name="text">
+               <string>Deco gas consumption</string>
+              </property>
+             </widget>
+            </item>
+            <item row="10" column="4">
+             <widget class="QSpinBox" name="leftButtonSensitivity">
+              <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">
+              <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">
+              <property name="suffix">
+               <string> l/m</string>
+              </property>
+              <property name="minimum">
+               <number>5</number>
+              </property>
+              <property name="maximum">
+               <number>50</number>
+              </property>
+              <property name="value">
+               <number>20</number>
+              </property>
+             </widget>
+            </item>
+            <item row="13" column="4">
+             <widget class="QSpinBox" name="decoGasConsumption">
+              <property name="suffix">
+               <string> l/m</string>
+              </property>
+              <property name="minimum">
+               <number>5</number>
+              </property>
+              <property name="maximum">
+               <number>50</number>
+              </property>
+              <property name="value">
+               <number>20</number>
               </property>
              </widget>
             </item>
--
2.1.4

_______________________________________________
subsurface mailing list
subsurface at subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface



More information about the subsurface mailing list