Merge git://github.com/libdivecomputer/libdivecomputer into Subsurface-NG

Merge upstream changes from Jef Driesen:

 - fix Oceanic VT Pro date parsing

 - add Sherwood Wisdom 4 and Scubapro Aladin A1 IDs from Janice McLaughlin

 - fix Cressi gasmix index and depth parsing (the gasmix index bit had
   been misparsed as very deep depth)

* 'master' of git://github.com/libdivecomputer/libdivecomputer:
  Implement the gas mix sample
  Limit the depth value to 11 bits
  Add support for the Scubapro A1
  Add support for the Sherwood Wisdom 4
  Fix the vtpro datetime parsing
This commit is contained in:
Linus Torvalds 2020-02-13 13:03:21 -08:00
commit ebbb911427
6 changed files with 35 additions and 9 deletions

View File

@ -170,6 +170,7 @@ cressi_goa_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t c
unsigned int time = 0;
unsigned int interval = 5;
unsigned int complete = 1;
unsigned int gasmix_previous = 0xFFFFFFFF;
unsigned int offset = SZ_HEADER;
while (offset + 2 <= size) {
@ -190,9 +191,18 @@ cressi_goa_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t c
if (type == DEPTH) {
// Depth (1/10 m).
unsigned int depth = value & 0x0FFF;
unsigned int depth = value & 0x07FF;
sample.depth = depth / 10.0;
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
// Gas change.
unsigned int gasmix = (value & 0x0800) >> 11;
if (gasmix != gasmix_previous) {
sample.gasmix = gasmix;
if (callback) callback (DC_SAMPLE_GASMIX, sample, userdata);
gasmix_previous = gasmix;
}
complete = 1;
} else if (type == TEMPERATURE) {
// Temperature (1/10 °C).

View File

@ -153,6 +153,7 @@ static const dc_descriptor_t g_descriptors[] = {
{"Scubapro", "Mantis", DC_FAMILY_UWATEC_SMART, 0x20, DC_TRANSPORT_SERIAL, NULL},
{"Scubapro", "Aladin Square", DC_FAMILY_UWATEC_SMART, 0x22, DC_TRANSPORT_USBHID, dc_filter_uwatec},
{"Scubapro", "Chromis", DC_FAMILY_UWATEC_SMART, 0x24, DC_TRANSPORT_SERIAL, NULL},
{"Scubapro", "Aladin A1", DC_FAMILY_UWATEC_SMART, 0x25, DC_TRANSPORT_BLE, dc_filter_uwatec},
{"Scubapro", "Mantis 2", DC_FAMILY_UWATEC_SMART, 0x26, DC_TRANSPORT_SERIAL, NULL},
{"Scubapro", "G2", DC_FAMILY_UWATEC_SMART, 0x32, DC_TRANSPORT_USBHID | DC_TRANSPORT_BLE, dc_filter_uwatec},
{"Scubapro", "G2 Console", DC_FAMILY_UWATEC_SMART, 0x32, DC_TRANSPORT_USBHID | DC_TRANSPORT_BLE, dc_filter_uwatec},
@ -246,6 +247,7 @@ static const dc_descriptor_t g_descriptors[] = {
{"Aqualung", "i550C", DC_FAMILY_OCEANIC_ATOM2, 0x4652, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Oceanic", "Geo 4.0", DC_FAMILY_OCEANIC_ATOM2, 0x4653, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Oceanic", "Veo 4.0", DC_FAMILY_OCEANIC_ATOM2, 0x4654, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Sherwood", "Wisdom 4", DC_FAMILY_OCEANIC_ATOM2, 0x4655, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
{"Oceanic", "Pro Plus 4", DC_FAMILY_OCEANIC_ATOM2, 0x4656, DC_TRANSPORT_SERIAL | DC_TRANSPORT_BLE, dc_filter_oceanic},
/* Mares Nemo */
{"Mares", "Nemo", DC_FAMILY_MARES_NEMO, 0, DC_TRANSPORT_SERIAL, NULL},
@ -498,6 +500,7 @@ static int dc_filter_uwatec (dc_transport_t transport, const void *userdata)
"G2",
"Aladin",
"HUD",
"A1",
};
if (transport == DC_TRANSPORT_IRDA) {
@ -634,6 +637,7 @@ static int dc_filter_oceanic (dc_transport_t transport, const void *userdata)
0x4652, // Aqualung i550C
0x4653, // Oceanic Geo 4.0
0x4654, // Oceanic Veo 4.0
0x4655, // Sherwood Wisdom 4
0x4656, // Oceanic Pro Plus 4
};

View File

@ -174,6 +174,7 @@ static const oceanic_common_version_t oceanic_oc1_version[] = {
{"OCSWATCH \0\0 1024"},
{"AQUAI550 \0\0 1024"},
{"AQUA550C \0\0 1024"},
{"WISDOM04 \0\0 1024"},
};
static const oceanic_common_version_t oceanic_oci_version[] = {

View File

@ -96,6 +96,7 @@
#define I550C 0x4652
#define GEO40 0x4653
#define VEO40 0x4654
#define WISDOM4 0x4655
#define PROPLUS4 0x4656
#define NORMAL 0
@ -193,7 +194,7 @@ oceanic_atom2_parser_create (dc_parser_t **out, dc_context_t *context, unsigned
parser->headersize = 5 * PAGESIZE;
} else if (model == PROPLUSX) {
parser->headersize = 3 * PAGESIZE;
} else if (model == I550C) {
} else if (model == I550C || model == WISDOM4) {
parser->headersize = 5 * PAGESIZE / 2;
}
@ -273,6 +274,7 @@ oceanic_atom2_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim
case I550C:
case VISION:
case XPAIR:
case WISDOM4:
datetime->year = ((p[5] & 0xE0) >> 5) + ((p[7] & 0xE0) >> 2) + 2000;
datetime->month = (p[3] & 0x0F);
datetime->day = ((p[0] & 0x80) >> 3) + ((p[3] & 0xF0) >> 4);
@ -486,6 +488,9 @@ oceanic_atom2_parser_cache (oceanic_atom2_parser_t *parser)
o2_offset = 0x30;
ngasmixes = 4;
o2_step = 2;
} else if (parser->model == WISDOM4) {
o2_offset = header + 4;
ngasmixes = 1;
} else {
o2_offset = header + 4;
ngasmixes = 3;
@ -926,7 +931,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
unsigned int sign;
if (parser->model == DG03 || parser->model == PROPLUS3 ||
parser->model == I550 || parser->model == I550C ||
parser->model == PROPLUS4)
parser->model == PROPLUS4 || parser->model == WISDOM4)
sign = (~data[offset + 5] & 0x04) >> 2;
else if (parser->model == VOYAGER2G || parser->model == AMPHOS ||
parser->model == AMPHOSAIR || parser->model == ZENAIR)
@ -959,7 +964,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
parser->model == DG03 || parser->model == PROPLUS3 ||
parser->model == AMPHOSAIR || parser->model == I550 ||
parser->model == VISION || parser->model == XPAIR ||
parser->model == I550C || parser->model == PROPLUS4)
parser->model == I550C || parser->model == PROPLUS4 ||
parser->model == WISDOM4)
pressure = (((data[offset + 0] & 0x03) << 8) + data[offset + 1]) * 5;
else if (parser->model == TX1 || parser->model == A300CS ||
parser->model == VTX || parser->model == I750TC ||
@ -1028,7 +1034,7 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
have_deco = 1;
} else if (parser->model == ATOM31 || parser->model == VISION ||
parser->model == XPAIR || parser->model == I550 ||
parser->model == I550C) {
parser->model == I550C || parser->model == WISDOM4) {
decostop = (data[offset + 5] & 0xF0) >> 4;
decotime = array_uint16_le(data + offset + 4) & 0x03FF;
have_deco = 1;
@ -1066,7 +1072,8 @@ oceanic_atom2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_
rbt = array_uint16_le(data + offset + 8) & 0x01FF;
have_rbt = 1;
} else if (parser->model == VISION || parser->model == XPAIR ||
parser->model == I550 || parser->model == I550C) {
parser->model == I550 || parser->model == I550C ||
parser->model == WISDOM4) {
rbt = array_uint16_le(data + offset + 6) & 0x03FF;
have_rbt = 1;
}

View File

@ -129,7 +129,7 @@ oceanic_vtpro_parser_get_datetime (dc_parser_t *abstract, dc_datetime_t *datetim
else
datetime->year = bcd2dec (((p[32 + 3] & 0xC0) >> 2) + ((p[32 + 2] & 0xF0) >> 4)) + 2000;
datetime->month = (p[4] & 0xF0) >> 4;
datetime->day = bcd2dec (p[3]);
datetime->day = bcd2dec (p[3] & 0x7F);
datetime->hour = bcd2dec (p[1] & 0x7F);
pm = p[1] & 0x80;
}

View File

@ -48,6 +48,7 @@
#define MERIDIAN 0x20
#define ALADINSQUARE 0x22
#define CHROMIS 0x24
#define ALADINA1 0x25
#define MANTIS2 0x26
#define G2 0x32
#define G2HUD 0x42
@ -530,7 +531,8 @@ uwatec_smart_parser_cache (uwatec_smart_parser_t *parser)
parser->model == ALADIN2G || parser->model == MERIDIAN ||
parser->model == CHROMIS || parser->model == MANTIS2 ||
parser->model == G2 || parser->model == ALADINSPORTMATRIX ||
parser->model == ALADINSQUARE || parser->model == G2HUD) {
parser->model == ALADINSQUARE || parser->model == G2HUD ||
parser->model == ALADINA1) {
unsigned int offset = header->tankpressure + 2 * i;
endpressure = array_uint16_le(data + offset);
beginpressure = array_uint16_le(data + offset + 2 * header->ngases);
@ -623,6 +625,7 @@ uwatec_smart_parser_create (dc_parser_t **out, dc_context_t *context, unsigned i
case G2:
case G2HUD:
case ALADINSPORTMATRIX:
case ALADINA1:
parser->headersize = 84;
parser->header = &uwatec_smart_trimix_header;
parser->samples = uwatec_smart_galileo_samples;
@ -965,7 +968,8 @@ uwatec_smart_parse (uwatec_smart_parser_t *parser, dc_sample_callback_t callback
parser->model == ALADIN2G || parser->model == MERIDIAN ||
parser->model == CHROMIS || parser->model == MANTIS2 ||
parser->model == G2 || parser->model == ALADINSPORTMATRIX ||
parser->model == ALADINSQUARE || parser->model == G2HUD) {
parser->model == ALADINSQUARE || parser->model == G2HUD ||
parser->model == ALADINA1) {
// Uwatec Galileo
id = uwatec_galileo_identify (data[offset]);
} else {