mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Whitespace cleanup
Plus removal of a few qDebug() calls I introduced earlier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4559a26e31
commit
b2f4896f3c
7 changed files with 394 additions and 410 deletions
|
@ -9,8 +9,7 @@
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QXmlStreamWriter>
|
#include <QXmlStreamWriter>
|
||||||
|
|
||||||
ConfigureDiveComputer::ConfigureDiveComputer() :
|
ConfigureDiveComputer::ConfigureDiveComputer() : readThread(0),
|
||||||
readThread(0),
|
|
||||||
writeThread(0),
|
writeThread(0),
|
||||||
resetThread(0),
|
resetThread(0),
|
||||||
firmwareThread(0)
|
firmwareThread(0)
|
||||||
|
@ -29,8 +28,8 @@ void ConfigureDiveComputer::readSettings(device_data_t *data)
|
||||||
connect(readThread, SIGNAL(finished()),
|
connect(readThread, SIGNAL(finished()),
|
||||||
this, SLOT(readThreadFinished()), Qt::QueuedConnection);
|
this, SLOT(readThreadFinished()), Qt::QueuedConnection);
|
||||||
connect(readThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
connect(readThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
||||||
connect(readThread, SIGNAL(devicedetails(DeviceDetails*)), this,
|
connect(readThread, SIGNAL(devicedetails(DeviceDetails *)), this,
|
||||||
SIGNAL(deviceDetailsChanged(DeviceDetails*)));
|
SIGNAL(deviceDetailsChanged(DeviceDetails *)));
|
||||||
|
|
||||||
readThread->start();
|
readThread->start();
|
||||||
}
|
}
|
||||||
|
@ -72,32 +71,27 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
|
||||||
.arg(QString::number(details->gas1().oxygen),
|
.arg(QString::number(details->gas1().oxygen),
|
||||||
QString::number(details->gas1().helium),
|
QString::number(details->gas1().helium),
|
||||||
QString::number(details->gas1().type),
|
QString::number(details->gas1().type),
|
||||||
QString::number(details->gas1().depth)
|
QString::number(details->gas1().depth));
|
||||||
);
|
|
||||||
QString gas2 = QString("%1,%2,%3,%4")
|
QString gas2 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->gas2().oxygen),
|
.arg(QString::number(details->gas2().oxygen),
|
||||||
QString::number(details->gas2().helium),
|
QString::number(details->gas2().helium),
|
||||||
QString::number(details->gas2().type),
|
QString::number(details->gas2().type),
|
||||||
QString::number(details->gas2().depth)
|
QString::number(details->gas2().depth));
|
||||||
);
|
|
||||||
QString gas3 = QString("%1,%2,%3,%4")
|
QString gas3 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->gas3().oxygen),
|
.arg(QString::number(details->gas3().oxygen),
|
||||||
QString::number(details->gas3().helium),
|
QString::number(details->gas3().helium),
|
||||||
QString::number(details->gas3().type),
|
QString::number(details->gas3().type),
|
||||||
QString::number(details->gas3().depth)
|
QString::number(details->gas3().depth));
|
||||||
);
|
|
||||||
QString gas4 = QString("%1,%2,%3,%4")
|
QString gas4 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->gas4().oxygen),
|
.arg(QString::number(details->gas4().oxygen),
|
||||||
QString::number(details->gas4().helium),
|
QString::number(details->gas4().helium),
|
||||||
QString::number(details->gas4().type),
|
QString::number(details->gas4().type),
|
||||||
QString::number(details->gas4().depth)
|
QString::number(details->gas4().depth));
|
||||||
);
|
|
||||||
QString gas5 = QString("%1,%2,%3,%4")
|
QString gas5 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->gas5().oxygen),
|
.arg(QString::number(details->gas5().oxygen),
|
||||||
QString::number(details->gas5().helium),
|
QString::number(details->gas5().helium),
|
||||||
QString::number(details->gas5().type),
|
QString::number(details->gas5().type),
|
||||||
QString::number(details->gas5().depth)
|
QString::number(details->gas5().depth));
|
||||||
);
|
|
||||||
writer.writeTextElement("Gas1", gas1);
|
writer.writeTextElement("Gas1", gas1);
|
||||||
writer.writeTextElement("Gas2", gas2);
|
writer.writeTextElement("Gas2", gas2);
|
||||||
writer.writeTextElement("Gas3", gas3);
|
writer.writeTextElement("Gas3", gas3);
|
||||||
|
@ -109,32 +103,27 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
|
||||||
.arg(QString::number(details->dil1().oxygen),
|
.arg(QString::number(details->dil1().oxygen),
|
||||||
QString::number(details->dil1().helium),
|
QString::number(details->dil1().helium),
|
||||||
QString::number(details->dil1().type),
|
QString::number(details->dil1().type),
|
||||||
QString::number(details->dil1().depth)
|
QString::number(details->dil1().depth));
|
||||||
);
|
|
||||||
QString dil2 = QString("%1,%2,%3,%4")
|
QString dil2 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->dil2().oxygen),
|
.arg(QString::number(details->dil2().oxygen),
|
||||||
QString::number(details->dil2().helium),
|
QString::number(details->dil2().helium),
|
||||||
QString::number(details->dil2().type),
|
QString::number(details->dil2().type),
|
||||||
QString::number(details->dil2().depth)
|
QString::number(details->dil2().depth));
|
||||||
);
|
|
||||||
QString dil3 = QString("%1,%2,%3,%4")
|
QString dil3 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->dil3().oxygen),
|
.arg(QString::number(details->dil3().oxygen),
|
||||||
QString::number(details->dil3().helium),
|
QString::number(details->dil3().helium),
|
||||||
QString::number(details->dil3().type),
|
QString::number(details->dil3().type),
|
||||||
QString::number(details->dil3().depth)
|
QString::number(details->dil3().depth));
|
||||||
);
|
|
||||||
QString dil4 = QString("%1,%2,%3,%4")
|
QString dil4 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->dil4().oxygen),
|
.arg(QString::number(details->dil4().oxygen),
|
||||||
QString::number(details->dil4().helium),
|
QString::number(details->dil4().helium),
|
||||||
QString::number(details->dil4().type),
|
QString::number(details->dil4().type),
|
||||||
QString::number(details->dil4().depth)
|
QString::number(details->dil4().depth));
|
||||||
);
|
|
||||||
QString dil5 = QString("%1,%2,%3,%4")
|
QString dil5 = QString("%1,%2,%3,%4")
|
||||||
.arg(QString::number(details->dil5().oxygen),
|
.arg(QString::number(details->dil5().oxygen),
|
||||||
QString::number(details->dil5().helium),
|
QString::number(details->dil5().helium),
|
||||||
QString::number(details->dil5().type),
|
QString::number(details->dil5().type),
|
||||||
QString::number(details->dil5().depth)
|
QString::number(details->dil5().depth));
|
||||||
);
|
|
||||||
writer.writeTextElement("Dil1", dil1);
|
writer.writeTextElement("Dil1", dil1);
|
||||||
writer.writeTextElement("Dil2", dil2);
|
writer.writeTextElement("Dil2", dil2);
|
||||||
writer.writeTextElement("Dil3", dil3);
|
writer.writeTextElement("Dil3", dil3);
|
||||||
|
@ -144,24 +133,19 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
|
||||||
//Add set point values
|
//Add set point values
|
||||||
QString sp1 = QString("%1,%2")
|
QString sp1 = QString("%1,%2")
|
||||||
.arg(QString::number(details->sp1().sp),
|
.arg(QString::number(details->sp1().sp),
|
||||||
QString::number(details->sp1().depth)
|
QString::number(details->sp1().depth));
|
||||||
);
|
|
||||||
QString sp2 = QString("%1,%2")
|
QString sp2 = QString("%1,%2")
|
||||||
.arg(QString::number(details->sp2().sp),
|
.arg(QString::number(details->sp2().sp),
|
||||||
QString::number(details->sp2().depth)
|
QString::number(details->sp2().depth));
|
||||||
);
|
|
||||||
QString sp3 = QString("%1,%2")
|
QString sp3 = QString("%1,%2")
|
||||||
.arg(QString::number(details->sp3().sp),
|
.arg(QString::number(details->sp3().sp),
|
||||||
QString::number(details->sp3().depth)
|
QString::number(details->sp3().depth));
|
||||||
);
|
|
||||||
QString sp4 = QString("%1,%2")
|
QString sp4 = QString("%1,%2")
|
||||||
.arg(QString::number(details->sp4().sp),
|
.arg(QString::number(details->sp4().sp),
|
||||||
QString::number(details->sp4().depth)
|
QString::number(details->sp4().depth));
|
||||||
);
|
|
||||||
QString sp5 = QString("%1,%2")
|
QString sp5 = QString("%1,%2")
|
||||||
.arg(QString::number(details->sp5().sp),
|
.arg(QString::number(details->sp5().sp),
|
||||||
QString::number(details->sp5().depth)
|
QString::number(details->sp5().depth));
|
||||||
);
|
|
||||||
writer.writeTextElement("SetPoint1", sp1);
|
writer.writeTextElement("SetPoint1", sp1);
|
||||||
writer.writeTextElement("SetPoint2", sp2);
|
writer.writeTextElement("SetPoint2", sp2);
|
||||||
writer.writeTextElement("SetPoint3", sp3);
|
writer.writeTextElement("SetPoint3", sp3);
|
||||||
|
@ -513,7 +497,6 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
|
||||||
void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data)
|
void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data)
|
||||||
{
|
{
|
||||||
setState(FWUPDATE);
|
setState(FWUPDATE);
|
||||||
|
|
||||||
if (firmwareThread)
|
if (firmwareThread)
|
||||||
firmwareThread->deleteLater();
|
firmwareThread->deleteLater();
|
||||||
|
|
||||||
|
@ -521,7 +504,6 @@ void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t
|
||||||
connect(firmwareThread, SIGNAL(finished()),
|
connect(firmwareThread, SIGNAL(finished()),
|
||||||
this, SLOT(firmwareThreadFinished()), Qt::QueuedConnection);
|
this, SLOT(firmwareThreadFinished()), Qt::QueuedConnection);
|
||||||
connect(firmwareThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
connect(firmwareThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
||||||
|
|
||||||
firmwareThread->start();
|
firmwareThread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
|
|
||||||
#include "libxml/xmlreader.h"
|
#include "libxml/xmlreader.h"
|
||||||
|
|
||||||
class ConfigureDiveComputer : public QObject
|
class ConfigureDiveComputer : public QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ConfigureDiveComputer();
|
explicit ConfigureDiveComputer();
|
||||||
|
@ -50,7 +49,8 @@ private:
|
||||||
ResetSettingsThread *resetThread;
|
ResetSettingsThread *resetThread;
|
||||||
FirmwareUpdateThread *firmwareThread;
|
FirmwareUpdateThread *firmwareThread;
|
||||||
void setState(states newState);
|
void setState(states newState);
|
||||||
private slots:
|
private
|
||||||
|
slots:
|
||||||
void readThreadFinished();
|
void readThreadFinished();
|
||||||
void writeThreadFinished();
|
void writeThreadFinished();
|
||||||
void resetThreadFinished();
|
void resetThreadFinished();
|
||||||
|
|
|
@ -106,17 +106,17 @@ static dc_status_t local_hw_ostc_device_clock(void *ignored, dc_datetime_t *time
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data)
|
ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data) : QThread(parent), m_data(data)
|
||||||
: QThread(parent), m_data(data)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_ostc_cf(unsigned char data[], unsigned char cf) {
|
static int read_ostc_cf(unsigned char data[], unsigned char cf)
|
||||||
|
{
|
||||||
return data[128 + (cf % 32) * 4 + 3] << 8 ^ data[128 + (cf % 32) * 4 + 2];
|
return data[128 + (cf % 32) * 4 + 3] << 8 ^ data[128 + (cf % 32) * 4 + 2];
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_ostc_cf(unsigned char data[], unsigned char cf, unsigned char max_CF, unsigned int value) {
|
static void write_ostc_cf(unsigned char data[], unsigned char cf, unsigned char max_CF, unsigned int value)
|
||||||
|
{
|
||||||
// Only write settings supported by this firmware.
|
// Only write settings supported by this firmware.
|
||||||
if (cf > max_CF)
|
if (cf > max_CF)
|
||||||
return;
|
return;
|
||||||
|
@ -145,7 +145,7 @@ void ReadSettingsThread::run()
|
||||||
const char *model;
|
const char *model;
|
||||||
// FIXME: grab this info from libdivecomputer descriptor
|
// FIXME: grab this info from libdivecomputer descriptor
|
||||||
// instead of hard coded here
|
// instead of hard coded here
|
||||||
switch(data[0]) {
|
switch (data[0]) {
|
||||||
case 0x03:
|
case 0x03:
|
||||||
model = "Stinger";
|
model = "Stinger";
|
||||||
break;
|
break;
|
||||||
|
@ -212,11 +212,11 @@ void ReadSettingsThread::run()
|
||||||
rc = dc_device_read(m_data->device, SUUNTO_VYPER_CUSTOM_TEXT, data, SUUNTO_VYPER_CUSTOM_TEXT_LENGHT);
|
rc = dc_device_read(m_data->device, SUUNTO_VYPER_CUSTOM_TEXT, data, SUUNTO_VYPER_CUSTOM_TEXT_LENGHT);
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
data[SUUNTO_VYPER_CUSTOM_TEXT_LENGHT] = 0;
|
data[SUUNTO_VYPER_CUSTOM_TEXT_LENGHT] = 0;
|
||||||
m_deviceDetails->setCustomText((const char*) data);
|
m_deviceDetails->setCustomText((const char *)data);
|
||||||
}
|
}
|
||||||
rc = dc_device_read(m_data->device, SUUNTO_VYPER_SAMPLING_RATE, data, 1);
|
rc = dc_device_read(m_data->device, SUUNTO_VYPER_SAMPLING_RATE, data, 1);
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
m_deviceDetails->setSamplingRate((int) data[0]);
|
m_deviceDetails->setSamplingRate((int)data[0]);
|
||||||
}
|
}
|
||||||
rc = dc_device_read(m_data->device, SUUNTO_VYPER_ALTITUDE_SAFETY, data, 1);
|
rc = dc_device_read(m_data->device, SUUNTO_VYPER_ALTITUDE_SAFETY, data, 1);
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
|
@ -271,7 +271,7 @@ void ReadSettingsThread::run()
|
||||||
gas gas4;
|
gas gas4;
|
||||||
gas gas5;
|
gas gas5;
|
||||||
//Gas 1
|
//Gas 1
|
||||||
unsigned char gasData[4] = {0,0,0,0};
|
unsigned char gasData[4] = { 0, 0, 0, 0 };
|
||||||
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_GAS1, gasData, sizeof(gasData));
|
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_GAS1, gasData, sizeof(gasData));
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
//Gas data read successful
|
//Gas data read successful
|
||||||
|
@ -330,7 +330,7 @@ void ReadSettingsThread::run()
|
||||||
gas dil4;
|
gas dil4;
|
||||||
gas dil5;
|
gas dil5;
|
||||||
//Dil 1
|
//Dil 1
|
||||||
unsigned char dilData[4] = {0,0,0,0};
|
unsigned char dilData[4] = { 0, 0, 0, 0 };
|
||||||
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIL1, dilData, sizeof(dilData));
|
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_DIL1, dilData, sizeof(dilData));
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
//Data read successful
|
//Data read successful
|
||||||
|
@ -389,7 +389,7 @@ void ReadSettingsThread::run()
|
||||||
setpoint sp4;
|
setpoint sp4;
|
||||||
setpoint sp5;
|
setpoint sp5;
|
||||||
|
|
||||||
unsigned char spData[2] = {0,0};
|
unsigned char spData[2] = { 0, 0 };
|
||||||
|
|
||||||
//Sp 1
|
//Sp 1
|
||||||
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SP1, spData, sizeof(spData));
|
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_SP1, spData, sizeof(spData));
|
||||||
|
@ -434,7 +434,7 @@ void ReadSettingsThread::run()
|
||||||
m_deviceDetails->setSp5(sp5);
|
m_deviceDetails->setSp5(sp5);
|
||||||
|
|
||||||
//Read other settings
|
//Read other settings
|
||||||
unsigned char uData[1] = {0};
|
unsigned char uData[1] = { 0 };
|
||||||
|
|
||||||
#define READ_SETTING(_OSTC3_SETTING, _DEVICE_DETAIL) \
|
#define READ_SETTING(_OSTC3_SETTING, _DEVICE_DETAIL) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -449,9 +449,9 @@ void ReadSettingsThread::run()
|
||||||
READ_SETTING(OSTC3_LAST_DECO, setLastDeco);
|
READ_SETTING(OSTC3_LAST_DECO, setLastDeco);
|
||||||
READ_SETTING(OSTC3_BRIGHTNESS, setBrightness);
|
READ_SETTING(OSTC3_BRIGHTNESS, setBrightness);
|
||||||
READ_SETTING(OSTC3_UNITS, setUnits);
|
READ_SETTING(OSTC3_UNITS, setUnits);
|
||||||
READ_SETTING(OSTC3_SAMPLING_RATE,setSamplingRate);
|
READ_SETTING(OSTC3_SAMPLING_RATE, setSamplingRate);
|
||||||
READ_SETTING(OSTC3_SALINITY, setSalinity);
|
READ_SETTING(OSTC3_SALINITY, setSalinity);
|
||||||
READ_SETTING(OSTC3_DIVEMODE_COLOR,setDiveModeColor);
|
READ_SETTING(OSTC3_DIVEMODE_COLOR, setDiveModeColor);
|
||||||
READ_SETTING(OSTC3_LANGUAGE, setLanguage);
|
READ_SETTING(OSTC3_LANGUAGE, setLanguage);
|
||||||
READ_SETTING(OSTC3_DATE_FORMAT, setDateFormat);
|
READ_SETTING(OSTC3_DATE_FORMAT, setDateFormat);
|
||||||
READ_SETTING(OSTC3_COMPASS_GAIN, setCompassGain);
|
READ_SETTING(OSTC3_COMPASS_GAIN, setCompassGain);
|
||||||
|
@ -475,12 +475,12 @@ void ReadSettingsThread::run()
|
||||||
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_PRESSURE_SENSOR_OFFSET, uData, sizeof(uData));
|
rc = hw_ostc3_device_config_read(m_data->device, OSTC3_PRESSURE_SENSOR_OFFSET, uData, sizeof(uData));
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
// OSTC3 stores the pressureSensorOffset in two-complement
|
// OSTC3 stores the pressureSensorOffset in two-complement
|
||||||
m_deviceDetails->setPressureSensorOffset((signed char) uData[0]);
|
m_deviceDetails->setPressureSensorOffset((signed char)uData[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//read firmware settings
|
//read firmware settings
|
||||||
unsigned char fData[64] = {0};
|
unsigned char fData[64] = { 0 };
|
||||||
rc = hw_ostc3_device_version (m_data->device, fData, sizeof (fData));
|
rc = hw_ostc3_device_version(m_data->device, fData, sizeof(fData));
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
int serial = fData[0] + (fData[1] << 8);
|
int serial = fData[0] + (fData[1] << 8);
|
||||||
m_deviceDetails->setSerialNo(QString::number(serial));
|
m_deviceDetails->setSerialNo(QString::number(serial));
|
||||||
|
@ -549,7 +549,7 @@ void ReadSettingsThread::run()
|
||||||
gas4.depth = data[31];
|
gas4.depth = data[31];
|
||||||
gas5.depth = data[32];
|
gas5.depth = data[32];
|
||||||
// 33 which gas is Fist gas
|
// 33 which gas is Fist gas
|
||||||
switch(data[33]) {
|
switch (data[33]) {
|
||||||
case 1:
|
case 1:
|
||||||
gas1.type = 2;
|
gas1.type = 2;
|
||||||
break;
|
break;
|
||||||
|
@ -637,10 +637,10 @@ void ReadSettingsThread::run()
|
||||||
// Make shure the data is null-terminated
|
// Make shure the data is null-terminated
|
||||||
data[89] = 0;
|
data[89] = 0;
|
||||||
// Find the internal termination and replace it with 0
|
// Find the internal termination and replace it with 0
|
||||||
char *term = strchr((char *) data + 65, (int)'}');
|
char *term = strchr((char *)data + 65, (int)'}');
|
||||||
if (term)
|
if (term)
|
||||||
*term = 0;
|
*term = 0;
|
||||||
m_deviceDetails->setCustomText((const char*) data + 65);
|
m_deviceDetails->setCustomText((const char *)data + 65);
|
||||||
}
|
}
|
||||||
// Byte91:
|
// Byte91:
|
||||||
// Dim OLED in Divemode (>0), Normal mode (=0)
|
// Dim OLED in Divemode (>0), Normal mode (=0)
|
||||||
|
@ -696,7 +696,7 @@ void ReadSettingsThread::run()
|
||||||
dil5.helium = data[114];
|
dil5.helium = data[114];
|
||||||
// Byte116:
|
// Byte116:
|
||||||
// First Diluent (1-5)
|
// First Diluent (1-5)
|
||||||
switch(data[115]) {
|
switch (data[115]) {
|
||||||
case 1:
|
case 1:
|
||||||
dil1.type = 2;
|
dil1.type = 2;
|
||||||
break;
|
break;
|
||||||
|
@ -741,7 +741,7 @@ void ReadSettingsThread::run()
|
||||||
m_deviceDetails->setLastDeco(read_ostc_cf(data, 29));
|
m_deviceDetails->setLastDeco(read_ostc_cf(data, 29));
|
||||||
|
|
||||||
#ifdef DEBUG_OSTC_CF
|
#ifdef DEBUG_OSTC_CF
|
||||||
for(int cf = 0; cf <= 31 && cf <= max_CF; cf++)
|
for (int cf = 0; cf <= 31 && cf <= max_CF; cf++)
|
||||||
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -769,7 +769,7 @@ void ReadSettingsThread::run()
|
||||||
// CF58: Future time to surface setFutureTTS
|
// CF58: Future time to surface setFutureTTS
|
||||||
m_deviceDetails->setFutureTTS(read_ostc_cf(data, 58));
|
m_deviceDetails->setFutureTTS(read_ostc_cf(data, 58));
|
||||||
#ifdef DEBUG_OSTC_CF
|
#ifdef DEBUG_OSTC_CF
|
||||||
for(int cf = 32; cf <= 63 && cf <= max_CF; cf++)
|
for (int cf = 32; cf <= 63 && cf <= max_CF; cf++)
|
||||||
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -792,7 +792,7 @@ void ReadSettingsThread::run()
|
||||||
// CF69: Allow Gradient Factor change
|
// CF69: Allow Gradient Factor change
|
||||||
m_deviceDetails->setAGFSelectable(read_ostc_cf(data, 69));
|
m_deviceDetails->setAGFSelectable(read_ostc_cf(data, 69));
|
||||||
#ifdef DEBUG_OSTC_CF
|
#ifdef DEBUG_OSTC_CF
|
||||||
for(int cf = 64; cf <= 95 && cf <= max_CF; cf++)
|
for (int cf = 64; cf <= 95 && cf <= max_CF; cf++)
|
||||||
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -818,8 +818,7 @@ unsupported_dc_error:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data)
|
WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data) : QThread(parent), m_data(data)
|
||||||
: QThread(parent), m_data(data)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -852,7 +851,7 @@ void WriteSettingsThread::run()
|
||||||
|
|
||||||
dc_device_write(m_data->device, SUUNTO_VYPER_CUSTOM_TEXT,
|
dc_device_write(m_data->device, SUUNTO_VYPER_CUSTOM_TEXT,
|
||||||
// Convert the customText to a 30 char wide padded with " "
|
// Convert the customText to a 30 char wide padded with " "
|
||||||
(const unsigned char *) QString("%1").arg(m_deviceDetails->customText(), -30, QChar(' ')).toUtf8().data(),
|
(const unsigned char *)QString("%1").arg(m_deviceDetails->customText(), -30, QChar(' ')).toUtf8().data(),
|
||||||
SUUNTO_VYPER_CUSTOM_TEXT_LENGHT);
|
SUUNTO_VYPER_CUSTOM_TEXT_LENGHT);
|
||||||
data = m_deviceDetails->samplingRate();
|
data = m_deviceDetails->samplingRate();
|
||||||
dc_device_write(m_data->device, SUUNTO_VYPER_SAMPLING_RATE, &data, 1);
|
dc_device_write(m_data->device, SUUNTO_VYPER_SAMPLING_RATE, &data, 1);
|
||||||
|
@ -879,34 +878,34 @@ void WriteSettingsThread::run()
|
||||||
data2[1] = (int)(mm_to_feet(m_deviceDetails->alarmDepth()) * 128) & 0x0FF;
|
data2[1] = (int)(mm_to_feet(m_deviceDetails->alarmDepth()) * 128) & 0x0FF;
|
||||||
dc_device_write(m_data->device, SUUNTO_VYPER_ALARM_DEPTH, data2, 2);
|
dc_device_write(m_data->device, SUUNTO_VYPER_ALARM_DEPTH, data2, 2);
|
||||||
break;
|
break;
|
||||||
#if DC_VERSION_CHECK(0,5,0)
|
#if DC_VERSION_CHECK(0, 5, 0)
|
||||||
case DC_FAMILY_HW_OSTC3: {
|
case DC_FAMILY_HW_OSTC3: {
|
||||||
supported = true;
|
supported = true;
|
||||||
//write gas values
|
//write gas values
|
||||||
unsigned char gas1Data[4] = {m_deviceDetails->gas1().oxygen,
|
unsigned char gas1Data[4] = { m_deviceDetails->gas1().oxygen,
|
||||||
m_deviceDetails->gas1().helium,
|
m_deviceDetails->gas1().helium,
|
||||||
m_deviceDetails->gas1().type,
|
m_deviceDetails->gas1().type,
|
||||||
m_deviceDetails->gas1().depth};
|
m_deviceDetails->gas1().depth };
|
||||||
|
|
||||||
unsigned char gas2Data[4] = {m_deviceDetails->gas2().oxygen,
|
unsigned char gas2Data[4] = { m_deviceDetails->gas2().oxygen,
|
||||||
m_deviceDetails->gas2().helium,
|
m_deviceDetails->gas2().helium,
|
||||||
m_deviceDetails->gas2().type,
|
m_deviceDetails->gas2().type,
|
||||||
m_deviceDetails->gas2().depth};
|
m_deviceDetails->gas2().depth };
|
||||||
|
|
||||||
unsigned char gas3Data[4] = {m_deviceDetails->gas3().oxygen,
|
unsigned char gas3Data[4] = { m_deviceDetails->gas3().oxygen,
|
||||||
m_deviceDetails->gas3().helium,
|
m_deviceDetails->gas3().helium,
|
||||||
m_deviceDetails->gas3().type,
|
m_deviceDetails->gas3().type,
|
||||||
m_deviceDetails->gas3().depth};
|
m_deviceDetails->gas3().depth };
|
||||||
|
|
||||||
unsigned char gas4Data[4] = {m_deviceDetails->gas4().oxygen,
|
unsigned char gas4Data[4] = { m_deviceDetails->gas4().oxygen,
|
||||||
m_deviceDetails->gas4().helium,
|
m_deviceDetails->gas4().helium,
|
||||||
m_deviceDetails->gas4().type,
|
m_deviceDetails->gas4().type,
|
||||||
m_deviceDetails->gas4().depth};
|
m_deviceDetails->gas4().depth };
|
||||||
|
|
||||||
unsigned char gas5Data[4] = {m_deviceDetails->gas5().oxygen,
|
unsigned char gas5Data[4] = { m_deviceDetails->gas5().oxygen,
|
||||||
m_deviceDetails->gas5().helium,
|
m_deviceDetails->gas5().helium,
|
||||||
m_deviceDetails->gas5().type,
|
m_deviceDetails->gas5().type,
|
||||||
m_deviceDetails->gas5().depth};
|
m_deviceDetails->gas5().depth };
|
||||||
//gas 1
|
//gas 1
|
||||||
hw_ostc3_device_config_write(m_data->device, OSTC3_GAS1, gas1Data, sizeof(gas1Data));
|
hw_ostc3_device_config_write(m_data->device, OSTC3_GAS1, gas1Data, sizeof(gas1Data));
|
||||||
//gas 2
|
//gas 2
|
||||||
|
@ -919,20 +918,20 @@ void WriteSettingsThread::run()
|
||||||
hw_ostc3_device_config_write(m_data->device, OSTC3_GAS5, gas5Data, sizeof(gas5Data));
|
hw_ostc3_device_config_write(m_data->device, OSTC3_GAS5, gas5Data, sizeof(gas5Data));
|
||||||
|
|
||||||
//write set point values
|
//write set point values
|
||||||
unsigned char sp1Data[2] = {m_deviceDetails->sp1().sp,
|
unsigned char sp1Data[2] = { m_deviceDetails->sp1().sp,
|
||||||
m_deviceDetails->sp1().depth};
|
m_deviceDetails->sp1().depth };
|
||||||
|
|
||||||
unsigned char sp2Data[2] = {m_deviceDetails->sp2().sp,
|
unsigned char sp2Data[2] = { m_deviceDetails->sp2().sp,
|
||||||
m_deviceDetails->sp2().depth};
|
m_deviceDetails->sp2().depth };
|
||||||
|
|
||||||
unsigned char sp3Data[2] = {m_deviceDetails->sp3().sp,
|
unsigned char sp3Data[2] = { m_deviceDetails->sp3().sp,
|
||||||
m_deviceDetails->sp3().depth};
|
m_deviceDetails->sp3().depth };
|
||||||
|
|
||||||
unsigned char sp4Data[2] = {m_deviceDetails->sp4().sp,
|
unsigned char sp4Data[2] = { m_deviceDetails->sp4().sp,
|
||||||
m_deviceDetails->sp4().depth};
|
m_deviceDetails->sp4().depth };
|
||||||
|
|
||||||
unsigned char sp5Data[2] = {m_deviceDetails->sp5().sp,
|
unsigned char sp5Data[2] = { m_deviceDetails->sp5().sp,
|
||||||
m_deviceDetails->sp5().depth};
|
m_deviceDetails->sp5().depth };
|
||||||
|
|
||||||
//sp 1
|
//sp 1
|
||||||
hw_ostc3_device_config_write(m_data->device, OSTC3_SP1, sp1Data, sizeof(sp1Data));
|
hw_ostc3_device_config_write(m_data->device, OSTC3_SP1, sp1Data, sizeof(sp1Data));
|
||||||
|
@ -946,30 +945,30 @@ void WriteSettingsThread::run()
|
||||||
hw_ostc3_device_config_write(m_data->device, OSTC3_SP5, sp5Data, sizeof(sp5Data));
|
hw_ostc3_device_config_write(m_data->device, OSTC3_SP5, sp5Data, sizeof(sp5Data));
|
||||||
|
|
||||||
//write dil values
|
//write dil values
|
||||||
unsigned char dil1Data[4] = {m_deviceDetails->dil1().oxygen,
|
unsigned char dil1Data[4] = { m_deviceDetails->dil1().oxygen,
|
||||||
m_deviceDetails->dil1().helium,
|
m_deviceDetails->dil1().helium,
|
||||||
m_deviceDetails->dil1().type,
|
m_deviceDetails->dil1().type,
|
||||||
m_deviceDetails->dil1().depth};
|
m_deviceDetails->dil1().depth };
|
||||||
|
|
||||||
unsigned char dil2Data[4] = {m_deviceDetails->dil2().oxygen,
|
unsigned char dil2Data[4] = { m_deviceDetails->dil2().oxygen,
|
||||||
m_deviceDetails->dil2().helium,
|
m_deviceDetails->dil2().helium,
|
||||||
m_deviceDetails->dil2().type,
|
m_deviceDetails->dil2().type,
|
||||||
m_deviceDetails->dil2().depth};
|
m_deviceDetails->dil2().depth };
|
||||||
|
|
||||||
unsigned char dil3Data[4] = {m_deviceDetails->dil3().oxygen,
|
unsigned char dil3Data[4] = { m_deviceDetails->dil3().oxygen,
|
||||||
m_deviceDetails->dil3().helium,
|
m_deviceDetails->dil3().helium,
|
||||||
m_deviceDetails->dil3().type,
|
m_deviceDetails->dil3().type,
|
||||||
m_deviceDetails->dil3().depth};
|
m_deviceDetails->dil3().depth };
|
||||||
|
|
||||||
unsigned char dil4Data[4] = {m_deviceDetails->dil4().oxygen,
|
unsigned char dil4Data[4] = { m_deviceDetails->dil4().oxygen,
|
||||||
m_deviceDetails->dil4().helium,
|
m_deviceDetails->dil4().helium,
|
||||||
m_deviceDetails->dil4().type,
|
m_deviceDetails->dil4().type,
|
||||||
m_deviceDetails->dil4().depth};
|
m_deviceDetails->dil4().depth };
|
||||||
|
|
||||||
unsigned char dil5Data[4] = {m_deviceDetails->dil5().oxygen,
|
unsigned char dil5Data[4] = { m_deviceDetails->dil5().oxygen,
|
||||||
m_deviceDetails->dil5().helium,
|
m_deviceDetails->dil5().helium,
|
||||||
m_deviceDetails->dil5().type,
|
m_deviceDetails->dil5().type,
|
||||||
m_deviceDetails->dil5().depth};
|
m_deviceDetails->dil5().depth };
|
||||||
//dil 1
|
//dil 1
|
||||||
hw_ostc3_device_config_write(m_data->device, OSTC3_DIL1, dil1Data, sizeof(gas1Data));
|
hw_ostc3_device_config_write(m_data->device, OSTC3_DIL1, dil1Data, sizeof(gas1Data));
|
||||||
//dil 2
|
//dil 2
|
||||||
|
@ -986,7 +985,7 @@ void WriteSettingsThread::run()
|
||||||
//custom text
|
//custom text
|
||||||
hw_ostc3_device_customtext(m_data->device, m_deviceDetails->customText().toUtf8().data());
|
hw_ostc3_device_customtext(m_data->device, m_deviceDetails->customText().toUtf8().data());
|
||||||
|
|
||||||
unsigned char data[1] = {0};
|
unsigned char data[1] = { 0 };
|
||||||
#define WRITE_SETTING(_OSTC3_SETTING, _DEVICE_DETAIL) \
|
#define WRITE_SETTING(_OSTC3_SETTING, _DEVICE_DETAIL) \
|
||||||
do { \
|
do { \
|
||||||
data[0] = m_deviceDetails->_DEVICE_DETAIL(); \
|
data[0] = m_deviceDetails->_DEVICE_DETAIL(); \
|
||||||
|
@ -1023,7 +1022,7 @@ void WriteSettingsThread::run()
|
||||||
#undef WRITE_SETTING
|
#undef WRITE_SETTING
|
||||||
|
|
||||||
// OSTC3 stores the pressureSensorOffset in two-complement
|
// OSTC3 stores the pressureSensorOffset in two-complement
|
||||||
data[0] = (unsigned char) m_deviceDetails->pressureSensorOffset();
|
data[0] = (unsigned char)m_deviceDetails->pressureSensorOffset();
|
||||||
hw_ostc3_device_config_write(m_data->device, OSTC3_PRESSURE_SENSOR_OFFSET, data, sizeof(data));
|
hw_ostc3_device_config_write(m_data->device, OSTC3_PRESSURE_SENSOR_OFFSET, data, sizeof(data));
|
||||||
|
|
||||||
//sync date and time
|
//sync date and time
|
||||||
|
@ -1112,11 +1111,11 @@ void WriteSettingsThread::run()
|
||||||
data[33] = 4;
|
data[33] = 4;
|
||||||
else if (gas5.type == 2)
|
else if (gas5.type == 2)
|
||||||
data[33] = 5;
|
data[33] = 5;
|
||||||
else {
|
else
|
||||||
// FIXME: No gas was First?
|
// FIXME: No gas was First?
|
||||||
// Set gas 1 to first
|
// Set gas 1 to first
|
||||||
data[33] = 1;
|
data[33] = 1;
|
||||||
}
|
|
||||||
data[34] = m_deviceDetails->decoType();
|
data[34] = m_deviceDetails->decoType();
|
||||||
//Byte36:
|
//Byte36:
|
||||||
//Use O2 Sensor Module in CC Modes (0= OFF, 1= ON) (Only available in old OSTC1 - unused for OSTC Mk.2/2N)
|
//Use O2 Sensor Module in CC Modes (0= OFF, 1= ON) (Only available in old OSTC1 - unused for OSTC Mk.2/2N)
|
||||||
|
@ -1165,12 +1164,12 @@ void WriteSettingsThread::run()
|
||||||
// Byte66-90:
|
// Byte66-90:
|
||||||
// (25Bytes): Custom Text for Surfacemode (Real text must end with "}")
|
// (25Bytes): Custom Text for Surfacemode (Real text must end with "}")
|
||||||
// Example: OSTC Dive Computer} (19 Characters incl. "}") Bytes 85-90 will be ignored.
|
// Example: OSTC Dive Computer} (19 Characters incl. "}") Bytes 85-90 will be ignored.
|
||||||
if (m_deviceDetails->customText() == "")
|
if (m_deviceDetails->customText() == "") {
|
||||||
data[64] = 0;
|
data[64] = 0;
|
||||||
else {
|
} else {
|
||||||
data[64] = 1;
|
data[64] = 1;
|
||||||
// Copy the string to the right place in the memory, padded with 0x20 (" ")
|
// Copy the string to the right place in the memory, padded with 0x20 (" ")
|
||||||
strncpy((char *) data + 65, QString("%1").arg(m_deviceDetails->customText(), -23, QChar(' ')).toUtf8().data(), 23);
|
strncpy((char *)data + 65, QString("%1").arg(m_deviceDetails->customText(), -23, QChar(' ')).toUtf8().data(), 23);
|
||||||
// And terminate the string.
|
// And terminate the string.
|
||||||
if (m_deviceDetails->customText().length() <= 23)
|
if (m_deviceDetails->customText().length() <= 23)
|
||||||
data[65 + m_deviceDetails->customText().length()] = '}';
|
data[65 + m_deviceDetails->customText().length()] = '}';
|
||||||
|
@ -1239,11 +1238,11 @@ void WriteSettingsThread::run()
|
||||||
data[115] = 4;
|
data[115] = 4;
|
||||||
else if (dil5.type == 2)
|
else if (dil5.type == 2)
|
||||||
data[115] = 5;
|
data[115] = 5;
|
||||||
else {
|
else
|
||||||
// FIXME: No first diluent?
|
// FIXME: No first diluent?
|
||||||
// Set gas 1 to fist
|
// Set gas 1 to fist
|
||||||
data[115] = 1;
|
data[115] = 1;
|
||||||
}
|
|
||||||
// Byte117-128:
|
// Byte117-128:
|
||||||
// not used/reserved
|
// not used/reserved
|
||||||
// Byte129-256:
|
// Byte129-256:
|
||||||
|
@ -1264,7 +1263,7 @@ void WriteSettingsThread::run()
|
||||||
write_ostc_cf(data, 29, max_CF, m_deviceDetails->lastDeco());
|
write_ostc_cf(data, 29, max_CF, m_deviceDetails->lastDeco());
|
||||||
|
|
||||||
#ifdef DEBUG_OSTC_CF
|
#ifdef DEBUG_OSTC_CF
|
||||||
for(int cf = 0; cf <= 31 && cf <= max_CF; cf++)
|
for (int cf = 0; cf <= 31 && cf <= max_CF; cf++)
|
||||||
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
||||||
#endif
|
#endif
|
||||||
rc = hw_ostc_device_eeprom_write(m_data->device, 0, data, sizeof(data));
|
rc = hw_ostc_device_eeprom_write(m_data->device, 0, data, sizeof(data));
|
||||||
|
@ -1295,7 +1294,7 @@ void WriteSettingsThread::run()
|
||||||
// CF58: Future time to surface setFutureTTS
|
// CF58: Future time to surface setFutureTTS
|
||||||
write_ostc_cf(data, 58, max_CF, m_deviceDetails->futureTTS());
|
write_ostc_cf(data, 58, max_CF, m_deviceDetails->futureTTS());
|
||||||
#ifdef DEBUG_OSTC_CF
|
#ifdef DEBUG_OSTC_CF
|
||||||
for(int cf = 32; cf <= 63 && cf <= max_CF; cf++)
|
for (int cf = 32; cf <= 63 && cf <= max_CF; cf++)
|
||||||
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
||||||
#endif
|
#endif
|
||||||
rc = hw_ostc_device_eeprom_write(m_data->device, 1, data, sizeof(data));
|
rc = hw_ostc_device_eeprom_write(m_data->device, 1, data, sizeof(data));
|
||||||
|
@ -1322,7 +1321,7 @@ void WriteSettingsThread::run()
|
||||||
// CF69: Allow Gradient Factor change
|
// CF69: Allow Gradient Factor change
|
||||||
write_ostc_cf(data, 69, max_CF, m_deviceDetails->aGFSelectable());
|
write_ostc_cf(data, 69, max_CF, m_deviceDetails->aGFSelectable());
|
||||||
#ifdef DEBUG_OSTC_CF
|
#ifdef DEBUG_OSTC_CF
|
||||||
for(int cf = 64; cf <= 95 && cf <= max_CF; cf++)
|
for (int cf = 64; cf <= 95 && cf <= max_CF; cf++)
|
||||||
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
printf("CF %d: %d\n", cf, read_ostc_cf(data, cf));
|
||||||
#endif
|
#endif
|
||||||
rc = hw_ostc_device_eeprom_write(m_data->device, 2, data, sizeof(data));
|
rc = hw_ostc_device_eeprom_write(m_data->device, 2, data, sizeof(data));
|
||||||
|
@ -1357,29 +1356,30 @@ void WriteSettingsThread::run()
|
||||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
lastError = tr("This feature is not yet available for the selected dive computer.");
|
||||||
emit error(lastError);
|
emit error(lastError);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lastError = tr("Could not a establish connection to the dive computer.");
|
lastError = tr("Could not a establish connection to the dive computer.");
|
||||||
emit error(lastError);
|
emit error(lastError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName)
|
FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName) : QThread(parent), m_data(data), m_fileName(fileName)
|
||||||
: QThread(parent), m_data(data), m_fileName(fileName)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void FirmwareUpdateThread::run()
|
void FirmwareUpdateThread::run()
|
||||||
{
|
{
|
||||||
|
qDebug() << "in FirmwareUpdateThread::run";
|
||||||
bool supported = false;
|
bool supported = false;
|
||||||
dc_status_t rc;
|
dc_status_t rc;
|
||||||
rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
|
rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
|
||||||
|
qDebug() << "got" << rc << "as return for dc_device_open of" << m_data->devname;
|
||||||
if (rc == DC_STATUS_SUCCESS) {
|
if (rc == DC_STATUS_SUCCESS) {
|
||||||
switch (dc_device_get_type(m_data->device)) {
|
switch (dc_device_get_type(m_data->device)) {
|
||||||
#if DC_VERSION_CHECK(0, 5, 0)
|
#if DC_VERSION_CHECK(0, 5, 0)
|
||||||
case DC_FAMILY_HW_OSTC3:
|
case DC_FAMILY_HW_OSTC3:
|
||||||
supported = true;
|
supported = true;
|
||||||
|
qDebug() << "it's an OSTC3, let's do it!";
|
||||||
rc = hw_ostc3_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
|
rc = hw_ostc3_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
|
||||||
break;
|
break;
|
||||||
case DC_FAMILY_HW_OSTC:
|
case DC_FAMILY_HW_OSTC:
|
||||||
|
@ -1399,16 +1399,14 @@ void FirmwareUpdateThread::run()
|
||||||
} else if (rc != DC_STATUS_SUCCESS) {
|
} else if (rc != DC_STATUS_SUCCESS) {
|
||||||
lastError = tr("Firmware update failed!");
|
lastError = tr("Firmware update failed!");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lastError = tr("Could not a establish connection to the dive computer.");
|
lastError = tr("Could not a establish connection to the dive computer.");
|
||||||
emit error(lastError);
|
emit error(lastError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ResetSettingsThread::ResetSettingsThread(QObject *parent, device_data_t *data)
|
ResetSettingsThread::ResetSettingsThread(QObject *parent, device_data_t *data) : QThread(parent), m_data(data)
|
||||||
: QThread(parent), m_data(data)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1430,8 +1428,7 @@ void ResetSettingsThread::run()
|
||||||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
lastError = tr("This feature is not yet available for the selected dive computer.");
|
||||||
emit error(lastError);
|
emit error(lastError);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
lastError = tr("Could not a establish connection to the dive computer.");
|
lastError = tr("Could not a establish connection to the dive computer.");
|
||||||
emit error(lastError);
|
emit error(lastError);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,7 @@
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include "devicedetails.h"
|
#include "devicedetails.h"
|
||||||
|
|
||||||
class ReadSettingsThread : public QThread
|
class ReadSettingsThread : public QThread {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ReadSettingsThread(QObject *parent, device_data_t *data);
|
ReadSettingsThread(QObject *parent, device_data_t *data);
|
||||||
|
@ -19,12 +18,12 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void error(QString err);
|
void error(QString err);
|
||||||
void devicedetails(DeviceDetails *newDeviceDetails);
|
void devicedetails(DeviceDetails *newDeviceDetails);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
device_data_t *m_data;
|
device_data_t *m_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
class WriteSettingsThread : public QThread
|
class WriteSettingsThread : public QThread {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
WriteSettingsThread(QObject *parent, device_data_t *data);
|
WriteSettingsThread(QObject *parent, device_data_t *data);
|
||||||
|
@ -34,13 +33,13 @@ public:
|
||||||
QString lastError;
|
QString lastError;
|
||||||
signals:
|
signals:
|
||||||
void error(QString err);
|
void error(QString err);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
device_data_t *m_data;
|
device_data_t *m_data;
|
||||||
DeviceDetails *m_deviceDetails;
|
DeviceDetails *m_deviceDetails;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FirmwareUpdateThread : public QThread
|
class FirmwareUpdateThread : public QThread {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName);
|
FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName);
|
||||||
|
@ -50,13 +49,13 @@ signals:
|
||||||
void progress(int percent);
|
void progress(int percent);
|
||||||
void message(QString msg);
|
void message(QString msg);
|
||||||
void error(QString err);
|
void error(QString err);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
device_data_t *m_data;
|
device_data_t *m_data;
|
||||||
QString m_fileName;
|
QString m_fileName;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ResetSettingsThread : public QThread
|
class ResetSettingsThread : public QThread {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ResetSettingsThread(QObject *parent, device_data_t *data);
|
ResetSettingsThread(QObject *parent, device_data_t *data);
|
||||||
|
@ -66,6 +65,7 @@ signals:
|
||||||
void progress(int percent);
|
void progress(int percent);
|
||||||
void message(QString msg);
|
void message(QString msg);
|
||||||
void error(QString err);
|
void error(QString err);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
device_data_t *m_data;
|
device_data_t *m_data;
|
||||||
};
|
};
|
||||||
|
|
31
profile.c
31
profile.c
|
@ -435,7 +435,7 @@ static void check_setpoint_events(struct dive *dive, struct divecomputer *dc, st
|
||||||
do {
|
do {
|
||||||
i = set_setpoint(pi, i, setpoint.mbar, ev->time.seconds);
|
i = set_setpoint(pi, i, setpoint.mbar, ev->time.seconds);
|
||||||
setpoint.mbar = ev->value;
|
setpoint.mbar = ev->value;
|
||||||
if(setpoint.mbar)
|
if (setpoint.mbar)
|
||||||
dc->dctype = CCR;
|
dc->dctype = CCR;
|
||||||
ev = get_next_event(ev->next, "SP change");
|
ev = get_next_event(ev->next, "SP change");
|
||||||
} while (ev);
|
} while (ev);
|
||||||
|
@ -616,7 +616,7 @@ struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *
|
||||||
entry->pressures.o2 = sample->setpoint.mbar / 1000.0;
|
entry->pressures.o2 = sample->setpoint.mbar / 1000.0;
|
||||||
}
|
}
|
||||||
/* FIXME! sensor index -> cylinder index translation! */
|
/* FIXME! sensor index -> cylinder index translation! */
|
||||||
// entry->cylinderindex = sample->sensor;
|
// entry->cylinderindex = sample->sensor;
|
||||||
SENSOR_PRESSURE(entry) = sample->cylinderpressure.mbar;
|
SENSOR_PRESSURE(entry) = sample->cylinderpressure.mbar;
|
||||||
O2CYLINDER_PRESSURE(entry) = sample->o2cylinderpressure.mbar;
|
O2CYLINDER_PRESSURE(entry) = sample->o2cylinderpressure.mbar;
|
||||||
if (sample->temperature.mkelvin)
|
if (sample->temperature.mkelvin)
|
||||||
|
@ -773,7 +773,7 @@ static void calculate_ndl_tts(double tissue_tolerance, struct plot_data *entry,
|
||||||
while (entry->ndl_calc < max_ndl && deco_allowed_depth(tissue_tolerance, surface_pressure, dive, 1) <= 0) {
|
while (entry->ndl_calc < max_ndl && deco_allowed_depth(tissue_tolerance, surface_pressure, dive, 1) <= 0) {
|
||||||
entry->ndl_calc += time_stepsize;
|
entry->ndl_calc += time_stepsize;
|
||||||
tissue_tolerance = add_segment(depth_to_mbar(entry->depth, dive) / 1000.0,
|
tissue_tolerance = add_segment(depth_to_mbar(entry->depth, dive) / 1000.0,
|
||||||
&dive->cylinder[cylinderindex].gasmix, time_stepsize, entry->o2pressure.mbar , dive, prefs.bottomsac);
|
&dive->cylinder[cylinderindex].gasmix, time_stepsize, entry->o2pressure.mbar, dive, prefs.bottomsac);
|
||||||
}
|
}
|
||||||
/* we don't need to calculate anything else */
|
/* we don't need to calculate anything else */
|
||||||
return;
|
return;
|
||||||
|
@ -785,7 +785,7 @@ static void calculate_ndl_tts(double tissue_tolerance, struct plot_data *entry,
|
||||||
/* Add segments for movement to stopdepth */
|
/* Add segments for movement to stopdepth */
|
||||||
for (; ascent_depth > next_stop; ascent_depth -= ascent_mm_per_step, entry->tts_calc += ascent_s_per_step) {
|
for (; ascent_depth > next_stop; ascent_depth -= ascent_mm_per_step, entry->tts_calc += ascent_s_per_step) {
|
||||||
tissue_tolerance = add_segment(depth_to_mbar(ascent_depth, dive) / 1000.0,
|
tissue_tolerance = add_segment(depth_to_mbar(ascent_depth, dive) / 1000.0,
|
||||||
&dive->cylinder[cylinderindex].gasmix, ascent_s_per_step, entry->o2pressure.mbar , dive, prefs.decosac);
|
&dive->cylinder[cylinderindex].gasmix, ascent_s_per_step, entry->o2pressure.mbar, dive, prefs.decosac);
|
||||||
next_stop = ROUND_UP(deco_allowed_depth(tissue_tolerance, surface_pressure, dive, 1), deco_stepsize);
|
next_stop = ROUND_UP(deco_allowed_depth(tissue_tolerance, surface_pressure, dive, 1), deco_stepsize);
|
||||||
}
|
}
|
||||||
ascent_depth = next_stop;
|
ascent_depth = next_stop;
|
||||||
|
@ -829,9 +829,11 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
|
||||||
int j, t0 = (entry - 1)->sec, t1 = entry->sec;
|
int j, t0 = (entry - 1)->sec, t1 = entry->sec;
|
||||||
int time_stepsize = 20;
|
int time_stepsize = 20;
|
||||||
|
|
||||||
entry->ambpressure = (double) depth_to_mbar(entry->depth, dive) / 1000.0;
|
entry->ambpressure = (double)depth_to_mbar(entry->depth, dive) / 1000.0;
|
||||||
entry->gfline = MAX((double) prefs.gflow, (entry->ambpressure - surface_pressure) / (gf_low_pressure_this_dive - surface_pressure) *
|
entry->gfline = MAX((double)prefs.gflow, (entry->ambpressure - surface_pressure) / (gf_low_pressure_this_dive - surface_pressure) *
|
||||||
(prefs.gflow - prefs.gfhigh) + prefs.gfhigh) * (100.0 - AMB_PERCENTAGE) / 100.0 + AMB_PERCENTAGE;
|
(prefs.gflow - prefs.gfhigh) +
|
||||||
|
prefs.gfhigh) *
|
||||||
|
(100.0 - AMB_PERCENTAGE) / 100.0 + AMB_PERCENTAGE;
|
||||||
if (t0 != t1 && t1 - t0 < time_stepsize)
|
if (t0 != t1 && t1 - t0 < time_stepsize)
|
||||||
time_stepsize = t1 - t0;
|
time_stepsize = t1 - t0;
|
||||||
for (j = t0 + time_stepsize; j <= t1; j += time_stepsize) {
|
for (j = t0 + time_stepsize; j <= t1; j += time_stepsize) {
|
||||||
|
@ -888,12 +890,13 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
|
||||||
* calculates the po2 value from the sensor data. Several rules are applied, depending on how many o2 sensors
|
* calculates the po2 value from the sensor data. Several rules are applied, depending on how many o2 sensors
|
||||||
* there are and the differences among the readings from these sensors.
|
* there are and the differences among the readings from these sensors.
|
||||||
*/
|
*/
|
||||||
static int calculate_ccr_po2(struct plot_data *entry, struct divecomputer *dc) {
|
static int calculate_ccr_po2(struct plot_data *entry, struct divecomputer *dc)
|
||||||
|
{
|
||||||
int sump = 0, minp = 999999, maxp = -999999;
|
int sump = 0, minp = 999999, maxp = -999999;
|
||||||
int diff_limit = 100; // The limit beyond which O2 sensor differences are considered significant (default = 100 mbar)
|
int diff_limit = 100; // The limit beyond which O2 sensor differences are considered significant (default = 100 mbar)
|
||||||
int i, np = 0;
|
int i, np = 0;
|
||||||
|
|
||||||
for (i=0; i < dc->no_o2sensors; i++)
|
for (i = 0; i < dc->no_o2sensors; i++)
|
||||||
if (entry->o2sensor[i].mbar) { // Valid reading
|
if (entry->o2sensor[i].mbar) { // Valid reading
|
||||||
++np;
|
++np;
|
||||||
sump += entry->o2sensor[i].mbar;
|
sump += entry->o2sensor[i].mbar;
|
||||||
|
@ -938,8 +941,8 @@ static void calculate_gas_information_new(struct dive *dive, struct plot_info *p
|
||||||
amb_pressure = depth_to_mbar(entry->depth, dive) / 1000.0;
|
amb_pressure = depth_to_mbar(entry->depth, dive) / 1000.0;
|
||||||
|
|
||||||
fill_pressures(&entry->pressures, amb_pressure, &dive->cylinder[cylinderindex].gasmix, entry->o2pressure.mbar / 1000.0, dive->dc.dctype, entry->sac);
|
fill_pressures(&entry->pressures, amb_pressure, &dive->cylinder[cylinderindex].gasmix, entry->o2pressure.mbar / 1000.0, dive->dc.dctype, entry->sac);
|
||||||
fn2 = (int) (1000.0 * entry->pressures.n2 / amb_pressure);
|
fn2 = (int)(1000.0 * entry->pressures.n2 / amb_pressure);
|
||||||
fhe = (int) (1000.0 * entry->pressures.he / amb_pressure);
|
fhe = (int)(1000.0 * entry->pressures.he / amb_pressure);
|
||||||
|
|
||||||
/* Calculate MOD, EAD, END and EADD based on partial pressures calculated before
|
/* Calculate MOD, EAD, END and EADD based on partial pressures calculated before
|
||||||
* so there is no difference in calculating between OC and CC
|
* so there is no difference in calculating between OC and CC
|
||||||
|
@ -993,7 +996,7 @@ void fill_o2_values(struct divecomputer *dc, struct plot_info *pi, struct dive *
|
||||||
entry->o2sensor[j].mbar = last_sensor[j].mbar;
|
entry->o2sensor[j].mbar = last_sensor[j].mbar;
|
||||||
} // having initialised the empty o2 sensor values for this point on the profile,
|
} // having initialised the empty o2 sensor values for this point on the profile,
|
||||||
amb_pressure.mbar = depth_to_mbar(entry->depth, dive);
|
amb_pressure.mbar = depth_to_mbar(entry->depth, dive);
|
||||||
o2pressure.mbar = calculate_ccr_po2(entry,dc); // ...calculate the po2 based on the sensor data
|
o2pressure.mbar = calculate_ccr_po2(entry, dc); // ...calculate the po2 based on the sensor data
|
||||||
entry->o2pressure.mbar = MIN(o2pressure.mbar, amb_pressure.mbar);
|
entry->o2pressure.mbar = MIN(o2pressure.mbar, amb_pressure.mbar);
|
||||||
} else {
|
} else {
|
||||||
entry->o2pressure.mbar = 0; // initialise po2 to zero for dctype = OC
|
entry->o2pressure.mbar = 0; // initialise po2 to zero for dctype = OC
|
||||||
|
@ -1010,9 +1013,9 @@ static void debug_print_profiledata(struct plot_info *pi)
|
||||||
FILE *f1;
|
FILE *f1;
|
||||||
struct plot_data *entry;
|
struct plot_data *entry;
|
||||||
int i;
|
int i;
|
||||||
if (!(f1 = fopen("debug_print_profiledata.dat", "w")))
|
if (!(f1 = fopen("debug_print_profiledata.dat", "w"))) {
|
||||||
printf("File open error for: debug_print_profiledata.dat\n");
|
printf("File open error for: debug_print_profiledata.dat\n");
|
||||||
else {
|
} else {
|
||||||
fprintf(f1, "id t1 gas gasint t2 t3 dil dilint t4 t5 setpoint sensor1 sensor2 sensor3 t6 po2 fo2\n");
|
fprintf(f1, "id t1 gas gasint t2 t3 dil dilint t4 t5 setpoint sensor1 sensor2 sensor3 t6 po2 fo2\n");
|
||||||
for (i = 0; i < pi->nr; i++) {
|
for (i = 0; i < pi->nr; i++) {
|
||||||
entry = pi->entry + i;
|
entry = pi->entry + i;
|
||||||
|
|
|
@ -37,10 +37,14 @@ struct mydescriptor {
|
||||||
unsigned int model;
|
unsigned int model;
|
||||||
};
|
};
|
||||||
|
|
||||||
GasSpinBoxItemDelegate::GasSpinBoxItemDelegate(QObject *parent, column_type type) : QStyledItemDelegate(parent), type(type) { }
|
GasSpinBoxItemDelegate::GasSpinBoxItemDelegate(QObject *parent, column_type type) : QStyledItemDelegate(parent), type(type)
|
||||||
GasSpinBoxItemDelegate::~GasSpinBoxItemDelegate() { }
|
{
|
||||||
|
}
|
||||||
|
GasSpinBoxItemDelegate::~GasSpinBoxItemDelegate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QWidget* GasSpinBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QWidget *GasSpinBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
// Create the spinbox and give it it's settings
|
// Create the spinbox and give it it's settings
|
||||||
QSpinBox *sb = new QSpinBox(parent);
|
QSpinBox *sb = new QSpinBox(parent);
|
||||||
|
@ -58,7 +62,7 @@ QWidget* GasSpinBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptio
|
||||||
|
|
||||||
void GasSpinBoxItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
void GasSpinBoxItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(QSpinBox *sb = qobject_cast<QSpinBox *>(editor))
|
if (QSpinBox *sb = qobject_cast<QSpinBox *>(editor))
|
||||||
sb->setValue(index.data(Qt::EditRole).toInt());
|
sb->setValue(index.data(Qt::EditRole).toInt());
|
||||||
else
|
else
|
||||||
QStyledItemDelegate::setEditorData(editor, index);
|
QStyledItemDelegate::setEditorData(editor, index);
|
||||||
|
@ -67,16 +71,20 @@ void GasSpinBoxItemDelegate::setEditorData(QWidget *editor, const QModelIndex &i
|
||||||
|
|
||||||
void GasSpinBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
void GasSpinBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(QSpinBox *sb = qobject_cast<QSpinBox *>(editor))
|
if (QSpinBox *sb = qobject_cast<QSpinBox *>(editor))
|
||||||
model->setData(index, sb->value(), Qt::EditRole);
|
model->setData(index, sb->value(), Qt::EditRole);
|
||||||
else
|
else
|
||||||
QStyledItemDelegate::setModelData(editor, model, index);
|
QStyledItemDelegate::setModelData(editor, model, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
GasTypeComboBoxItemDelegate::GasTypeComboBoxItemDelegate(QObject *parent, computer_type type) : QStyledItemDelegate(parent), type(type) { }
|
GasTypeComboBoxItemDelegate::GasTypeComboBoxItemDelegate(QObject *parent, computer_type type) : QStyledItemDelegate(parent), type(type)
|
||||||
GasTypeComboBoxItemDelegate::~GasTypeComboBoxItemDelegate() { }
|
{
|
||||||
|
}
|
||||||
|
GasTypeComboBoxItemDelegate::~GasTypeComboBoxItemDelegate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
QWidget* GasTypeComboBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
QWidget *GasTypeComboBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
// Create the combobox and populate it
|
// Create the combobox and populate it
|
||||||
QComboBox *cb = new QComboBox(parent);
|
QComboBox *cb = new QComboBox(parent);
|
||||||
|
@ -94,7 +102,7 @@ QWidget* GasTypeComboBoxItemDelegate::createEditor(QWidget *parent, const QStyle
|
||||||
|
|
||||||
void GasTypeComboBoxItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
void GasTypeComboBoxItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(QComboBox *cb = qobject_cast<QComboBox *>(editor))
|
if (QComboBox *cb = qobject_cast<QComboBox *>(editor))
|
||||||
cb->setCurrentIndex(index.data(Qt::EditRole).toInt());
|
cb->setCurrentIndex(index.data(Qt::EditRole).toInt());
|
||||||
else
|
else
|
||||||
QStyledItemDelegate::setEditorData(editor, index);
|
QStyledItemDelegate::setEditorData(editor, index);
|
||||||
|
@ -103,14 +111,13 @@ void GasTypeComboBoxItemDelegate::setEditorData(QWidget *editor, const QModelInd
|
||||||
|
|
||||||
void GasTypeComboBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
void GasTypeComboBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if(QComboBox *cb = qobject_cast<QComboBox *>(editor))
|
if (QComboBox *cb = qobject_cast<QComboBox *>(editor))
|
||||||
model->setData(index, cb->currentIndex(), Qt::EditRole);
|
model->setData(index, cb->currentIndex(), Qt::EditRole);
|
||||||
else
|
else
|
||||||
QStyledItemDelegate::setModelData(editor, model, index);
|
QStyledItemDelegate::setModelData(editor, model, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
|
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent),
|
||||||
QDialog(parent),
|
|
||||||
config(0),
|
config(0),
|
||||||
deviceDetails(0)
|
deviceDetails(0)
|
||||||
{
|
{
|
||||||
|
@ -120,8 +127,8 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
|
||||||
config = new ConfigureDiveComputer();
|
config = new ConfigureDiveComputer();
|
||||||
connect(config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
|
connect(config, SIGNAL(error(QString)), this, SLOT(configError(QString)));
|
||||||
connect(config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
|
connect(config, SIGNAL(message(QString)), this, SLOT(configMessage(QString)));
|
||||||
connect(config, SIGNAL(deviceDetailsChanged(DeviceDetails*)),
|
connect(config, SIGNAL(deviceDetailsChanged(DeviceDetails *)),
|
||||||
this, SLOT(deviceDetailsReceived(DeviceDetails*)));
|
this, SLOT(deviceDetailsReceived(DeviceDetails *)));
|
||||||
connect(ui.retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
|
connect(ui.retrieveDetails, SIGNAL(clicked()), this, SLOT(readSettings()));
|
||||||
connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetSettings()));
|
connect(ui.resetButton, SIGNAL(clicked()), this, SLOT(resetSettings()));
|
||||||
|
|
||||||
|
@ -216,9 +223,9 @@ void OstcFirmwareCheck::parseOstcFwVersion(QNetworkReply *reply)
|
||||||
QString parse = reply->readAll();
|
QString parse = reply->readAll();
|
||||||
int firstOpenBracket = parse.indexOf('[');
|
int firstOpenBracket = parse.indexOf('[');
|
||||||
int firstCloseBracket = parse.indexOf(']');
|
int firstCloseBracket = parse.indexOf(']');
|
||||||
latestFirmwareAvailable = parse.mid(firstOpenBracket + 1, firstCloseBracket - firstOpenBracket -1);
|
latestFirmwareAvailable = parse.mid(firstOpenBracket + 1, firstCloseBracket - firstOpenBracket - 1);
|
||||||
qDebug() << "latest firmware available" << latestFirmwareAvailable;
|
qDebug() << "latest firmware available" << latestFirmwareAvailable;
|
||||||
disconnect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(parseOstcFwVersion(QNetworkReply*)));
|
disconnect(&manager, SIGNAL(finished(QNetworkReply *)), this, SLOT(parseOstcFwVersion(QNetworkReply *)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OstcFirmwareCheck::checkLatest(QWidget *_parent, device_data_t *data)
|
void OstcFirmwareCheck::checkLatest(QWidget *_parent, device_data_t *data)
|
||||||
|
@ -229,11 +236,12 @@ void OstcFirmwareCheck::checkLatest(QWidget *_parent, device_data_t *data)
|
||||||
// for the OSTC that means highbyte.lowbyte is the version number
|
// for the OSTC that means highbyte.lowbyte is the version number
|
||||||
int firmwareOnDevice = devData.libdc_firmware;
|
int firmwareOnDevice = devData.libdc_firmware;
|
||||||
QString firmware;
|
QString firmware;
|
||||||
firmware = QString("%1.%2").arg(firmwareOnDevice / 256). arg(firmwareOnDevice % 256);
|
firmware = QString("%1.%2").arg(firmwareOnDevice / 256).arg(firmwareOnDevice % 256);
|
||||||
if (!latestFirmwareAvailable.isEmpty() && latestFirmwareAvailable != firmware) {
|
if (!latestFirmwareAvailable.isEmpty() && latestFirmwareAvailable != firmware) {
|
||||||
QMessageBox response(parent);
|
QMessageBox response(parent);
|
||||||
QString message = tr("You should update the firmware on your dive computer: you have version %1 but the latest stable version is %2")
|
QString message = tr("You should update the firmware on your dive computer: you have version %1 but the latest stable version is %2")
|
||||||
.arg(firmware).arg(latestFirmwareAvailable);
|
.arg(firmware)
|
||||||
|
.arg(latestFirmwareAvailable);
|
||||||
response.addButton(tr("Not now"), QMessageBox::RejectRole);
|
response.addButton(tr("Not now"), QMessageBox::RejectRole);
|
||||||
response.addButton(tr("Update firmware"), QMessageBox::AcceptRole);
|
response.addButton(tr("Update firmware"), QMessageBox::AcceptRole);
|
||||||
response.setText(message);
|
response.setText(message);
|
||||||
|
@ -275,7 +283,9 @@ void OstcFirmwareCheck::saveOstcFirmware(QNetworkReply *reply)
|
||||||
file.open(QIODevice::WriteOnly);
|
file.open(QIODevice::WriteOnly);
|
||||||
file.write(firmwareData);
|
file.write(firmwareData);
|
||||||
file.close();
|
file.close();
|
||||||
|
qDebug() << "file closed";
|
||||||
ConfigureDiveComputer *config = new ConfigureDiveComputer();
|
ConfigureDiveComputer *config = new ConfigureDiveComputer();
|
||||||
|
qDebug() << "created config object, calling the firwmware uploader";
|
||||||
config->startFirmwareUpdate(storeFirmware, &devData);
|
config->startFirmwareUpdate(storeFirmware, &devData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +378,7 @@ void ConfigureDiveComputerDialog::fill_computer_list()
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::populateDeviceDetails()
|
void ConfigureDiveComputerDialog::populateDeviceDetails()
|
||||||
{
|
{
|
||||||
switch(ui.dcStackedWidget->currentIndex()) {
|
switch (ui.dcStackedWidget->currentIndex()) {
|
||||||
case 0:
|
case 0:
|
||||||
populateDeviceDetailsOSTC3();
|
populateDeviceDetailsOSTC3();
|
||||||
break;
|
break;
|
||||||
|
@ -468,7 +478,7 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC3()
|
||||||
dil2.oxygen = GET_INT_FROM(ui.ostc3DilTable->item(1, 1), 21);
|
dil2.oxygen = GET_INT_FROM(ui.ostc3DilTable->item(1, 1), 21);
|
||||||
dil2.helium = GET_INT_FROM(ui.ostc3DilTable->item(1, 2), 0);
|
dil2.helium = GET_INT_FROM(ui.ostc3DilTable->item(1, 2), 0);
|
||||||
dil2.type = GET_INT_FROM(ui.ostc3DilTable->item(1, 3), 0);
|
dil2.type = GET_INT_FROM(ui.ostc3DilTable->item(1, 3), 0);
|
||||||
dil2.depth = GET_INT_FROM(ui.ostc3DilTable->item(1, 4),0);
|
dil2.depth = GET_INT_FROM(ui.ostc3DilTable->item(1, 4), 0);
|
||||||
|
|
||||||
dil3.oxygen = GET_INT_FROM(ui.ostc3DilTable->item(2, 1), 21);
|
dil3.oxygen = GET_INT_FROM(ui.ostc3DilTable->item(2, 1), 21);
|
||||||
dil3.helium = GET_INT_FROM(ui.ostc3DilTable->item(2, 2), 0);
|
dil3.helium = GET_INT_FROM(ui.ostc3DilTable->item(2, 2), 0);
|
||||||
|
@ -594,7 +604,7 @@ void ConfigureDiveComputerDialog::populateDeviceDetailsOSTC()
|
||||||
dil2.oxygen = GET_INT_FROM(ui.ostcDilTable->item(1, 1), 21);
|
dil2.oxygen = GET_INT_FROM(ui.ostcDilTable->item(1, 1), 21);
|
||||||
dil2.helium = GET_INT_FROM(ui.ostcDilTable->item(1, 2), 0);
|
dil2.helium = GET_INT_FROM(ui.ostcDilTable->item(1, 2), 0);
|
||||||
dil2.type = GET_INT_FROM(ui.ostcDilTable->item(1, 3), 0);
|
dil2.type = GET_INT_FROM(ui.ostcDilTable->item(1, 3), 0);
|
||||||
dil2.depth = GET_INT_FROM(ui.ostcDilTable->item(1, 4),0);
|
dil2.depth = GET_INT_FROM(ui.ostcDilTable->item(1, 4), 0);
|
||||||
|
|
||||||
dil3.oxygen = GET_INT_FROM(ui.ostcDilTable->item(2, 1), 21);
|
dil3.oxygen = GET_INT_FROM(ui.ostcDilTable->item(2, 1), 21);
|
||||||
dil3.helium = GET_INT_FROM(ui.ostcDilTable->item(2, 2), 0);
|
dil3.helium = GET_INT_FROM(ui.ostcDilTable->item(2, 2), 0);
|
||||||
|
@ -728,7 +738,7 @@ void ConfigureDiveComputerDialog::reloadValues()
|
||||||
ui.saveSettingsPushButton->setEnabled(true);
|
ui.saveSettingsPushButton->setEnabled(true);
|
||||||
ui.backupButton->setEnabled(true);
|
ui.backupButton->setEnabled(true);
|
||||||
|
|
||||||
switch(ui.dcStackedWidget->currentIndex()) {
|
switch (ui.dcStackedWidget->currentIndex()) {
|
||||||
case 0:
|
case 0:
|
||||||
reloadValuesOSTC3();
|
reloadValuesOSTC3();
|
||||||
break;
|
break;
|
||||||
|
@ -775,64 +785,64 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3()
|
||||||
ui.setPointFallbackCheckBox->setChecked(deviceDetails->setPointFallback());
|
ui.setPointFallbackCheckBox->setChecked(deviceDetails->setPointFallback());
|
||||||
|
|
||||||
//load gas 1 values
|
//load gas 1 values
|
||||||
ui.ostc3GasTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
|
ui.ostc3GasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
|
||||||
ui.ostc3GasTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium)));
|
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, 3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type)));
|
||||||
ui.ostc3GasTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
|
ui.ostc3GasTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
|
||||||
|
|
||||||
//load gas 2 values
|
//load gas 2 values
|
||||||
ui.ostc3GasTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen)));
|
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, 2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium)));
|
||||||
ui.ostc3GasTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
|
ui.ostc3GasTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
|
||||||
ui.ostc3GasTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
|
ui.ostc3GasTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
|
||||||
|
|
||||||
//load gas 3 values
|
//load gas 3 values
|
||||||
ui.ostc3GasTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen)));
|
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, 2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium)));
|
||||||
ui.ostc3GasTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
|
ui.ostc3GasTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
|
||||||
ui.ostc3GasTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
|
ui.ostc3GasTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
|
||||||
|
|
||||||
//load gas 4 values
|
//load gas 4 values
|
||||||
ui.ostc3GasTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen)));
|
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, 2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium)));
|
||||||
ui.ostc3GasTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
|
ui.ostc3GasTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
|
||||||
ui.ostc3GasTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
|
ui.ostc3GasTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
|
||||||
|
|
||||||
//load gas 5 values
|
//load gas 5 values
|
||||||
ui.ostc3GasTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen)));
|
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, 2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium)));
|
||||||
ui.ostc3GasTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
|
ui.ostc3GasTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
|
||||||
ui.ostc3GasTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
|
ui.ostc3GasTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
|
||||||
|
|
||||||
//load dil 1 values
|
//load dil 1 values
|
||||||
ui.ostc3DilTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
|
ui.ostc3DilTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
|
||||||
ui.ostc3DilTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
|
ui.ostc3DilTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
|
||||||
ui.ostc3DilTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
|
ui.ostc3DilTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
|
||||||
ui.ostc3DilTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
|
ui.ostc3DilTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
|
||||||
|
|
||||||
//load dil 2 values
|
//load dil 2 values
|
||||||
ui.ostc3DilTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
|
ui.ostc3DilTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
|
||||||
ui.ostc3DilTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
|
ui.ostc3DilTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
|
||||||
ui.ostc3DilTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
|
ui.ostc3DilTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
|
||||||
ui.ostc3DilTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
|
ui.ostc3DilTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
|
||||||
|
|
||||||
//load dil 3 values
|
//load dil 3 values
|
||||||
ui.ostc3DilTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
|
ui.ostc3DilTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
|
||||||
ui.ostc3DilTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
|
ui.ostc3DilTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
|
||||||
ui.ostc3DilTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
|
ui.ostc3DilTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
|
||||||
ui.ostc3DilTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
|
ui.ostc3DilTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
|
||||||
|
|
||||||
//load dil 4 values
|
//load dil 4 values
|
||||||
ui.ostc3DilTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
|
ui.ostc3DilTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
|
||||||
ui.ostc3DilTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
|
ui.ostc3DilTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
|
||||||
ui.ostc3DilTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
|
ui.ostc3DilTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
|
||||||
ui.ostc3DilTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
|
ui.ostc3DilTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
|
||||||
|
|
||||||
//load dil 5 values
|
//load dil 5 values
|
||||||
ui.ostc3DilTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
|
ui.ostc3DilTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
|
||||||
ui.ostc3DilTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
|
ui.ostc3DilTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
|
||||||
ui.ostc3DilTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
|
ui.ostc3DilTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
|
||||||
ui.ostc3DilTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
|
ui.ostc3DilTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
|
||||||
|
|
||||||
//load set point 1 values
|
//load set point 1 values
|
||||||
ui.ostc3SetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
|
ui.ostc3SetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
|
||||||
|
@ -857,7 +867,7 @@ void ConfigureDiveComputerDialog::reloadValuesOSTC3()
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::reloadValuesOSTC()
|
void ConfigureDiveComputerDialog::reloadValuesOSTC()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
# Not in OSTC
|
# Not in OSTC
|
||||||
setBrightness
|
setBrightness
|
||||||
setCalibrationGas
|
setCalibrationGas
|
||||||
|
@ -880,7 +890,7 @@ setNumberOfDives
|
||||||
ui.desaturationSpinBox_3->setValue(deviceDetails->desaturation());
|
ui.desaturationSpinBox_3->setValue(deviceDetails->desaturation());
|
||||||
ui.lastDecoSpinBox_3->setValue(deviceDetails->lastDeco());
|
ui.lastDecoSpinBox_3->setValue(deviceDetails->lastDeco());
|
||||||
ui.samplingRateSpinBox_3->setValue(deviceDetails->samplingRate());
|
ui.samplingRateSpinBox_3->setValue(deviceDetails->samplingRate());
|
||||||
ui.salinityDoubleSpinBox_3->setValue((double) deviceDetails->salinity() / 100.0);
|
ui.salinityDoubleSpinBox_3->setValue((double)deviceDetails->salinity() / 100.0);
|
||||||
ui.dateFormatComboBox_3->setCurrentIndex(deviceDetails->dateFormat());
|
ui.dateFormatComboBox_3->setCurrentIndex(deviceDetails->dateFormat());
|
||||||
ui.safetyStopCheckBox_3->setChecked(deviceDetails->safetyStop());
|
ui.safetyStopCheckBox_3->setChecked(deviceDetails->safetyStop());
|
||||||
ui.gfHighSpinBox_3->setValue(deviceDetails->gfHigh());
|
ui.gfHighSpinBox_3->setValue(deviceDetails->gfHigh());
|
||||||
|
@ -895,64 +905,64 @@ setNumberOfDives
|
||||||
ui.numberOfDivesSpinBox_3->setValue(deviceDetails->numberOfDives());
|
ui.numberOfDivesSpinBox_3->setValue(deviceDetails->numberOfDives());
|
||||||
|
|
||||||
//load gas 1 values
|
//load gas 1 values
|
||||||
ui.ostcGasTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
|
ui.ostcGasTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->gas1().oxygen)));
|
||||||
ui.ostcGasTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium)));
|
ui.ostcGasTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->gas1().helium)));
|
||||||
ui.ostcGasTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type)));
|
ui.ostcGasTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->gas1().type)));
|
||||||
ui.ostcGasTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
|
ui.ostcGasTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->gas1().depth)));
|
||||||
|
|
||||||
//load gas 2 values
|
//load gas 2 values
|
||||||
ui.ostcGasTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen)));
|
ui.ostcGasTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->gas2().oxygen)));
|
||||||
ui.ostcGasTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium)));
|
ui.ostcGasTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->gas2().helium)));
|
||||||
ui.ostcGasTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
|
ui.ostcGasTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->gas2().type)));
|
||||||
ui.ostcGasTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
|
ui.ostcGasTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->gas2().depth)));
|
||||||
|
|
||||||
//load gas 3 values
|
//load gas 3 values
|
||||||
ui.ostcGasTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen)));
|
ui.ostcGasTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->gas3().oxygen)));
|
||||||
ui.ostcGasTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium)));
|
ui.ostcGasTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->gas3().helium)));
|
||||||
ui.ostcGasTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
|
ui.ostcGasTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->gas3().type)));
|
||||||
ui.ostcGasTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
|
ui.ostcGasTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->gas3().depth)));
|
||||||
|
|
||||||
//load gas 4 values
|
//load gas 4 values
|
||||||
ui.ostcGasTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen)));
|
ui.ostcGasTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->gas4().oxygen)));
|
||||||
ui.ostcGasTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium)));
|
ui.ostcGasTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->gas4().helium)));
|
||||||
ui.ostcGasTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
|
ui.ostcGasTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->gas4().type)));
|
||||||
ui.ostcGasTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
|
ui.ostcGasTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->gas4().depth)));
|
||||||
|
|
||||||
//load gas 5 values
|
//load gas 5 values
|
||||||
ui.ostcGasTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen)));
|
ui.ostcGasTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->gas5().oxygen)));
|
||||||
ui.ostcGasTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium)));
|
ui.ostcGasTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->gas5().helium)));
|
||||||
ui.ostcGasTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
|
ui.ostcGasTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->gas5().type)));
|
||||||
ui.ostcGasTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
|
ui.ostcGasTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->gas5().depth)));
|
||||||
|
|
||||||
//load dil 1 values
|
//load dil 1 values
|
||||||
ui.ostcDilTable->setItem(0,1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
|
ui.ostcDilTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->dil1().oxygen)));
|
||||||
ui.ostcDilTable->setItem(0,2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
|
ui.ostcDilTable->setItem(0, 2, new QTableWidgetItem(QString::number(deviceDetails->dil1().helium)));
|
||||||
ui.ostcDilTable->setItem(0,3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
|
ui.ostcDilTable->setItem(0, 3, new QTableWidgetItem(QString::number(deviceDetails->dil1().type)));
|
||||||
ui.ostcDilTable->setItem(0,4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
|
ui.ostcDilTable->setItem(0, 4, new QTableWidgetItem(QString::number(deviceDetails->dil1().depth)));
|
||||||
|
|
||||||
//load dil 2 values
|
//load dil 2 values
|
||||||
ui.ostcDilTable->setItem(1,1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
|
ui.ostcDilTable->setItem(1, 1, new QTableWidgetItem(QString::number(deviceDetails->dil2().oxygen)));
|
||||||
ui.ostcDilTable->setItem(1,2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
|
ui.ostcDilTable->setItem(1, 2, new QTableWidgetItem(QString::number(deviceDetails->dil2().helium)));
|
||||||
ui.ostcDilTable->setItem(1,3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
|
ui.ostcDilTable->setItem(1, 3, new QTableWidgetItem(QString::number(deviceDetails->dil2().type)));
|
||||||
ui.ostcDilTable->setItem(1,4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
|
ui.ostcDilTable->setItem(1, 4, new QTableWidgetItem(QString::number(deviceDetails->dil2().depth)));
|
||||||
|
|
||||||
//load dil 3 values
|
//load dil 3 values
|
||||||
ui.ostcDilTable->setItem(2,1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
|
ui.ostcDilTable->setItem(2, 1, new QTableWidgetItem(QString::number(deviceDetails->dil3().oxygen)));
|
||||||
ui.ostcDilTable->setItem(2,2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
|
ui.ostcDilTable->setItem(2, 2, new QTableWidgetItem(QString::number(deviceDetails->dil3().helium)));
|
||||||
ui.ostcDilTable->setItem(2,3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
|
ui.ostcDilTable->setItem(2, 3, new QTableWidgetItem(QString::number(deviceDetails->dil3().type)));
|
||||||
ui.ostcDilTable->setItem(2,4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
|
ui.ostcDilTable->setItem(2, 4, new QTableWidgetItem(QString::number(deviceDetails->dil3().depth)));
|
||||||
|
|
||||||
//load dil 4 values
|
//load dil 4 values
|
||||||
ui.ostcDilTable->setItem(3,1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
|
ui.ostcDilTable->setItem(3, 1, new QTableWidgetItem(QString::number(deviceDetails->dil4().oxygen)));
|
||||||
ui.ostcDilTable->setItem(3,2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
|
ui.ostcDilTable->setItem(3, 2, new QTableWidgetItem(QString::number(deviceDetails->dil4().helium)));
|
||||||
ui.ostcDilTable->setItem(3,3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
|
ui.ostcDilTable->setItem(3, 3, new QTableWidgetItem(QString::number(deviceDetails->dil4().type)));
|
||||||
ui.ostcDilTable->setItem(3,4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
|
ui.ostcDilTable->setItem(3, 4, new QTableWidgetItem(QString::number(deviceDetails->dil4().depth)));
|
||||||
|
|
||||||
//load dil 5 values
|
//load dil 5 values
|
||||||
ui.ostcDilTable->setItem(4,1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
|
ui.ostcDilTable->setItem(4, 1, new QTableWidgetItem(QString::number(deviceDetails->dil5().oxygen)));
|
||||||
ui.ostcDilTable->setItem(4,2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
|
ui.ostcDilTable->setItem(4, 2, new QTableWidgetItem(QString::number(deviceDetails->dil5().helium)));
|
||||||
ui.ostcDilTable->setItem(4,3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
|
ui.ostcDilTable->setItem(4, 3, new QTableWidgetItem(QString::number(deviceDetails->dil5().type)));
|
||||||
ui.ostcDilTable->setItem(4,4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
|
ui.ostcDilTable->setItem(4, 4, new QTableWidgetItem(QString::number(deviceDetails->dil5().depth)));
|
||||||
|
|
||||||
//load set point 1 values
|
//load set point 1 values
|
||||||
ui.ostcSetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
|
ui.ostcSetPointTable->setItem(0, 1, new QTableWidgetItem(QString::number(deviceDetails->sp1().sp)));
|
||||||
|
@ -1007,21 +1017,18 @@ void ConfigureDiveComputerDialog::on_backupButton_clicked()
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filename);
|
||||||
filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
|
filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
|
||||||
QString backupPath = QFileDialog::getSaveFileName(this, tr("Backup dive computer settings"),
|
QString backupPath = QFileDialog::getSaveFileName(this, tr("Backup dive computer settings"),
|
||||||
filename, tr("Backup files (*.xml)")
|
filename, tr("Backup files (*.xml)"));
|
||||||
);
|
|
||||||
if (!backupPath.isEmpty()) {
|
if (!backupPath.isEmpty()) {
|
||||||
populateDeviceDetails();
|
populateDeviceDetails();
|
||||||
getDeviceData();
|
getDeviceData();
|
||||||
if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data)) {
|
if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data)) {
|
||||||
QMessageBox::critical(this, tr("XML backup error"),
|
QMessageBox::critical(this, tr("XML backup error"),
|
||||||
tr("An error occurred while saving the backup file.\n%1")
|
tr("An error occurred while saving the backup file.\n%1")
|
||||||
.arg(config->lastError)
|
.arg(config->lastError));
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::information(this, tr("Backup succeeded"),
|
QMessageBox::information(this, tr("Backup succeeded"),
|
||||||
tr("Your settings have been saved to: %1")
|
tr("Your settings have been saved to: %1")
|
||||||
.arg(backupPath)
|
.arg(backupPath));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1032,21 +1039,18 @@ void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filename);
|
||||||
filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
|
filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
|
||||||
QString restorePath = QFileDialog::getOpenFileName(this, tr("Restore dive computer settings"),
|
QString restorePath = QFileDialog::getOpenFileName(this, tr("Restore dive computer settings"),
|
||||||
filename, tr("Backup files (*.xml)")
|
filename, tr("Backup files (*.xml)"));
|
||||||
);
|
|
||||||
if (!restorePath.isEmpty()) {
|
if (!restorePath.isEmpty()) {
|
||||||
if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
|
if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
|
||||||
QMessageBox::critical(this, tr("XML restore error"),
|
QMessageBox::critical(this, tr("XML restore error"),
|
||||||
tr("An error occurred while restoring the backup file.\n%1")
|
tr("An error occurred while restoring the backup file.\n%1")
|
||||||
.arg(config->lastError)
|
.arg(config->lastError));
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
reloadValues();
|
reloadValues();
|
||||||
//getDeviceData();
|
//getDeviceData();
|
||||||
//config->saveDeviceDetails(deviceDetails, &device_data);
|
//config->saveDeviceDetails(deviceDetails, &device_data);
|
||||||
QMessageBox::information(this, tr("Restore succeeded"),
|
QMessageBox::information(this, tr("Restore succeeded"),
|
||||||
tr("Your settings have been restored successfully.")
|
tr("Your settings have been restored successfully."));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1057,8 +1061,7 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
|
||||||
QFileInfo fi(filename);
|
QFileInfo fi(filename);
|
||||||
filename = fi.absolutePath();
|
filename = fi.absolutePath();
|
||||||
QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
|
QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
|
||||||
filename, tr("All files (*.*)")
|
filename, tr("All files (*.*)"));
|
||||||
);
|
|
||||||
if (!firmwarePath.isEmpty()) {
|
if (!firmwarePath.isEmpty()) {
|
||||||
getDeviceData();
|
getDeviceData();
|
||||||
config->startFirmwareUpdate(firmwarePath, &device_data);
|
config->startFirmwareUpdate(firmwarePath, &device_data);
|
||||||
|
@ -1066,7 +1069,6 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int currentRow)
|
void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int currentRow)
|
||||||
{
|
{
|
||||||
// Disable the buttons to do operations on this data
|
// Disable the buttons to do operations on this data
|
||||||
|
|
|
@ -9,8 +9,7 @@
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
#include <QNetworkAccessManager>
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
class GasSpinBoxItemDelegate : public QStyledItemDelegate
|
class GasSpinBoxItemDelegate : public QStyledItemDelegate {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -25,12 +24,12 @@ public:
|
||||||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
column_type type;
|
column_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
class GasTypeComboBoxItemDelegate : public QStyledItemDelegate
|
class GasTypeComboBoxItemDelegate : public QStyledItemDelegate {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -45,19 +44,20 @@ public:
|
||||||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
computer_type type;
|
computer_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigureDiveComputerDialog : public QDialog
|
class ConfigureDiveComputerDialog : public QDialog {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ConfigureDiveComputerDialog(QWidget *parent = 0);
|
explicit ConfigureDiveComputerDialog(QWidget *parent = 0);
|
||||||
~ConfigureDiveComputerDialog();
|
~ConfigureDiveComputerDialog();
|
||||||
|
|
||||||
private slots:
|
private
|
||||||
|
slots:
|
||||||
void readSettings();
|
void readSettings();
|
||||||
void resetSettings();
|
void resetSettings();
|
||||||
void configMessage(QString msg);
|
void configMessage(QString msg);
|
||||||
|
@ -102,8 +102,7 @@ private:
|
||||||
QString selected_product;
|
QString selected_product;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OstcFirmwareCheck : QObject
|
class OstcFirmwareCheck : QObject {
|
||||||
{
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit OstcFirmwareCheck(QString product);
|
explicit OstcFirmwareCheck(QString product);
|
||||||
|
@ -111,7 +110,8 @@ public:
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
void parseOstcFwVersion(QNetworkReply *reply);
|
void parseOstcFwVersion(QNetworkReply *reply);
|
||||||
void saveOstcFirmware(QNetworkReply * reply);
|
void saveOstcFirmware(QNetworkReply *reply);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void upgradeFirmware();
|
void upgradeFirmware();
|
||||||
device_data_t devData;
|
device_data_t devData;
|
||||||
|
|
Loading…
Add table
Reference in a new issue