From 8946c822425d22fb111a96bccbd3d81dd0447f5c Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Fri, 25 Sep 2015 00:59:03 +0200 Subject: Probe and expose OSTC3 model information This looks at the OSTC3 hw descriptor and exposes that model info as a read-only line edit, so you can see in clear text the name of the model of computer. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- configuredivecomputerthreads.cpp | 36 ++++- qt-ui/configuredivecomputerdialog.cpp | 1 + qt-ui/configuredivecomputerdialog.ui | 256 ++++++++++++++++++---------------- 3 files changed, 171 insertions(+), 122 deletions(-) diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp index 2c6583e04..00ab07f53 100644 --- a/configuredivecomputerthreads.cpp +++ b/configuredivecomputerthreads.cpp @@ -55,6 +55,13 @@ #define OSTC3_GRAPHICAL_SPEED_INDICATOR 0x40 #define OSTC3_ALWAYS_SHOW_PPO2 0x41 +#define OSTC3_HW_OSTC_3 0x0A +#define OSTC3_HW_OSTC_3P 0x1A +#define OSTC3_HW_OSTC_CR 0x05 +#define OSTC3_HW_OSTC_SPORT 0x12 +#define OSTC3_HW_OSTC_2 0x11 + + #define SUUNTO_VYPER_MAXDEPTH 0x1e #define SUUNTO_VYPER_TOTAL_TIME 0x20 #define SUUNTO_VYPER_NUMBEROFDIVES 0x22 @@ -401,7 +408,34 @@ 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 = 51; + progress.maximum = 52; + unsigned char hardware[1]; + + //Read hardware type + rc = hw_ostc3_device_hardware (device, hardware, sizeof (hardware)); + if (rc != DC_STATUS_SUCCESS) + return rc; + EMIT_PROGRESS(); + + // FIXME: can we grab this info from libdivecomputer descriptor + // instead of hard coded here? + switch(hardware[0]) { + case OSTC3_HW_OSTC_3: + m_deviceDetails->model = "3"; + break; + case OSTC3_HW_OSTC_3P: + m_deviceDetails->model = "3+"; + break; + case OSTC3_HW_OSTC_CR: + m_deviceDetails->model = "CR"; + break; + case OSTC3_HW_OSTC_SPORT: + m_deviceDetails->model = "Sport"; + break; + case OSTC3_HW_OSTC_2: + m_deviceDetails->model = "2"; + break; + } //Read gas mixes gas gas1; diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index a6017e92a..eb790e6d3 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -802,6 +802,7 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3() ui.serialNoLineEdit->setText(deviceDetails->serialNo); ui.firmwareVersionLineEdit->setText(deviceDetails->firmwareVersion); ui.customTextLlineEdit->setText(deviceDetails->customText); + ui.modelLineEdit->setText(deviceDetails->model); ui.diveModeComboBox->setCurrentIndex(deviceDetails->diveMode); ui.saturationSpinBox->setValue(deviceDetails->saturation); ui.desaturationSpinBox->setValue(deviceDetails->desaturation); diff --git a/qt-ui/configuredivecomputerdialog.ui b/qt-ui/configuredivecomputerdialog.ui index f7820f7bd..0986d71ca 100644 --- a/qt-ui/configuredivecomputerdialog.ui +++ b/qt-ui/configuredivecomputerdialog.ui @@ -253,7 +253,7 @@ Basic settings - + @@ -277,7 +277,7 @@ - + @@ -331,30 +331,7 @@ - - - - Custom text - - - customTextLlineEdit - - - - - - - - 1 - 0 - - - - 60 - - - - + Language @@ -364,60 +341,45 @@ - - - - - OC - - + + - CC + MMDDYY - Gauge + DDMMYY - Apnea + YYMMDD - - - - Dive mode - - - diveModeComboBox - - - - - + + - MMDDYY + Eco - DDMMYY + Medium - YYMMDD + High - + Date format @@ -427,26 +389,7 @@ - - - - - Eco - - - - - Medium - - - - - High - - - - - + Brightness @@ -456,7 +399,7 @@ - + Units @@ -466,7 +409,7 @@ - + Salinity (0-5%) @@ -476,7 +419,7 @@ - + % @@ -486,21 +429,7 @@ - - - - - 2s - - - - - 10s - - - - - + @@ -550,7 +479,7 @@ - + Qt::Vertical @@ -563,47 +492,121 @@ - - + + + + false + - Sampling rate + Reset device to default settings + + + + + + + Compass gain - samplingRateComboBox + compassGainComboBox - - + + + + Custom text + + + customTextLlineEdit + + + + + + + + 1 + 0 + + + + 60 + + + + + + + Computer model + + + + + + + true + + + + + + + Dive mode + + + diveModeComboBox + + + + + - Standard + OC - Red + CC - Green + Gauge - Blue + Apnea - - + + - Sync dive computer time with PC + Sampling rate + + + samplingRateComboBox + + + + + 2s + + + + + 10s + + + + @@ -614,30 +617,41 @@ - - - - Show safety stop - + + + + + Standard + + + + + Red + + + + + Green + + + + + Blue + + - - - - false - + + - Reset device to default settings + Sync dive computer time with PC - - + + - Compass gain - - - compassGainComboBox + Show safety stop -- cgit v1.2.3-70-g09d2