diff options
-rw-r--r-- | configuredivecomputerthreads.cpp | 42 | ||||
-rw-r--r-- | qt-ui/configuredivecomputerdialog.cpp | 24 |
2 files changed, 63 insertions, 3 deletions
diff --git a/configuredivecomputerthreads.cpp b/configuredivecomputerthreads.cpp index 3afb11bc5..7ee015f3e 100644 --- a/configuredivecomputerthreads.cpp +++ b/configuredivecomputerthreads.cpp @@ -2,6 +2,7 @@ #include "libdivecomputer/hw.h" #include <QDebug> #include <QDateTime> +#include <QStringList> ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data) : QThread(parent), m_data(data) @@ -43,13 +44,48 @@ void ReadSettingsThread::run() unsigned char gasData[4] = {0,0,0,0}; rc = hw_ostc3_device_config_read(m_data->device, 0x10, gasData, sizeof(gasData)); if (rc == DC_STATUS_SUCCESS) { - //Gas 1 read successful - gas gas1; + //Gas data read successful gas1.depth = gasData[3]; gas1.oxygen = gasData[0]; gas1.helium = gasData[1]; gas1.type = gasData[2]; } + //Gas 2 + rc = hw_ostc3_device_config_read(m_data->device, 0x11, gasData, sizeof(gasData)); + if (rc == DC_STATUS_SUCCESS) { + //Gas data read successful + gas2.depth = gasData[3]; + gas2.oxygen = gasData[0]; + gas2.helium = gasData[1]; + gas2.type = gasData[2]; + } + //Gas 3 + rc = hw_ostc3_device_config_read(m_data->device, 0x12, gasData, sizeof(gasData)); + if (rc == DC_STATUS_SUCCESS) { + //Gas data read successful + gas3.depth = gasData[3]; + gas3.oxygen = gasData[0]; + gas3.helium = gasData[1]; + gas3.type = gasData[2]; + } + //Gas 4 + rc = hw_ostc3_device_config_read(m_data->device, 0x13, gasData, sizeof(gasData)); + if (rc == DC_STATUS_SUCCESS) { + //Gas data read successful + gas4.depth = gasData[3]; + gas4.oxygen = gasData[0]; + gas4.helium = gasData[1]; + gas4.type = gasData[2]; + } + //Gas 5 + rc = hw_ostc3_device_config_read(m_data->device, 0x14, gasData, sizeof(gasData)); + if (rc == DC_STATUS_SUCCESS) { + //Gas data read successful + gas5.depth = gasData[3]; + gas5.oxygen = gasData[0]; + gas5.helium = gasData[1]; + gas5.type = gasData[2]; + } m_deviceDetails->setGas1(gas1); m_deviceDetails->setGas2(gas2); @@ -57,7 +93,7 @@ void ReadSettingsThread::run() m_deviceDetails->setGas4(gas4); m_deviceDetails->setGas5(gas5); - //Read general settings + //Read other settings unsigned char uData[1] = {0}; //DiveMode rc = hw_ostc3_device_config_read(m_data->device, 0x20, uData, sizeof(uData)); diff --git a/qt-ui/configuredivecomputerdialog.cpp b/qt-ui/configuredivecomputerdialog.cpp index ece02a3d0..27c377a4e 100644 --- a/qt-ui/configuredivecomputerdialog.cpp +++ b/qt-ui/configuredivecomputerdialog.cpp @@ -208,6 +208,30 @@ void ConfigureDiveComputerDialog::reloadValues() ui->ostc3GasTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium))); ui->ostc3GasTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type))); ui->ostc3GasTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth))); + + //load gas 2 values + ui->ostc3GasTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen))); + ui->ostc3GasTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium))); + ui->ostc3GasTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type))); + ui->ostc3GasTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth))); + + //load gas 3 values + ui->ostc3GasTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen))); + ui->ostc3GasTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium))); + ui->ostc3GasTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type))); + ui->ostc3GasTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth))); + + //load gas 4 values + ui->ostc3GasTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen))); + ui->ostc3GasTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium))); + ui->ostc3GasTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type))); + ui->ostc3GasTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth))); + + //load gas 5 values + ui->ostc3GasTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen))); + ui->ostc3GasTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium))); + ui->ostc3GasTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type))); + ui->ostc3GasTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth))); } |