mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Progress reporting reading/writing OSTC3 settings
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9212458f23
commit
a15e0e0e16
1 changed files with 51 additions and 8 deletions
|
@ -395,12 +395,14 @@ static dc_status_t write_suunto_vyper_settings(dc_device_t *device, DeviceDetail
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef EMIT_PROGRESS
|
|
||||||
|
|
||||||
#if DC_VERSION_CHECK(0, 5, 0)
|
#if DC_VERSION_CHECK(0, 5, 0)
|
||||||
static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_deviceDetails)
|
static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_deviceDetails, dc_event_callback_t progress_cb, void *userdata)
|
||||||
{
|
{
|
||||||
dc_status_t rc;
|
dc_status_t rc;
|
||||||
|
dc_event_progress_t progress;
|
||||||
|
progress.current = 0;
|
||||||
|
progress.maximum = 51;
|
||||||
|
|
||||||
//Read gas mixes
|
//Read gas mixes
|
||||||
gas gas1;
|
gas gas1;
|
||||||
gas gas2;
|
gas gas2;
|
||||||
|
@ -416,6 +418,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
gas1.helium = gasData[1];
|
gas1.helium = gasData[1];
|
||||||
gas1.type = gasData[2];
|
gas1.type = gasData[2];
|
||||||
gas1.depth = gasData[3];
|
gas1.depth = gasData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_GAS2, gasData, sizeof(gasData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_GAS2, gasData, sizeof(gasData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -424,6 +427,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
gas2.helium = gasData[1];
|
gas2.helium = gasData[1];
|
||||||
gas2.type = gasData[2];
|
gas2.type = gasData[2];
|
||||||
gas2.depth = gasData[3];
|
gas2.depth = gasData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_GAS3, gasData, sizeof(gasData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_GAS3, gasData, sizeof(gasData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -432,6 +436,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
gas3.helium = gasData[1];
|
gas3.helium = gasData[1];
|
||||||
gas3.type = gasData[2];
|
gas3.type = gasData[2];
|
||||||
gas3.depth = gasData[3];
|
gas3.depth = gasData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_GAS4, gasData, sizeof(gasData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_GAS4, gasData, sizeof(gasData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -440,6 +445,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
gas4.helium = gasData[1];
|
gas4.helium = gasData[1];
|
||||||
gas4.type = gasData[2];
|
gas4.type = gasData[2];
|
||||||
gas4.depth = gasData[3];
|
gas4.depth = gasData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_GAS5, gasData, sizeof(gasData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_GAS5, gasData, sizeof(gasData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -448,12 +454,14 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
gas5.helium = gasData[1];
|
gas5.helium = gasData[1];
|
||||||
gas5.type = gasData[2];
|
gas5.type = gasData[2];
|
||||||
gas5.depth = gasData[3];
|
gas5.depth = gasData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
m_deviceDetails->gas1 = gas1;
|
m_deviceDetails->gas1 = gas1;
|
||||||
m_deviceDetails->gas2 = gas2;
|
m_deviceDetails->gas2 = gas2;
|
||||||
m_deviceDetails->gas3 = gas3;
|
m_deviceDetails->gas3 = gas3;
|
||||||
m_deviceDetails->gas4 = gas4;
|
m_deviceDetails->gas4 = gas4;
|
||||||
m_deviceDetails->gas5 = gas5;
|
m_deviceDetails->gas5 = gas5;
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
//Read Dil Values
|
//Read Dil Values
|
||||||
gas dil1;
|
gas dil1;
|
||||||
|
@ -470,6 +478,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
dil1.helium = dilData[1];
|
dil1.helium = dilData[1];
|
||||||
dil1.type = dilData[2];
|
dil1.type = dilData[2];
|
||||||
dil1.depth = dilData[3];
|
dil1.depth = dilData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_DIL2, dilData, sizeof(dilData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_DIL2, dilData, sizeof(dilData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -478,6 +487,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
dil2.helium = dilData[1];
|
dil2.helium = dilData[1];
|
||||||
dil2.type = dilData[2];
|
dil2.type = dilData[2];
|
||||||
dil2.depth = dilData[3];
|
dil2.depth = dilData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_DIL3, dilData, sizeof(dilData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_DIL3, dilData, sizeof(dilData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -486,6 +496,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
dil3.helium = dilData[1];
|
dil3.helium = dilData[1];
|
||||||
dil3.type = dilData[2];
|
dil3.type = dilData[2];
|
||||||
dil3.depth = dilData[3];
|
dil3.depth = dilData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_DIL4, dilData, sizeof(dilData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_DIL4, dilData, sizeof(dilData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -494,6 +505,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
dil4.helium = dilData[1];
|
dil4.helium = dilData[1];
|
||||||
dil4.type = dilData[2];
|
dil4.type = dilData[2];
|
||||||
dil4.depth = dilData[3];
|
dil4.depth = dilData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_DIL5, dilData, sizeof(dilData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_DIL5, dilData, sizeof(dilData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
|
@ -502,6 +514,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
dil5.helium = dilData[1];
|
dil5.helium = dilData[1];
|
||||||
dil5.type = dilData[2];
|
dil5.type = dilData[2];
|
||||||
dil5.depth = dilData[3];
|
dil5.depth = dilData[3];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
m_deviceDetails->dil1 = dil1;
|
m_deviceDetails->dil1 = dil1;
|
||||||
m_deviceDetails->dil2 = dil2;
|
m_deviceDetails->dil2 = dil2;
|
||||||
|
@ -522,30 +535,35 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
return rc;
|
return rc;
|
||||||
sp1.sp = spData[0];
|
sp1.sp = spData[0];
|
||||||
sp1.depth = spData[1];
|
sp1.depth = spData[1];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_SP2, spData, sizeof(spData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_SP2, spData, sizeof(spData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
sp2.sp = spData[0];
|
sp2.sp = spData[0];
|
||||||
sp2.depth = spData[1];
|
sp2.depth = spData[1];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_SP3, spData, sizeof(spData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_SP3, spData, sizeof(spData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
sp3.sp = spData[0];
|
sp3.sp = spData[0];
|
||||||
sp3.depth = spData[1];
|
sp3.depth = spData[1];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_SP4, spData, sizeof(spData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_SP4, spData, sizeof(spData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
sp4.sp = spData[0];
|
sp4.sp = spData[0];
|
||||||
sp4.depth = spData[1];
|
sp4.depth = spData[1];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
rc = hw_ostc3_device_config_read(device, OSTC3_SP5, spData, sizeof(spData));
|
rc = hw_ostc3_device_config_read(device, OSTC3_SP5, spData, sizeof(spData));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
sp5.sp = spData[0];
|
sp5.sp = spData[0];
|
||||||
sp5.depth = spData[1];
|
sp5.depth = spData[1];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
m_deviceDetails->sp1 = sp1;
|
m_deviceDetails->sp1 = sp1;
|
||||||
m_deviceDetails->sp2 = sp2;
|
m_deviceDetails->sp2 = sp2;
|
||||||
|
@ -562,6 +580,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
if (rc != DC_STATUS_SUCCESS) \
|
if (rc != DC_STATUS_SUCCESS) \
|
||||||
return rc; \
|
return rc; \
|
||||||
m_deviceDetails->_DEVICE_DETAIL = uData[0]; \
|
m_deviceDetails->_DEVICE_DETAIL = uData[0]; \
|
||||||
|
EMIT_PROGRESS(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
READ_SETTING(OSTC3_DIVE_MODE, diveMode);
|
READ_SETTING(OSTC3_DIVE_MODE, diveMode);
|
||||||
|
@ -606,6 +625,7 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
return rc;
|
return rc;
|
||||||
// OSTC3 stores the pressureSensorOffset in two-complement
|
// OSTC3 stores the pressureSensorOffset in two-complement
|
||||||
m_deviceDetails->pressureSensorOffset = (signed char)uData[0];
|
m_deviceDetails->pressureSensorOffset = (signed char)uData[0];
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
//read firmware settings
|
//read firmware settings
|
||||||
unsigned char fData[64] = { 0 };
|
unsigned char fData[64] = { 0 };
|
||||||
|
@ -617,13 +637,18 @@ static dc_status_t read_ostc3_settings(dc_device_t *device, DeviceDetails *m_dev
|
||||||
m_deviceDetails->firmwareVersion = QString::number(fData[2]) + "." + QString::number(fData[3]);
|
m_deviceDetails->firmwareVersion = QString::number(fData[2]) + "." + QString::number(fData[3]);
|
||||||
QByteArray ar((char *)fData + 4, 60);
|
QByteArray ar((char *)fData + 4, 60);
|
||||||
m_deviceDetails->customText = ar.trimmed();
|
m_deviceDetails->customText = ar.trimmed();
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_deviceDetails)
|
static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_deviceDetails, dc_event_callback_t progress_cb, void *userdata)
|
||||||
{
|
{
|
||||||
dc_status_t rc;
|
dc_status_t rc;
|
||||||
|
dc_event_progress_t progress;
|
||||||
|
progress.current = 0;
|
||||||
|
progress.maximum = 51;
|
||||||
|
|
||||||
//write gas values
|
//write gas values
|
||||||
unsigned char gas1Data[4] = {
|
unsigned char gas1Data[4] = {
|
||||||
m_deviceDetails->gas1.oxygen,
|
m_deviceDetails->gas1.oxygen,
|
||||||
|
@ -663,22 +688,27 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_GAS1, gas1Data, sizeof(gas1Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_GAS1, gas1Data, sizeof(gas1Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//gas 2
|
//gas 2
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_GAS2, gas2Data, sizeof(gas2Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_GAS2, gas2Data, sizeof(gas2Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//gas 3
|
//gas 3
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_GAS3, gas3Data, sizeof(gas3Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_GAS3, gas3Data, sizeof(gas3Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//gas 4
|
//gas 4
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_GAS4, gas4Data, sizeof(gas4Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_GAS4, gas4Data, sizeof(gas4Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//gas 5
|
//gas 5
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_GAS5, gas5Data, sizeof(gas5Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_GAS5, gas5Data, sizeof(gas5Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
//write set point values
|
//write set point values
|
||||||
unsigned char sp1Data[2] = {
|
unsigned char sp1Data[2] = {
|
||||||
|
@ -710,22 +740,27 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_SP1, sp1Data, sizeof(sp1Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_SP1, sp1Data, sizeof(sp1Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//sp 2
|
//sp 2
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_SP2, sp2Data, sizeof(sp2Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_SP2, sp2Data, sizeof(sp2Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//sp 3
|
//sp 3
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_SP3, sp3Data, sizeof(sp3Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_SP3, sp3Data, sizeof(sp3Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//sp 4
|
//sp 4
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_SP4, sp4Data, sizeof(sp4Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_SP4, sp4Data, sizeof(sp4Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//sp 5
|
//sp 5
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_SP5, sp5Data, sizeof(sp5Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_SP5, sp5Data, sizeof(sp5Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
//write dil values
|
//write dil values
|
||||||
unsigned char dil1Data[4] = {
|
unsigned char dil1Data[4] = {
|
||||||
|
@ -766,22 +801,27 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_DIL1, dil1Data, sizeof(gas1Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_DIL1, dil1Data, sizeof(gas1Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//dil 2
|
//dil 2
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_DIL2, dil2Data, sizeof(dil2Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_DIL2, dil2Data, sizeof(dil2Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//dil 3
|
//dil 3
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_DIL3, dil3Data, sizeof(dil3Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_DIL3, dil3Data, sizeof(dil3Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//dil 4
|
//dil 4
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_DIL4, dil4Data, sizeof(dil4Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_DIL4, dil4Data, sizeof(dil4Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
//dil 5
|
//dil 5
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_DIL5, dil5Data, sizeof(dil5Data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_DIL5, dil5Data, sizeof(dil5Data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
//write general settings
|
//write general settings
|
||||||
//custom text
|
//custom text
|
||||||
|
@ -796,6 +836,7 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
|
||||||
rc = hw_ostc3_device_config_write(device, _OSTC3_SETTING, data, sizeof(data)); \
|
rc = hw_ostc3_device_config_write(device, _OSTC3_SETTING, data, sizeof(data)); \
|
||||||
if (rc != DC_STATUS_SUCCESS) \
|
if (rc != DC_STATUS_SUCCESS) \
|
||||||
return rc; \
|
return rc; \
|
||||||
|
EMIT_PROGRESS(); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
WRITE_SETTING(OSTC3_DIVE_MODE, diveMode);
|
WRITE_SETTING(OSTC3_DIVE_MODE, diveMode);
|
||||||
|
@ -840,6 +881,7 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
|
||||||
rc = hw_ostc3_device_config_write(device, OSTC3_PRESSURE_SENSOR_OFFSET, data, sizeof(data));
|
rc = hw_ostc3_device_config_write(device, OSTC3_PRESSURE_SENSOR_OFFSET, data, sizeof(data));
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
return rc;
|
return rc;
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
//sync date and time
|
//sync date and time
|
||||||
if (m_deviceDetails->syncTime) {
|
if (m_deviceDetails->syncTime) {
|
||||||
|
@ -853,11 +895,14 @@ static dc_status_t write_ostc3_settings(dc_device_t *device, DeviceDetails *m_de
|
||||||
time.second = timeToSet.time().second();
|
time.second = timeToSet.time().second();
|
||||||
rc = hw_ostc3_device_clock(device, &time);
|
rc = hw_ostc3_device_clock(device, &time);
|
||||||
}
|
}
|
||||||
|
EMIT_PROGRESS();
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
#endif /* DC_VERSION_CHECK(0, 5, 0) */
|
#endif /* DC_VERSION_CHECK(0, 5, 0) */
|
||||||
|
|
||||||
|
#undef EMIT_PROGRESS
|
||||||
|
|
||||||
static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_deviceDetails)
|
static dc_status_t read_ostc_settings(dc_device_t *device, DeviceDetails *m_deviceDetails)
|
||||||
{
|
{
|
||||||
dc_status_t rc;
|
dc_status_t rc;
|
||||||
|
@ -1548,12 +1593,11 @@ void ReadSettingsThread::run()
|
||||||
#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;
|
||||||
rc = read_ostc3_settings(m_data->device, m_deviceDetails);
|
rc = read_ostc3_settings(m_data->device, m_deviceDetails, DeviceThread::event_cb, this);
|
||||||
if (rc == DC_STATUS_SUCCESS)
|
if (rc == DC_STATUS_SUCCESS)
|
||||||
emit devicedetails(m_deviceDetails);
|
emit devicedetails(m_deviceDetails);
|
||||||
else
|
else
|
||||||
emit error("Failed!");
|
emit error("Failed!");
|
||||||
emit progress(100);
|
|
||||||
break;
|
break;
|
||||||
#endif // divecomputer 0.5.0
|
#endif // divecomputer 0.5.0
|
||||||
#ifdef DEBUG_OSTC
|
#ifdef DEBUG_OSTC
|
||||||
|
@ -1635,10 +1679,9 @@ void WriteSettingsThread::run()
|
||||||
#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;
|
||||||
rc = write_ostc3_settings(m_data->device, m_deviceDetails);
|
rc = write_ostc3_settings(m_data->device, m_deviceDetails, DeviceThread::event_cb, this);
|
||||||
if (rc != DC_STATUS_SUCCESS)
|
if (rc != DC_STATUS_SUCCESS)
|
||||||
emit error(tr("Failed!"));
|
emit error(tr("Failed!"));
|
||||||
emit progress(100);
|
|
||||||
break;
|
break;
|
||||||
#endif // divecomputer 0.5.0
|
#endif // divecomputer 0.5.0
|
||||||
#ifdef DEBUG_OSTC
|
#ifdef DEBUG_OSTC
|
||||||
|
|
Loading…
Add table
Reference in a new issue