diff options
author | Anton Lundin <glance@acc.umu.se> | 2014-10-18 13:58:02 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-10-18 15:36:28 -0700 |
commit | 839bcaaf70b763590509031208b6786288910bc3 (patch) | |
tree | a99a9a483475718b1a6c2a9baefe0c9ce3309f6e /configuredivecomputerthreads.cpp | |
parent | 74f27a0a399a1f7c63d5542eec744102c301671f (diff) | |
download | subsurface-839bcaaf70b763590509031208b6786288910bc3.tar.gz |
Correct OSTC3 read/write of pressure sensor offset
The OSTC3 stores the pressure sensor offset as a signed 8-bit integer.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'configuredivecomputerthreads.cpp')
-rw-r--r-- | configuredivecomputerthreads.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp index a8465d7a4..70b6d1b6e 100644 --- a/configuredivecomputerthreads.cpp +++ b/configuredivecomputerthreads.cpp @@ -408,7 +408,6 @@ void ReadSettingsThread::run() READ_SETTING(OSTC3_SAFETY_STOP, setSafetyStop) READ_SETTING(OSTC3_GF_HIGH, setGfHigh) READ_SETTING(OSTC3_GF_LOW, setGfLow) - READ_SETTING(OSTC3_PRESSURE_SENSOR_OFFSET, setPressureSensorOffset) READ_SETTING(OSTC3_PPO2_MIN, setPpO2Min) READ_SETTING(OSTC3_PPO2_MAX, setPpO2Max) READ_SETTING(OSTC3_FUTURE_TTS, setFutureTTS) @@ -423,6 +422,12 @@ void ReadSettingsThread::run() #undef READ_SETTING + rc = hw_ostc3_device_config_read(m_data->device, OSTC3_PRESSURE_SENSOR_OFFSET, uData, sizeof(uData)); + if (rc == DC_STATUS_SUCCESS) { + // OSTC3 stores the pressureSensorOffset in two-complement + m_deviceDetails->setPressureSensorOffset((signed char) uData[0]); + } + //read firmware settings unsigned char fData[64] = {0}; rc = hw_ostc3_device_version (m_data->device, fData, sizeof (fData)); @@ -636,7 +641,6 @@ void WriteSettingsThread::run() WRITE_SETTING(OSTC3_SAFETY_STOP, safetyStop) WRITE_SETTING(OSTC3_GF_HIGH, gfHigh) WRITE_SETTING(OSTC3_GF_LOW, gfLow) - WRITE_SETTING(OSTC3_PRESSURE_SENSOR_OFFSET, pressureSensorOffset) WRITE_SETTING(OSTC3_PPO2_MIN, ppO2Min) WRITE_SETTING(OSTC3_PPO2_MAX, ppO2Max) WRITE_SETTING(OSTC3_FUTURE_TTS, futureTTS) @@ -651,6 +655,10 @@ void WriteSettingsThread::run() #undef WRITE_SETTING + // OSTC3 stores the pressureSensorOffset in two-complement + data[0] = (unsigned char) m_deviceDetails->pressureSensorOffset(); + hw_ostc3_device_config_write(m_data->device, OSTC3_PRESSURE_SENSOR_OFFSET, data, sizeof(data)); + //sync date and time if (m_deviceDetails->syncTime()) { QDateTime timeToSet = QDateTime::currentDateTime(); |