summaryrefslogtreecommitdiffstats
path: root/configuredivecomputerthreads.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-21 08:46:57 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:14 -0700
commit8b39d2fc172b72ade19a754f33575f663573f147 (patch)
tree0ea0b0d3c21555db2983ff8ad8197973ee664655 /configuredivecomputerthreads.cpp
parent4f37602836ef1f6778fbf76cd20f0d017d5fe305 (diff)
downloadsubsurface-8b39d2fc172b72ade19a754f33575f663573f147.tar.gz
Read OSTC3 GasSetting Values
Implements the reading of OSTC3 Gas Settings. These are settings 0x10 to 0x14 Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'configuredivecomputerthreads.cpp')
-rw-r--r--configuredivecomputerthreads.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index 3afb11bc5..7ee015f3e 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -2,6 +2,7 @@
#include "libdivecomputer/hw.h"
#include <QDebug>
#include <QDateTime>
+#include <QStringList>
ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data)
: QThread(parent), m_data(data)
@@ -43,13 +44,48 @@ void ReadSettingsThread::run()
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;
+ //Gas data read successful
gas1.depth = gasData[3];
gas1.oxygen = gasData[0];
gas1.helium = gasData[1];
gas1.type = gasData[2];
}
+ //Gas 2
+ rc = hw_ostc3_device_config_read(m_data->device, 0x11, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas2.depth = gasData[3];
+ gas2.oxygen = gasData[0];
+ gas2.helium = gasData[1];
+ gas2.type = gasData[2];
+ }
+ //Gas 3
+ rc = hw_ostc3_device_config_read(m_data->device, 0x12, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas3.depth = gasData[3];
+ gas3.oxygen = gasData[0];
+ gas3.helium = gasData[1];
+ gas3.type = gasData[2];
+ }
+ //Gas 4
+ rc = hw_ostc3_device_config_read(m_data->device, 0x13, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas4.depth = gasData[3];
+ gas4.oxygen = gasData[0];
+ gas4.helium = gasData[1];
+ gas4.type = gasData[2];
+ }
+ //Gas 5
+ rc = hw_ostc3_device_config_read(m_data->device, 0x14, gasData, sizeof(gasData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Gas data read successful
+ gas5.depth = gasData[3];
+ gas5.oxygen = gasData[0];
+ gas5.helium = gasData[1];
+ gas5.type = gasData[2];
+ }
m_deviceDetails->setGas1(gas1);
m_deviceDetails->setGas2(gas2);
@@ -57,7 +93,7 @@ void ReadSettingsThread::run()
m_deviceDetails->setGas4(gas4);
m_deviceDetails->setGas5(gas5);
- //Read general settings
+ //Read other settings
unsigned char uData[1] = {0};
//DiveMode
rc = hw_ostc3_device_config_read(m_data->device, 0x20, uData, sizeof(uData));