From 95920af7b7eb2963ef0dacf91ed1afaf8c1644d0 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 4 Mar 2021 12:16:57 +0100 Subject: [PATCH 1/2] Fix the maximum depth The upper bits appear to contain some other (currently unknown) information. The Oceanic VT Pro specifications list a maximum depth of 399 ft (120 m), which requires only 9 bits. The Oceanic application also ignores the higher bits. --- src/oceanic_vtpro_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/oceanic_vtpro_parser.c b/src/oceanic_vtpro_parser.c index d09b2f9..54a52d8 100644 --- a/src/oceanic_vtpro_parser.c +++ b/src/oceanic_vtpro_parser.c @@ -181,7 +181,7 @@ oceanic_vtpro_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, uns maxdepth = data[footer + 1]; } else { oxygen = data[footer + 3]; - maxdepth = array_uint16_le(data + footer + 0) & 0x0FFF; + maxdepth = array_uint16_le(data + footer + 0) & 0x01FF; } dc_gasmix_t *gasmix = (dc_gasmix_t *) value; From d49a8a3e645004b47461f446f6e439752bd91129 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 4 Mar 2021 12:33:14 +0100 Subject: [PATCH 2/2] Implement the ndl/deco sample --- src/oceanic_vtpro_parser.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/oceanic_vtpro_parser.c b/src/oceanic_vtpro_parser.c index 54a52d8..fff7389 100644 --- a/src/oceanic_vtpro_parser.c +++ b/src/oceanic_vtpro_parser.c @@ -359,6 +359,21 @@ oceanic_vtpro_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_ sample.temperature = (temperature - 32.0) * (5.0 / 9.0); if (callback) callback (DC_SAMPLE_TEMPERATURE, sample, userdata); + // NDL / Deco + if (parser->model != AERIS500AI) { + unsigned int decostop = (data[offset + 5] & 0xF0) >> 4; + unsigned int decotime = array_uint16_le(data + offset + 4) & 0x0FFF; + if (decostop) { + sample.deco.type = DC_DECO_DECOSTOP; + sample.deco.depth = decostop * 10 * FEET; + } else { + sample.deco.type = DC_DECO_NDL; + sample.deco.depth = 0.0; + } + sample.deco.time = decotime * 60; + if (callback) callback (DC_SAMPLE_DECO, sample, userdata); + } + offset += PAGESIZE / 2; }