diff options
-rw-r--r-- | desktop-widgets/configuredivecomputerdialog.cpp | 2 | ||||
-rw-r--r-- | desktop-widgets/configuredivecomputerdialog.ui | 26 | ||||
-rw-r--r-- | subsurface-core/configuredivecomputerthreads.cpp | 19 | ||||
-rw-r--r-- | subsurface-core/devicedetails.cpp | 3 | ||||
-rw-r--r-- | subsurface-core/devicedetails.h | 1 |
5 files changed, 48 insertions, 3 deletions
diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp index ddb9450de..3fbb4327c 100644 --- a/desktop-widgets/configuredivecomputerdialog.cpp +++ b/desktop-widgets/configuredivecomputerdialog.cpp @@ -470,6 +470,7 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3() deviceDetails->dynamicAscendRate = ui.dynamicAscendRate->isChecked(); deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator->isChecked(); deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2->isChecked(); + deviceDetails->tempSensorOffset = ui.tempSensorOffsetDoubleSpinBox->value() * 10; //set gas values gas gas1; @@ -845,6 +846,7 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3() ui.dynamicAscendRate->setChecked(deviceDetails->dynamicAscendRate); ui.graphicalSpeedIndicator->setChecked(deviceDetails->graphicalSpeedIndicator); ui.alwaysShowppO2->setChecked(deviceDetails->alwaysShowppO2); + ui.tempSensorOffsetDoubleSpinBox->setValue((double)deviceDetails->tempSensorOffset / 10.0); //load gas 1 values ui.ostc3GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen))); diff --git a/desktop-widgets/configuredivecomputerdialog.ui b/desktop-widgets/configuredivecomputerdialog.ui index 0986d71ca..ac177a277 100644 --- a/desktop-widgets/configuredivecomputerdialog.ui +++ b/desktop-widgets/configuredivecomputerdialog.ui @@ -1043,6 +1043,32 @@ </property> </widget> </item> + <item row="14" column="3"> + <widget class="QLabel" name="label_71"> + <property name="text"> + <string>Temperature sensor offset</string> + </property> + </widget> + </item> + <item row="14" column="4"> + <widget class="QDoubleSpinBox" name="tempSensorOffsetDoubleSpinBox"> + <property name="suffix"> + <string>°C</string> + </property> + <property name="decimals"> + <number>1</number> + </property> + <property name="minimum"> + <double>-2.000000000000000</double> + </property> + <property name="maximum"> + <double>2.000000000000000</double> + </property> + <property name="singleStep"> + <double>0.100000000000000</double> + </property> + </widget> + </item> </layout> </widget> <widget class="QWidget" name="gasSettings"> diff --git a/subsurface-core/configuredivecomputerthreads.cpp b/subsurface-core/configuredivecomputerthreads.cpp index e681649e3..7c5c7b9d5 100644 --- a/subsurface-core/configuredivecomputerthreads.cpp +++ b/subsurface-core/configuredivecomputerthreads.cpp @@ -52,6 +52,7 @@ #define OSTC3_DYNAMIC_ASCEND_RATE 0x3F #define OSTC3_GRAPHICAL_SPEED_INDICATOR 0x40 #define OSTC3_ALWAYS_SHOW_PPO2 0x41 +#define OSTC3_TEMP_SENSOR_OFFSET 0x42 #define OSTC3_HW_OSTC_3 0x0A #define OSTC3_HW_OSTC_3P 0x1A @@ -406,7 +407,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev dc_status_t rc; dc_event_progress_t progress; progress.current = 0; - progress.maximum = 52; + progress.maximum = 53; unsigned char hardware[1]; //Read hardware type @@ -659,6 +660,13 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev m_deviceDetails->pressureSensorOffset = (signed char)uData[0]; EMIT_PROGRESS(); + rc = hw_ostc3_device_config_read(device, OSTC3_TEMP_SENSOR_OFFSET, uData, sizeof(uData)); + if (rc != DC_STATUS_SUCCESS) + return rc; + // OSTC3 stores the tempSensorOffset in two-complement + m_deviceDetails->tempSensorOffset = (signed char)uData[0]; + EMIT_PROGRESS(); + //read firmware settings unsigned char fData[64] = { 0 }; rc = hw_ostc3_device_version(device, fData, sizeof(fData)); @@ -679,7 +687,7 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de dc_status_t rc; dc_event_progress_t progress; progress.current = 0; - progress.maximum = 51; + progress.maximum = 56; //write gas values unsigned char gas1Data[4] = { @@ -915,6 +923,13 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de return rc; EMIT_PROGRESS(); + // OSTC3 stores the tempSensorOffset in two-complement + data[0] = (unsigned char)m_deviceDetails->pressureSensorOffset; + rc = hw_ostc3_device_config_write(device, OSTC3_TEMP_SENSOR_OFFSET, data, sizeof(data)); + if (rc != DC_STATUS_SUCCESS) + return rc; + EMIT_PROGRESS(); + //sync date and time if (m_deviceDetails->syncTime) { dc_datetime_t now; diff --git a/subsurface-core/devicedetails.cpp b/subsurface-core/devicedetails.cpp index 1ac56375d..e5c33e418 100644 --- a/subsurface-core/devicedetails.cpp +++ b/subsurface-core/devicedetails.cpp @@ -73,6 +73,7 @@ DeviceDetails::DeviceDetails(QObject *parent) : modWarning(false), dynamicAscendRate(false), graphicalSpeedIndicator(false), - alwaysShowppO2(false) + alwaysShowppO2(false), + tempSensorOffset(0) { } diff --git a/subsurface-core/devicedetails.h b/subsurface-core/devicedetails.h index 1ed9914ef..0d929c018 100644 --- a/subsurface-core/devicedetails.h +++ b/subsurface-core/devicedetails.h @@ -91,6 +91,7 @@ public: bool dynamicAscendRate; bool graphicalSpeedIndicator; bool alwaysShowppO2; + int tempSensorOffset; }; |