diff options
author | Joseph W. Joshua <joejoshw@gmail.com> | 2014-06-11 11:09:01 +0300 |
---|---|---|
committer | Thiago Macieira <thiago@macieira.org> | 2014-08-13 10:48:14 -0700 |
commit | 09ec8a44e5c48b6b6a2e4ebb1253fd3cd94154ae (patch) | |
tree | 8e446dedf7e8ee9ac3eca4ade11ec0ea46bce238 /qt-ui/configuredivecomputerthreads.cpp | |
parent | aad60ef6da3308960767a47cb750c2ba9aab54bd (diff) | |
download | subsurface-09ec8a44e5c48b6b6a2e4ebb1253fd3cd94154ae.tar.gz |
Add Support for more OSTC 3 Settings
Adds support for more OSTC 3 Settings to the reading, writing,
backup and restore functions. These settings are: last deco,
units, sampling rate, salinity, dive mode colour and compass
gain.
Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com>
Signed-off-by: Thiago Macieira <thiago@macieira.org>
Diffstat (limited to 'qt-ui/configuredivecomputerthreads.cpp')
-rw-r--r-- | qt-ui/configuredivecomputerthreads.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/qt-ui/configuredivecomputerthreads.cpp b/qt-ui/configuredivecomputerthreads.cpp index bddced474..369640459 100644 --- a/qt-ui/configuredivecomputerthreads.cpp +++ b/qt-ui/configuredivecomputerthreads.cpp @@ -27,18 +27,47 @@ void ReadSettingsThread::run() m_deviceDetails->setLanguage(0); m_deviceDetails->setLastDeco(0); m_deviceDetails->setSerialNo(""); + m_deviceDetails->setCompassGain(0); + m_deviceDetails->setSalinity(0); + m_deviceDetails->setSamplingRate(0); + m_deviceDetails->setUnits(0); + //Read general settings unsigned char uData[1] = {0}; + //LastDeco + rc = hw_ostc3_device_config_read(m_data->device, 0x2D, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) + m_deviceDetails->setLastDeco(uData[0]); + //Brightness rc = hw_ostc3_device_config_read(m_data->device, 0x2D, uData, sizeof(uData)); if (rc == DC_STATUS_SUCCESS) m_deviceDetails->setBrightness(uData[0]); + //Units + rc = hw_ostc3_device_config_read(m_data->device, 0x2E, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) + m_deviceDetails->setUnits(uData[0]); + //Sampling Rate + rc = hw_ostc3_device_config_read(m_data->device, 0x2F, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) + m_deviceDetails->setSamplingRate(uData[0]); + //Salinity + rc = hw_ostc3_device_config_read(m_data->device, 0x30, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) + m_deviceDetails->setSalinity(uData[0]); + //Dive mode colour + rc = hw_ostc3_device_config_read(m_data->device, 0x31, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) + m_deviceDetails->setDiveModeColor(uData[0]); + //Language rc = hw_ostc3_device_config_read(m_data->device, 0x32, uData, sizeof(uData)); if (rc == DC_STATUS_SUCCESS) m_deviceDetails->setLanguage(uData[0]); + //Date Format rc = hw_ostc3_device_config_read(m_data->device, 0x33, uData, sizeof(uData)); if (rc == DC_STATUS_SUCCESS) m_deviceDetails->setDateFormat(uData[0]); + //read firmware settings unsigned char fData[64] = {0}; rc = hw_ostc3_device_version (m_data->device, fData, sizeof (fData)); @@ -88,15 +117,47 @@ void WriteSettingsThread::run() case DC_FAMILY_HW_OSTC3: supported = true; //write general settings + + //custom text hw_ostc3_device_customtext(m_data->device, m_deviceDetails->customText().toUtf8().data()); unsigned char data[1] = {0}; + + //last deco + data[0] = m_deviceDetails->lastDeco(); + hw_ostc3_device_config_write(m_data->device, 0x2C, data, sizeof(data)); + + //brightness data[0] = m_deviceDetails->brightness(); hw_ostc3_device_config_write(m_data->device, 0x2D, data, sizeof(data)); + + //units + data[0] = m_deviceDetails->units(); + hw_ostc3_device_config_write(m_data->device, 0x2E, data, sizeof(data)); + + //sampling rate + data[0] = m_deviceDetails->samplingRate(); + hw_ostc3_device_config_write(m_data->device, 0x2F, data, sizeof(data)); + + //salinity + data[0] = m_deviceDetails->salinity(); + hw_ostc3_device_config_write(m_data->device, 0x30, data, sizeof(data)); + + //dive mode colour + data[0] = m_deviceDetails->diveModeColor(); + hw_ostc3_device_config_write(m_data->device, 0x31, data, sizeof(data)); + + //language data[0] = m_deviceDetails->language(); hw_ostc3_device_config_write(m_data->device, 0x32, data, sizeof(data)); + + //date format data[0] = m_deviceDetails->dateFormat(); hw_ostc3_device_config_write(m_data->device, 0x33, data, sizeof(data)); + //compass gain + data[0] = m_deviceDetails->compassGain(); + hw_ostc3_device_config_write(m_data->device, 0x34, data, sizeof(data)); + //sync date and time if (m_deviceDetails->syncTime()) { QDateTime timeToSet = QDateTime::currentDateTime(); |