From 7ae578ae6a9b588009a8b1e90db484531c6690a9 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Fri, 22 Jan 2016 14:17:50 +0100 Subject: 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 --- configuredivecomputerthreads.cpp | 35 +- devicedetails.cpp | 6 +- devicedetails.h | 4 + qt-ui/configuredivecomputerdialog.cpp | 16 + qt-ui/configuredivecomputerdialog.ui | 706 +++++++++++++++++++++++++--------- 5 files changed, 592 insertions(+), 175 deletions(-) diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp index 7c5c7b9d5..53a8aa7f1 100644 --- a/configuredivecomputerthreads.cpp +++ b/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/devicedetails.cpp b/devicedetails.cpp index e5c33e418..a2da0d5bc 100644 --- a/devicedetails.cpp +++ b/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/devicedetails.h b/devicedetails.h index 0d929c018..b5e59afe8 100644 --- a/devicedetails.h +++ b/devicedetails.h @@ -92,6 +92,10 @@ public: bool graphicalSpeedIndicator; bool alwaysShowppO2; int tempSensorOffset; + unsigned safetyStopLength; + unsigned safetyStopStartDepth; + unsigned safetyStopEndDepth; + unsigned safetyStopResetDepth; }; diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index 3fbb4327c..8df184788 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/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/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui index ac177a277..a37b5ec39 100644 --- a/qt-ui/configuredivecomputerdialog.ui +++ b/qt-ui/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,13 +502,16 @@ - - - - false + + + + + 1 + 0 + - - Reset device to default settings + + 60 @@ -512,6 +525,13 @@ + + + + Computer model + + + @@ -522,26 +542,6 @@ - - - - - 1 - 0 - - - - 60 - - - - - - - Computer model - - - @@ -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,27 +1937,31 @@ Basic settings - - + + - Salinity + Serial No. - salinitySpinBox + serialNoLineEdit - - + + - Serial No. + Length - - serialNoLineEdit + + + + + + true - + @@ -1854,7 +1974,7 @@ - + Firmware version @@ -1864,37 +1984,126 @@ - - - - true + + + + Custom text + + + customTextLlineEdit_3 + + + + + + + + 1 + 0 + + + + 23 + + + + + + + Number of dives + + + + + + + Show safety stop + + + + + + + true + + + + + + + Sampling rate + + + samplingRateComboBox + + + + + + + + 0 + 0 + + + + 1 + + + 120 + + + 10 + + + + + + + Date format + + + dateFormatComboBox + + + + + + + + MM/DD/YY + + + + + DD/MM/YY + + + + + YY/MM/DD + + + + + + + + Sync dive computer time with PC - - + + - Custom text + Salinity - customTextLlineEdit_3 - - - - - - - - 1 - 0 - - - - 23 + salinitySpinBox - + kg/ℓ @@ -1910,7 +2119,7 @@ - + Qt::Vertical @@ -1923,89 +2132,112 @@ - - + + - Sync dive computer time with PC + Start Depth - - + + - Show safety stop + End Depth - - - - - MM/DD/YY - - - - - DD/MM/YY - - - - - YY/MM/DD - - - - - - + + - Number of dives + Reset Depth - - - - true + + + + false + + + s + + + 10 + + + 250 + + + 180 - - - - - 0 - 0 - + + + + false - + + m + + 1 + + 3.000000000000000 + - 120 + 6.500000000000000 + + + 0.100000000000000 - 10 + 5.100000000000000 - - - - Sampling rate + + + + false - - samplingRateComboBox + + m + + + 1 + + + 2.500000000000000 + + + 5.000000000000000 + + + 2.900000000000000 - - - - Date format + + + + false - - dateFormatComboBox + + 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 + + + -- cgit v1.2.3-70-g09d2