From f14ad7f183f0422ad09c455212e1822bd7bdd3ee Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Thu, 27 Apr 2017 21:25:04 +0200 Subject: Implement OSTC4 specific settings Signed-off-by: Anton Lundin --- core/configuredivecomputerthreads.cpp | 33 +++++- core/devicedetails.cpp | 3 + core/devicedetails.h | 3 + desktop-widgets/configuredivecomputerdialog.cpp | 6 ++ desktop-widgets/configuredivecomputerdialog.ui | 132 ++++++++++++++++++------ 5 files changed, 142 insertions(+), 35 deletions(-) diff --git a/core/configuredivecomputerthreads.cpp b/core/configuredivecomputerthreads.cpp index 7fdf84db0..39c3b5c63 100644 --- a/core/configuredivecomputerthreads.cpp +++ b/core/configuredivecomputerthreads.cpp @@ -30,6 +30,7 @@ #define OSTC3_AGF_LOW 0x27 #define OSTC3_AGF_HIGH 0x28 #define OSTC3_AGF_SELECTABLE 0x29 +#define OSTC4_VPM_CONSERVATISM 0x29 #define OSTC3_SATURATION 0x2A #define OSTC3_DESATURATION 0x2B #define OSTC3_LAST_DECO 0x2C @@ -48,9 +49,11 @@ #define OSTC3_FLIP_SCREEN 0x39 #define OSTC3_LEFT_BUTTON_SENSIVITY 0x3A #define OSTC3_RIGHT_BUTTON_SENSIVITY 0x3A +#define OSTC4_BUTTON_SENSIVITY 0x3A #define OSTC3_BOTTOM_GAS_CONSUMPTION 0x3C #define OSTC3_DECO_GAS_CONSUMPTION 0x3D #define OSTC3_MOD_WARNING 0x3E +#define OSTC4_TRAVEL_GAS_CONSUMPTION 0x3E #define OSTC3_DYNAMIC_ASCEND_RATE 0x3F #define OSTC3_GRAPHICAL_SPEED_INDICATOR 0x40 #define OSTC3_ALWAYS_SHOW_PPO2 0x41 @@ -369,7 +372,7 @@ static dc_status_t read_ostc4_settings(dc_device_t *device, DeviceDetails *m_dev dc_status_t rc = DC_STATUS_SUCCESS; dc_event_progress_t progress; progress.current = 0; - progress.maximum = 19; + progress.maximum = 23; unsigned char hardware[1]; EMIT_PROGRESS(); @@ -572,12 +575,25 @@ static dc_status_t read_ostc4_settings(dc_device_t *device, DeviceDetails *m_dev READ_SETTING(OSTC3_DECO_TYPE, decoType); READ_SETTING(OSTC3_AGF_HIGH, aGFHigh); READ_SETTING(OSTC3_AGF_LOW, aGFLow); + READ_SETTING(OSTC4_VPM_CONSERVATISM, vpmConservatism); READ_SETTING(OSTC3_SETPOINT_FALLBACK, setPointFallback); + READ_SETTING(OSTC4_BUTTON_SENSIVITY, buttonSensitivity); READ_SETTING(OSTC3_BOTTOM_GAS_CONSUMPTION, bottomGasConsumption); READ_SETTING(OSTC3_DECO_GAS_CONSUMPTION, decoGasConsumption); + READ_SETTING(OSTC4_TRAVEL_GAS_CONSUMPTION, travelGasConsumption); READ_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2); READ_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength); READ_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth); + /* + * Settings not yet implemented + * + * logbook offset 0x47 0..9000 low byte 0..9000 high byte + * Extra display 0x71 0=0ff, 1=BigFont + * Custom View Center 0x72 0..8 (..9 Bonex Version) + * CV Center Fallback 0x73 0..20 sec + * Custom View Corner 0x74 1..7 + * CV Corner Fallback 0x75 0..20 sec + */ #undef READ_SETTING @@ -624,7 +640,7 @@ static dc_status_t write_ostc4_settings(dc_device_t *device, DeviceDetails *m_de dc_status_t rc = DC_STATUS_SUCCESS; dc_event_progress_t progress; progress.current = 0; - progress.maximum = 18; + progress.maximum = 21; //write gas values unsigned char gas1Data[4] = { @@ -835,12 +851,25 @@ static dc_status_t write_ostc4_settings(dc_device_t *device, DeviceDetails *m_de WRITE_SETTING(OSTC3_DECO_TYPE, decoType); WRITE_SETTING(OSTC3_AGF_HIGH, aGFHigh); WRITE_SETTING(OSTC3_AGF_LOW, aGFLow); + WRITE_SETTING(OSTC4_VPM_CONSERVATISM, vpmConservatism); WRITE_SETTING(OSTC3_SETPOINT_FALLBACK, setPointFallback); + WRITE_SETTING(OSTC4_BUTTON_SENSIVITY, buttonSensitivity); WRITE_SETTING(OSTC3_BOTTOM_GAS_CONSUMPTION, bottomGasConsumption); WRITE_SETTING(OSTC3_DECO_GAS_CONSUMPTION, decoGasConsumption); + WRITE_SETTING(OSTC4_TRAVEL_GAS_CONSUMPTION, travelGasConsumption); WRITE_SETTING(OSTC3_ALWAYS_SHOW_PPO2, alwaysShowppO2); WRITE_SETTING(OSTC3_SAFETY_STOP_LENGTH, safetyStopLength); WRITE_SETTING(OSTC3_SAFETY_STOP_START_DEPTH, safetyStopStartDepth); + /* + * Settings not yet implemented + * + * logbook offset 0x47 0..9000 low byte 0..9000 high byte + * Extra display 0x71 0=0ff, 1=BigFont + * Custom View Center 0x72 0..8 (..9 Bonex Version) + * CV Center Fallback 0x73 0..20 sec + * Custom View Corner 0x74 1..7 + * CV Corner Fallback 0x75 0..20 sec + */ #undef WRITE_SETTING diff --git a/core/devicedetails.cpp b/core/devicedetails.cpp index e21983a79..18941a0e2 100644 --- a/core/devicedetails.cpp +++ b/core/devicedetails.cpp @@ -28,6 +28,7 @@ DeviceDetails::DeviceDetails(QObject *parent) : aGFLow(0), aGFHigh(0), aGFSelectable(0), + vpmConservatism(0), saturation(0), desaturation(0), lastDeco(0), @@ -56,8 +57,10 @@ DeviceDetails::DeviceDetails(QObject *parent) : alarmDepth(0), leftButtonSensitivity(0), rightButtonSensitivity(0), + buttonSensitivity(0), bottomGasConsumption(0), decoGasConsumption(0), + travelGasConsumption(0), modWarning(false), dynamicAscendRate(false), graphicalSpeedIndicator(false), diff --git a/core/devicedetails.h b/core/devicedetails.h index ac12b6ca4..cb1a5ad1e 100644 --- a/core/devicedetails.h +++ b/core/devicedetails.h @@ -60,6 +60,7 @@ public: int aGFLow; int aGFHigh; int aGFSelectable; + int vpmConservatism; int saturation; int desaturation; int lastDeco; @@ -88,8 +89,10 @@ public: int alarmDepth; int leftButtonSensitivity; int rightButtonSensitivity; + int buttonSensitivity; int bottomGasConsumption; int decoGasConsumption; + int travelGasConsumption; bool modWarning; bool dynamicAscendRate; bool graphicalSpeedIndicator; diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp index db7249f83..41e3ed386 100644 --- a/desktop-widgets/configuredivecomputerdialog.cpp +++ b/desktop-widgets/configuredivecomputerdialog.cpp @@ -811,9 +811,12 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC4() deviceDetails->decoType = ui.decoTypeComboBox_4->currentIndex(); deviceDetails->aGFHigh = ui.aGFHighSpinBox_4->value(); deviceDetails->aGFLow = ui.aGFLowSpinBox_4->value(); + deviceDetails->vpmConservatism = ui.vpmConservatismSpinBox->value(); deviceDetails->setPointFallback = ui.setPointFallbackCheckBox_4->isChecked(); + deviceDetails->buttonSensitivity = ui.buttonSensitivity_4->value(); deviceDetails->bottomGasConsumption = ui.bottomGasConsumption_4->value(); deviceDetails->decoGasConsumption = ui.decoGasConsumption_4->value(); + deviceDetails->travelGasConsumption = ui.travelGasConsumption_4->value(); deviceDetails->alwaysShowppO2 = ui.alwaysShowppO2_4->isChecked(); deviceDetails->tempSensorOffset = lrint(ui.tempSensorOffsetDoubleSpinBox_4->value() * 10); deviceDetails->safetyStopLength = ui.safetyStopLengthSpinBox_4->value(); @@ -1316,9 +1319,12 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC4() ui.decoTypeComboBox_4->setCurrentIndex(deviceDetails->decoType); ui.aGFHighSpinBox_4->setValue(deviceDetails->aGFHigh); ui.aGFLowSpinBox_4->setValue(deviceDetails->aGFLow); + ui.vpmConservatismSpinBox->setValue(deviceDetails->vpmConservatism); ui.setPointFallbackCheckBox_4->setChecked(deviceDetails->setPointFallback); + ui.buttonSensitivity_4->setValue(deviceDetails->buttonSensitivity); ui.bottomGasConsumption_4->setValue(deviceDetails->bottomGasConsumption); ui.decoGasConsumption_4->setValue(deviceDetails->decoGasConsumption); + ui.travelGasConsumption_4->setValue(deviceDetails->travelGasConsumption); ui.alwaysShowppO2_4->setChecked(deviceDetails->alwaysShowppO2); ui.tempSensorOffsetDoubleSpinBox_4->setValue((double)deviceDetails->tempSensorOffset / 10.0); ui.safetyStopLengthSpinBox_4->setValue(deviceDetails->safetyStopLength); diff --git a/desktop-widgets/configuredivecomputerdialog.ui b/desktop-widgets/configuredivecomputerdialog.ui index 8757c3639..6e0b65b3c 100644 --- a/desktop-widgets/configuredivecomputerdialog.ui +++ b/desktop-widgets/configuredivecomputerdialog.ui @@ -3261,14 +3261,37 @@ Advanced settings - - + + - Always show pO₂ + Travel gas consumption - + + + + % + + + 50 + + + 100 + + + 70 + + + + + + + Button sensitivity + + + + Future TTS @@ -3282,14 +3305,14 @@ - + GFLow - + % @@ -3305,14 +3328,14 @@ - + GFHigh - + % @@ -3328,20 +3351,7 @@ - - - - Qt::Vertical - - - - 20 - 40 - - - - - + m @@ -3361,7 +3371,7 @@ - + % @@ -3412,7 +3422,7 @@ - + min @@ -3422,7 +3432,7 @@ - + Last deco @@ -3432,14 +3442,14 @@ - + Alt GFLow - + % @@ -3455,21 +3465,21 @@ - + Alt GFHigh - + Bottom gas consumption - + Deco gas consumption @@ -3477,7 +3487,7 @@ - + ℓ/min @@ -3493,6 +3503,22 @@ + + + ℓ/min + + + 5 + + + 50 + + + 20 + + + + ℓ/min @@ -3508,14 +3534,54 @@ - + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Always show pO₂ + + + + + + + VPM conservatism + + + + + + + + + + + 5 + + + 3 + + + + Temperature sensor offset - + °C -- cgit v1.2.3-70-g09d2