Add support for the Uwatec Galileo Trimix.
This commit is contained in:
parent
074bee70a2
commit
ddf6fca65f
@ -37,6 +37,7 @@
|
|||||||
#define ALADINTEC2G 0x13
|
#define ALADINTEC2G 0x13
|
||||||
#define SMARTCOM 0x14
|
#define SMARTCOM 0x14
|
||||||
#define SMARTTEC 0x18
|
#define SMARTTEC 0x18
|
||||||
|
#define GALILEOTRIMIX 0x19
|
||||||
#define SMARTZ 0x1C
|
#define SMARTZ 0x1C
|
||||||
|
|
||||||
typedef struct uwatec_smart_parser_t uwatec_smart_parser_t;
|
typedef struct uwatec_smart_parser_t uwatec_smart_parser_t;
|
||||||
@ -207,6 +208,7 @@ uwatec_smart_parser_get_field (parser_t *abstract, parser_field_type_t type, uns
|
|||||||
unsigned int size = abstract->size;
|
unsigned int size = abstract->size;
|
||||||
|
|
||||||
unsigned int header = 0;
|
unsigned int header = 0;
|
||||||
|
unsigned int trimix = 0;
|
||||||
const uwatec_smart_header_info_t *table = NULL;
|
const uwatec_smart_header_info_t *table = NULL;
|
||||||
|
|
||||||
// Load the correct table.
|
// Load the correct table.
|
||||||
@ -216,7 +218,12 @@ uwatec_smart_parser_get_field (parser_t *abstract, parser_field_type_t type, uns
|
|||||||
table = &uwatec_smart_pro_header;
|
table = &uwatec_smart_pro_header;
|
||||||
break;
|
break;
|
||||||
case GALILEO:
|
case GALILEO:
|
||||||
|
case GALILEOTRIMIX:
|
||||||
header = 152;
|
header = 152;
|
||||||
|
if (data[43] & 0x80) {
|
||||||
|
header = 0xB1;
|
||||||
|
trimix = 1;
|
||||||
|
}
|
||||||
table = &uwatec_galileo_sol_header;
|
table = &uwatec_galileo_sol_header;
|
||||||
break;
|
break;
|
||||||
case ALADINTEC:
|
case ALADINTEC:
|
||||||
@ -257,7 +264,10 @@ uwatec_smart_parser_get_field (parser_t *abstract, parser_field_type_t type, uns
|
|||||||
*((double *) value) = array_uint16_le (data + table->maxdepth) / 100.0;
|
*((double *) value) = array_uint16_le (data + table->maxdepth) / 100.0;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_GASMIX_COUNT:
|
case FIELD_TYPE_GASMIX_COUNT:
|
||||||
*((unsigned int *) value) = table->ngases;
|
if (trimix)
|
||||||
|
*((unsigned int *) value) = 0;
|
||||||
|
else
|
||||||
|
*((unsigned int *) value) = table->ngases;
|
||||||
break;
|
break;
|
||||||
case FIELD_TYPE_GASMIX:
|
case FIELD_TYPE_GASMIX:
|
||||||
gasmix->helium = 0.0;
|
gasmix->helium = 0.0;
|
||||||
@ -340,6 +350,8 @@ typedef enum {
|
|||||||
BEARING,
|
BEARING,
|
||||||
ALARMS,
|
ALARMS,
|
||||||
TIME,
|
TIME,
|
||||||
|
UNKNOWN1,
|
||||||
|
UNKNOWN2,
|
||||||
} uwatec_smart_sample_t;
|
} uwatec_smart_sample_t;
|
||||||
|
|
||||||
typedef struct uwatec_smart_sample_info_t {
|
typedef struct uwatec_smart_sample_info_t {
|
||||||
@ -429,6 +441,8 @@ uwatec_smart_sample_info_t uwatec_galileo_sol_table [] = {
|
|||||||
{HEARTRATE, 1, 0, 8, 0, 1}, // 1111 0111 dddddddd
|
{HEARTRATE, 1, 0, 8, 0, 1}, // 1111 0111 dddddddd
|
||||||
{BEARING, 1, 0, 8, 0, 2}, // 1111 1000 dddddddd dddddddd
|
{BEARING, 1, 0, 8, 0, 2}, // 1111 1000 dddddddd dddddddd
|
||||||
{ALARMS, 1, 2, 8, 0, 1}, // 1111 1001 dddddddd
|
{ALARMS, 1, 2, 8, 0, 1}, // 1111 1001 dddddddd
|
||||||
|
{UNKNOWN1, 1, 0, 8, 0, 0}, // 1111 1010 (8 bytes)
|
||||||
|
{UNKNOWN2, 1, 0, 8, 0, 1}, // 1111 1011 dddddddd (n-1 bytes)
|
||||||
};
|
};
|
||||||
|
|
||||||
static parser_status_t
|
static parser_status_t
|
||||||
@ -445,6 +459,7 @@ uwatec_smart_parser_samples_foreach (parser_t *abstract, sample_callback_t callb
|
|||||||
const uwatec_smart_sample_info_t *table = NULL;
|
const uwatec_smart_sample_info_t *table = NULL;
|
||||||
unsigned int entries = 0;
|
unsigned int entries = 0;
|
||||||
unsigned int header = 0;
|
unsigned int header = 0;
|
||||||
|
unsigned int trimix = 0;
|
||||||
|
|
||||||
// Load the correct table.
|
// Load the correct table.
|
||||||
switch (parser->model) {
|
switch (parser->model) {
|
||||||
@ -454,7 +469,12 @@ uwatec_smart_parser_samples_foreach (parser_t *abstract, sample_callback_t callb
|
|||||||
entries = NELEMENTS (uwatec_smart_pro_table);
|
entries = NELEMENTS (uwatec_smart_pro_table);
|
||||||
break;
|
break;
|
||||||
case GALILEO:
|
case GALILEO:
|
||||||
|
case GALILEOTRIMIX:
|
||||||
header = 152;
|
header = 152;
|
||||||
|
if (data[43] & 0x80) {
|
||||||
|
header = 0xB1;
|
||||||
|
trimix = 1;
|
||||||
|
}
|
||||||
table = uwatec_galileo_sol_table;
|
table = uwatec_galileo_sol_table;
|
||||||
entries = NELEMENTS (uwatec_galileo_sol_table);
|
entries = NELEMENTS (uwatec_galileo_sol_table);
|
||||||
break;
|
break;
|
||||||
@ -515,7 +535,7 @@ uwatec_smart_parser_samples_foreach (parser_t *abstract, sample_callback_t callb
|
|||||||
|
|
||||||
// Process the type bits in the bitstream.
|
// Process the type bits in the bitstream.
|
||||||
unsigned int id = 0;
|
unsigned int id = 0;
|
||||||
if (parser->model == GALILEO) {
|
if (parser->model == GALILEO || parser->model == GALILEOTRIMIX) {
|
||||||
// Uwatec Galileo
|
// Uwatec Galileo
|
||||||
id = uwatec_galileo_identify (data[offset]);
|
id = uwatec_galileo_identify (data[offset]);
|
||||||
} else {
|
} else {
|
||||||
@ -588,8 +608,13 @@ uwatec_smart_parser_samples_foreach (parser_t *abstract, sample_callback_t callb
|
|||||||
break;
|
break;
|
||||||
case PRESSURE:
|
case PRESSURE:
|
||||||
if (table[id].absolute) {
|
if (table[id].absolute) {
|
||||||
tank = table[id].index;
|
if (trimix) {
|
||||||
pressure = value / 4.0;
|
tank = (value & 0xF000) >> 24;
|
||||||
|
pressure = (value & 0x0FFF) / 4.0;
|
||||||
|
} else {
|
||||||
|
tank = table[id].index;
|
||||||
|
pressure = value / 4.0;
|
||||||
|
}
|
||||||
have_pressure = 1;
|
have_pressure = 1;
|
||||||
} else {
|
} else {
|
||||||
pressure += svalue / 4.0;
|
pressure += svalue / 4.0;
|
||||||
@ -627,6 +652,20 @@ uwatec_smart_parser_samples_foreach (parser_t *abstract, sample_callback_t callb
|
|||||||
case TIME:
|
case TIME:
|
||||||
complete = value;
|
complete = value;
|
||||||
break;
|
break;
|
||||||
|
case UNKNOWN1:
|
||||||
|
if (offset + 8 > size) {
|
||||||
|
WARNING ("Incomplete sample data.");
|
||||||
|
return PARSER_STATUS_ERROR;
|
||||||
|
}
|
||||||
|
offset += 8;
|
||||||
|
break;
|
||||||
|
case UNKNOWN2:
|
||||||
|
if (value < 1 || offset + value - 1 > size) {
|
||||||
|
WARNING ("Incomplete sample data.");
|
||||||
|
return PARSER_STATUS_ERROR;
|
||||||
|
}
|
||||||
|
offset += value - 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
WARNING ("Unknown sample type.");
|
WARNING ("Unknown sample type.");
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user