summaryrefslogtreecommitdiffstats
path: root/configuredivecomputerthreads.cpp
diff options
context:
space:
mode:
authorGravatar Joseph W. Joshua <joejoshw@gmail.com>2014-06-21 09:53:05 +0300
committerGravatar Thiago Macieira <thiago@macieira.org>2014-08-13 10:48:14 -0700
commit9c032f20c02fbb7c1e3906dbc8392539e0125327 (patch)
tree54488a541a58ce4fb7e426b96e6a7af67afc6da1 /configuredivecomputerthreads.cpp
parent65b0b8a64b5477cd7121699eea4c951a873c7a9f (diff)
downloadsubsurface-9c032f20c02fbb7c1e3906dbc8392539e0125327.tar.gz
Add reading and writing of OSTC 3 Dil values
Implements reading, writing and backup/restore of OSTC 3 Dil Values (setting 0x15 to 0x19) 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.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp
index ae57893dc..c20d58a0b 100644
--- a/configuredivecomputerthreads.cpp
+++ b/configuredivecomputerthreads.cpp
@@ -93,6 +93,65 @@ void ReadSettingsThread::run()
m_deviceDetails->setGas4(gas4);
m_deviceDetails->setGas5(gas5);
+ //Read Dil Values
+ gas dil1;
+ gas dil2;
+ gas dil3;
+ gas dil4;
+ gas dil5;
+ //Dil 1
+ unsigned char dilData[4] = {0,0,0,0};
+ rc = hw_ostc3_device_config_read(m_data->device, 0x15, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil1.depth = dilData[3];
+ dil1.oxygen = dilData[0];
+ dil1.helium = dilData[1];
+ dil1.type = dilData[2];
+ }
+ //Dil 2
+ rc = hw_ostc3_device_config_read(m_data->device, 0x16, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil2.depth = dilData[3];
+ dil2.oxygen = dilData[0];
+ dil2.helium = dilData[1];
+ dil2.type = dilData[2];
+ }
+ //Dil 3
+ rc = hw_ostc3_device_config_read(m_data->device, 0x17, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil3.depth = dilData[3];
+ dil3.oxygen = dilData[0];
+ dil3.helium = dilData[1];
+ dil3.type = dilData[2];
+ }
+ //Dil 4
+ rc = hw_ostc3_device_config_read(m_data->device, 0x18, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil4.depth = dilData[3];
+ dil4.oxygen = dilData[0];
+ dil4.helium = dilData[1];
+ dil4.type = dilData[2];
+ }
+ //Dil 5
+ rc = hw_ostc3_device_config_read(m_data->device, 0x19, dilData, sizeof(dilData));
+ if (rc == DC_STATUS_SUCCESS) {
+ //Data read successful
+ dil5.depth = dilData[3];
+ dil5.oxygen = dilData[0];
+ dil5.helium = dilData[1];
+ dil5.type = dilData[2];
+ }
+
+ m_deviceDetails->setDil1(dil1);
+ m_deviceDetails->setDil2(dil2);
+ m_deviceDetails->setDil3(dil3);
+ m_deviceDetails->setDil4(dil4);
+ m_deviceDetails->setDil5(dil5);
+
//Read other settings
unsigned char uData[1] = {0};
//DiveMode
@@ -221,6 +280,42 @@ void WriteSettingsThread::run()
//gas 5
hw_ostc3_device_config_write(m_data->device, 0x14, gas5Data, sizeof(gas5Data));
+ //write dil values
+ unsigned char dil1Data[4] = {m_deviceDetails->dil1().oxygen,
+ m_deviceDetails->dil1().helium,
+ m_deviceDetails->dil1().type,
+ m_deviceDetails->dil1().depth};
+
+ unsigned char dil2Data[4] = {m_deviceDetails->dil2().oxygen,
+ m_deviceDetails->dil2().helium,
+ m_deviceDetails->dil2().type,
+ m_deviceDetails->dil2().depth};
+
+ unsigned char dil3Data[4] = {m_deviceDetails->dil3().oxygen,
+ m_deviceDetails->dil3().helium,
+ m_deviceDetails->dil3().type,
+ m_deviceDetails->dil3().depth};
+
+ unsigned char dil4Data[4] = {m_deviceDetails->dil4().oxygen,
+ m_deviceDetails->dil4().helium,
+ m_deviceDetails->dil4().type,
+ m_deviceDetails->dil4().depth};
+
+ unsigned char dil5Data[4] = {m_deviceDetails->dil5().oxygen,
+ m_deviceDetails->dil5().helium,
+ m_deviceDetails->dil5().type,
+ m_deviceDetails->dil5().depth};
+ //dil 1
+ hw_ostc3_device_config_write(m_data->device, 0x15, dil1Data, sizeof(gas1Data));
+ //dil 2
+ hw_ostc3_device_config_write(m_data->device, 0x16, dil2Data, sizeof(dil2Data));
+ //dil 3
+ hw_ostc3_device_config_write(m_data->device, 0x17, dil3Data, sizeof(dil3Data));
+ //dil 4
+ hw_ostc3_device_config_write(m_data->device, 0x18, dil4Data, sizeof(dil4Data));
+ //dil 5
+ hw_ostc3_device_config_write(m_data->device, 0x19, dil5Data, sizeof(dil5Data));
+
//write general settings
//custom text