diff options
author | Joseph W. Joshua <joejoshw@gmail.com> | 2014-06-21 10:22:47 +0300 |
---|---|---|
committer | Thiago Macieira <thiago@macieira.org> | 2014-08-13 10:48:15 -0700 |
commit | 8aa7fddb22cd6ab4d533082598be04649bb1ff21 (patch) | |
tree | 041bf6c67978468389a65f45d83bde4ee1add6e9 /configuredivecomputerthreads.cpp | |
parent | 9c032f20c02fbb7c1e3906dbc8392539e0125327 (diff) | |
download | subsurface-8aa7fddb22cd6ab4d533082598be04649bb1ff21.tar.gz |
Add read/write support for OSTC 3 SetPoint settings
Implements support for reading, writing and backup/restore of set point
settings for the OSTC 3.
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.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp index c20d58a0b..66506affd 100644 --- a/configuredivecomputerthreads.cpp +++ b/configuredivecomputerthreads.cpp @@ -152,6 +152,52 @@ void ReadSettingsThread::run() m_deviceDetails->setDil4(dil4); m_deviceDetails->setDil5(dil5); + //Read set point Values + setpoint sp1; + setpoint sp2; + setpoint sp3; + setpoint sp4; + setpoint sp5; + + unsigned char spData[2] = {0,0}; + + //Sp 1 + rc = hw_ostc3_device_config_read(m_data->device, 0x1A, spData, sizeof(spData)); + if (rc == DC_STATUS_SUCCESS) { + //Data read successful + sp1.sp = dilData[0]; + sp1.depth = dilData[1]; + } + //Sp 2 + rc = hw_ostc3_device_config_read(m_data->device, 0x1B, spData, sizeof(spData)); + if (rc == DC_STATUS_SUCCESS) { + //Data read successful + sp2.sp = dilData[0]; + sp2.depth = dilData[1]; + } + //Sp 3 + rc = hw_ostc3_device_config_read(m_data->device, 0x1C, spData, sizeof(spData)); + if (rc == DC_STATUS_SUCCESS) { + //Data read successful + sp3.sp = dilData[0]; + sp3.depth = dilData[1]; + } + //Sp 4 + rc = hw_ostc3_device_config_read(m_data->device, 0x1D, spData, sizeof(spData)); + if (rc == DC_STATUS_SUCCESS) { + //Data read successful + sp4.sp = dilData[0]; + sp4.depth = dilData[1]; + } + //Sp 5 + rc = hw_ostc3_device_config_read(m_data->device, 0x1E, spData, sizeof(spData)); + if (rc == DC_STATUS_SUCCESS) { + //Data read successful + sp5.sp = dilData[0]; + sp5.depth = dilData[1]; + } + + //Read other settings unsigned char uData[1] = {0}; //DiveMode @@ -280,6 +326,33 @@ void WriteSettingsThread::run() //gas 5 hw_ostc3_device_config_write(m_data->device, 0x14, gas5Data, sizeof(gas5Data)); + //write set point values + unsigned char sp1Data[2] = {m_deviceDetails->sp1().sp, + m_deviceDetails->sp1().depth}; + + unsigned char sp2Data[2] = {m_deviceDetails->sp2().sp, + m_deviceDetails->sp2().depth}; + + unsigned char sp3Data[2] = {m_deviceDetails->sp3().sp, + m_deviceDetails->sp3().depth}; + + unsigned char sp4Data[2] = {m_deviceDetails->sp4().sp, + m_deviceDetails->sp4().depth}; + + unsigned char sp5Data[2] = {m_deviceDetails->sp5().sp, + m_deviceDetails->sp5().depth}; + + //sp 1 + hw_ostc3_device_config_write(m_data->device, 0x1A, sp1Data, sizeof(sp1Data)); + //sp 2 + hw_ostc3_device_config_write(m_data->device, 0x1B, sp2Data, sizeof(sp2Data)); + //sp 3 + hw_ostc3_device_config_write(m_data->device, 0x1C, sp3Data, sizeof(sp3Data)); + //sp 4 + hw_ostc3_device_config_write(m_data->device, 0x1D, sp4Data, sizeof(sp4Data)); + //sp 5 + hw_ostc3_device_config_write(m_data->device, 0x1E, sp5Data, sizeof(sp5Data)); + //write dil values unsigned char dil1Data[4] = {m_deviceDetails->dil1().oxygen, m_deviceDetails->dil1().helium, |