From 451293f1a08b34c056d0db16b9050c1b7e4df295 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Fri, 22 Jan 2016 14:17:50 +0100 Subject: [PATCH] configure OSTC/OSTC3: Add safety stop parameters This adds the configure parameters for safety stops on the hwOS(OSTC3) and OSTC computers. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- .../configuredivecomputerdialog.cpp | 16 + .../configuredivecomputerdialog.ui | 734 +++++++++++++----- .../configuredivecomputerthreads.cpp | 35 +- subsurface-core/devicedetails.cpp | 6 +- subsurface-core/devicedetails.h | 4 + 5 files changed, 606 insertions(+), 189 deletions(-) diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp index 3fbb4327c..8df184788 100644 --- a/desktop-widgets/configuredivecomputerdialog.cpp +++ b/desktop-widgets/configuredivecomputerdialog.cpp @@ -471,6 +471,10 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3() deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator->isChecked(); deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2->isChecked(); deviceDetails->tempSensorOffset = ui.tempSensorOffsetDoubleSpinBox->value() * 10; + deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox->value(); + deviceDetails->safetyStopStartDepth = ui.safetyStopStartDepthDoubleSpinBox->value(); + deviceDetails->safetyStopEndDepth = ui.safetyStopEndDepthDoubleSpinBox->value(); + deviceDetails->safetyStopResetDepth = ui.safetyStopResetDepthDoubleSpinBox->value(); //set gas values gas gas1; @@ -600,6 +604,10 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC() deviceDetails->bottomGasConsumption = ui.bottomGasConsumption_3->value(); deviceDetails->decoGasConsumption = ui.decoGasConsumption_3->value(); deviceDetails->graphicalSpeedIndicator = ui.graphicalSpeedIndicator_3->isChecked(); + deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox_3->value(); + deviceDetails->safetyStopStartDepth = ui.safetyStopStartDepthDoubleSpinBox_3->value(); + deviceDetails->safetyStopEndDepth = ui.safetyStopEndDepthDoubleSpinBox_3->value(); + deviceDetails->safetyStopResetDepth = ui.safetyStopResetDepthDoubleSpinBox_3->value(); //set gas values gas gas1; @@ -847,6 +855,10 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3() ui.graphicalSpeedIndicator->setChecked(deviceDetails->graphicalSpeedIndicator); ui.alwaysShowppO2->setChecked(deviceDetails->alwaysShowppO2); ui.tempSensorOffsetDoubleSpinBox->setValue((double)deviceDetails->tempSensorOffset / 10.0); + ui.safetyStopLengthSpinBox->setValue(deviceDetails->safetyStopLength); + ui.safetyStopStartDepthDoubleSpinBox->setValue(deviceDetails->safetyStopStartDepth); + ui.safetyStopEndDepthDoubleSpinBox->setValue(deviceDetails->safetyStopEndDepth); + ui.safetyStopResetDepthDoubleSpinBox->setValue(deviceDetails->safetyStopResetDepth); //load gas 1 values ui.ostc3GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen))); @@ -970,6 +982,10 @@ setNumberOfDives ui.bottomGasConsumption_3->setValue(deviceDetails->bottomGasConsumption); ui.decoGasConsumption_3->setValue(deviceDetails->decoGasConsumption); ui.graphicalSpeedIndicator_3->setChecked(deviceDetails->graphicalSpeedIndicator); + ui.safetyStopLengthSpinBox_3->setValue(deviceDetails->safetyStopLength); + ui.safetyStopStartDepthDoubleSpinBox_3->setValue(deviceDetails->safetyStopStartDepth); + ui.safetyStopEndDepthDoubleSpinBox_3->setValue(deviceDetails->safetyStopEndDepth); + ui.safetyStopResetDepthDoubleSpinBox_3->setValue(deviceDetails->safetyStopResetDepth); //load gas 1 values ui.ostcGasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1.oxygen))); diff --git a/desktop-widgets/configuredivecomputerdialog.ui b/desktop-widgets/configuredivecomputerdialog.ui index ac177a277..a37b5ec39 100644 --- a/desktop-widgets/configuredivecomputerdialog.ui +++ b/desktop-widgets/configuredivecomputerdialog.ui @@ -253,6 +253,35 @@ Basic settings + + + + + Eco + + + + + Medium + + + + + High + + + + + + + + % + + + 5 + + + @@ -324,23 +353,6 @@ - - - - true - - - - - - - Language - - - languageComboBox - - - @@ -360,23 +372,21 @@ - - - - - Eco - - - - - Medium - - - - - High - - + + + + true + + + + + + + Language + + + languageComboBox + @@ -419,13 +429,13 @@ - - - - % + + + + false - - 5 + + Reset device to default settings @@ -479,7 +489,7 @@ - + Qt::Vertical @@ -492,36 +502,6 @@ - - - - false - - - Reset device to default settings - - - - - - - Compass gain - - - compassGainComboBox - - - - - - - Custom text - - - customTextLlineEdit - - - @@ -535,6 +515,16 @@ + + + + Compass gain + + + compassGainComboBox + + + @@ -542,6 +532,16 @@ + + + + Custom text + + + customTextLlineEdit + + + @@ -549,16 +549,6 @@ - - - - Dive mode - - - diveModeComboBox - - - @@ -583,13 +573,13 @@ - - + + - Sampling rate + Dive mode - samplingRateComboBox + diveModeComboBox @@ -607,13 +597,13 @@ - - + + - Dive mode color + Sampling rate - diveModeColour + samplingRateComboBox @@ -648,6 +638,16 @@ + + + + Dive mode color + + + diveModeColour + + + @@ -655,6 +655,122 @@ + + + + End Depth + + + + + + + false + + + s + + + 60 + + + 240 + + + 180 + + + + + + + Length + + + + + + + Start Depth + + + + + + + Reset Depth + + + + + + + false + + + m + + + 1 + + + 2.100000000000000 + + + 6.100000000000000 + + + 0.100000000000000 + + + 5.100000000000000 + + + + + + + false + + + m + + + 1 + + + 1.900000000000000 + + + 3.000000000000000 + + + 2.900000000000000 + + + + + + + false + + + m + + + 1 + + + 8.100000000000000 + + + 15.100000000000000 + + + 10.100000000000000 + + + @@ -1821,17 +1937,7 @@ Basic settings - - - - Salinity - - - salinitySpinBox - - - - + Serial No. @@ -1841,7 +1947,21 @@ - + + + + Length + + + + + + + true + + + + @@ -1854,7 +1974,7 @@ - + Firmware version @@ -1864,14 +1984,7 @@ - - - - true - - - - + Custom text @@ -1881,7 +1994,7 @@ - + @@ -1894,83 +2007,38 @@ - - - - kg/ℓ - - - 1.000000000000000 - - - 1.040000000000000 - - - 0.010000000000000 - - - - - - - Qt::Vertical - - - - 20 - 177 - - - - - - - - Sync dive computer time with PC - - - - - - - Show safety stop - - - - - - - - MM/DD/YY - - - - - DD/MM/YY - - - - - YY/MM/DD - - - - - + Number of dives - + + + + Show safety stop + + + + true - + + + + Sampling rate + + + samplingRateComboBox + + + + @@ -1989,17 +2057,7 @@ - - - - Sampling rate - - - samplingRateComboBox - - - - + Date format @@ -2009,6 +2067,180 @@ + + + + + MM/DD/YY + + + + + DD/MM/YY + + + + + YY/MM/DD + + + + + + + + Sync dive computer time with PC + + + + + + + Salinity + + + salinitySpinBox + + + + + + + kg/ℓ + + + 1.000000000000000 + + + 1.040000000000000 + + + 0.010000000000000 + + + + + + + Qt::Vertical + + + + 20 + 177 + + + + + + + + Start Depth + + + + + + + End Depth + + + + + + + Reset Depth + + + + + + + false + + + s + + + 10 + + + 250 + + + 180 + + + + + + + false + + + m + + + 1 + + + 3.000000000000000 + + + 6.500000000000000 + + + 0.100000000000000 + + + 5.100000000000000 + + + + + + + false + + + m + + + 1 + + + 2.500000000000000 + + + 5.000000000000000 + + + 2.900000000000000 + + + + + + + false + + + m + + + 1 + + + 7.500000000000000 + + + 20.100000000000001 + + + 10.100000000000000 + + + @@ -2780,5 +3012,133 @@ + + safetyStopCheckBox + toggled(bool) + safetyStopLengthSpinBox + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + safetyStopCheckBox + toggled(bool) + safetyStopStartDepthDoubleSpinBox + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + safetyStopCheckBox + toggled(bool) + safetyStopEndDepthDoubleSpinBox + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + safetyStopCheckBox + toggled(bool) + safetyStopResetDepthDoubleSpinBox + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + safetyStopCheckBox_3 + toggled(bool) + safetyStopLengthSpinBox_3 + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + safetyStopCheckBox_3 + toggled(bool) + safetyStopStartDepthDoubleSpinBox_3 + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + safetyStopCheckBox_3 + toggled(bool) + safetyStopEndDepthDoubleSpinBox_3 + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + + + safetyStopCheckBox_3 + toggled(bool) + safetyStopResetDepthDoubleSpinBox_3 + setEnabled(bool) + + + 20 + 20 + + + 20 + 20 + + + diff --git a/subsurface-core/configuredivecomputerthreads.cpp b/subsurface-core/configuredivecomputerthreads.cpp index 7c5c7b9d5..53a8aa7f1 100644 --- a/subsurface-core/configuredivecomputerthreads.cpp +++ b/subsurface-core/configuredivecomputerthreads.cpp @@ -53,6 +53,10 @@ #define OSTC3_GRAPHICAL_SPEED_INDICATOR 0x40 #define OSTC3_ALWAYS_SHOW_PPO2 0x41 #define OSTC3_TEMP_SENSOR_OFFSET 0x42 +#define OSTC3_SAFETY_STOP_LENGTH 0x43 +#define OSTC3_SAFETY_STOP_START_DEPTH 0x44 +#define OSTC3_SAFETY_STOP_END_DEPTH 0x45 +#define OSTC3_SAFETY_STOP_RESET_DEPTH 0x46 #define OSTC3_HW_OSTC_3 0x0A #define OSTC3_HW_OSTC_3P 0x1A @@ -407,7 +411,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 = 53; + progress.maximum = 57; unsigned char hardware[1]; //Read hardware type @@ -650,6 +654,10 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev READ_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate); READ_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR, graphicalSpeedIndicator); READ_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2); + READ_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength); + READ_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth); + READ_SETTING(OSTC3_SAFETY_STOP_END_DEPTH, safetyStopEndDepth); + READ_SETTING(OSTC3_SAFETY_STOP_RESET_DEPTH, safetyStopResetDepth); #undef READ_SETTING @@ -913,6 +921,11 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de WRITE_SETTING(OSTC3_DYNAMIC_ASCEND_RATE, dynamicAscendRate); WRITE_SETTING(OSTC3_GRAPHICAL_SPEED_INDICATOR, graphicalSpeedIndicator); WRITE_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2); + WRITE_SETTING(OSTC3_TEMP_SENSOR_OFFSET, tempSensorOffset); + WRITE_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength); + WRITE_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth); + WRITE_SETTING(OSTC3_SAFETY_STOP_END_DEPTH, safetyStopEndDepth); + WRITE_SETTING(OSTC3_SAFETY_STOP_RESET_DEPTH, safetyStopResetDepth); #undef WRITE_SETTING @@ -1256,6 +1269,16 @@ static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_devi m_deviceDetails->aGFHigh = read_ostc_cf(data, 68); // CF69: Allow Gradient Factor change m_deviceDetails->aGFSelectable = read_ostc_cf(data, 69); + // CF70: Safety Stop Duration [s] + m_deviceDetails->safetyStopLength = read_ostc_cf(data, 70); + // CF71: Safety Stop Start Depth [m] + m_deviceDetails->safetyStopStartDepth = read_ostc_cf(data, 71); + // CF72: Safety Stop End Depth [m] + m_deviceDetails->safetyStopEndDepth = read_ostc_cf(data, 72); + // CF73: Safety Stop Reset Depth [m] + m_deviceDetails->safetyStopResetDepth = read_ostc_cf(data, 73); + // CF74: Battery Timeout [min] + #ifdef DEBUG_OSTC_CF for (int cf = 64; cf <= 95 && cf <= max_CF; cf++) printf("CF %d: %d\n", cf, read_ostc_cf(data, cf)); @@ -1557,6 +1580,16 @@ static dc_status_t write_ostc_settings(dc_device_t *device, DeviceDetails *m_dev write_ostc_cf(data, 68, max_CF, m_deviceDetails->aGFHigh); // CF69: Allow Gradient Factor change write_ostc_cf(data, 69, max_CF, m_deviceDetails->aGFSelectable); + // CF70: Safety Stop Duration [s] + write_ostc_cf(data, 70, max_CF, m_deviceDetails->safetyStopLength); + // CF71: Safety Stop Start Depth [m] + write_ostc_cf(data, 71, max_CF, m_deviceDetails->safetyStopStartDepth); + // CF72: Safety Stop End Depth [m] + write_ostc_cf(data, 72, max_CF, m_deviceDetails->safetyStopEndDepth); + // CF73: Safety Stop Reset Depth [m] + write_ostc_cf(data, 73, max_CF, m_deviceDetails->safetyStopResetDepth); + // CF74: Battery Timeout [min] + #ifdef DEBUG_OSTC_CF for (int cf = 64; cf <= 95 && cf <= max_CF; cf++) printf("CF %d: %d\n", cf, read_ostc_cf(data, cf)); diff --git a/subsurface-core/devicedetails.cpp b/subsurface-core/devicedetails.cpp index e5c33e418..a2da0d5bc 100644 --- a/subsurface-core/devicedetails.cpp +++ b/subsurface-core/devicedetails.cpp @@ -74,6 +74,10 @@ DeviceDetails::DeviceDetails(QObject *parent) : dynamicAscendRate(false), graphicalSpeedIndicator(false), alwaysShowppO2(false), - tempSensorOffset(0) + tempSensorOffset(0), + safetyStopLength(0), + safetyStopStartDepth(0), + safetyStopEndDepth(0), + safetyStopResetDepth(0) { } diff --git a/subsurface-core/devicedetails.h b/subsurface-core/devicedetails.h index 0d929c018..b5e59afe8 100644 --- a/subsurface-core/devicedetails.h +++ b/subsurface-core/devicedetails.h @@ -92,6 +92,10 @@ public: bool graphicalSpeedIndicator; bool alwaysShowppO2; int tempSensorOffset; + unsigned safetyStopLength; + unsigned safetyStopStartDepth; + unsigned safetyStopEndDepth; + unsigned safetyStopResetDepth; };