From bfcd707889c5ba9a19d1f99d586a68937db42fb0 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 25 Jul 2016 10:26:26 +0200 Subject: [PATCH] Fix the parsing of freedives. In freedive mode the sample rate is only 1 second instead of 4 seconds. The tank pressure fields appear to be re-used for some other (unknown) purposes, and should be ignored. --- src/uwatec_smart_parser.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/uwatec_smart_parser.c b/src/uwatec_smart_parser.c index 2524314..48c5163 100644 --- a/src/uwatec_smart_parser.c +++ b/src/uwatec_smart_parser.c @@ -501,7 +501,8 @@ uwatec_smart_parser_cache (uwatec_smart_parser_t *parser) unsigned int beginpressure = 0; unsigned int endpressure = 0; - if (header->tankpressure != UNSUPPORTED) { + if (header->tankpressure != UNSUPPORTED && + divemode != DC_DIVEMODE_FREEDIVE) { if (parser->model == GALILEO || parser->model == GALILEOTRIMIX || parser->model == ALADIN2G || parser->model == MERIDIAN || parser->model == CHROMIS || parser->model == MANTIS2) { @@ -924,6 +925,11 @@ uwatec_smart_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t double salinity = (parser->watertype == DC_WATER_SALT ? SALT : FRESH); + unsigned int interval = 4; + if (parser->divemode == DC_DIVEMODE_FREEDIVE) { + interval = 1; + } + int have_depth = 0, have_temperature = 0, have_pressure = 0, have_rbt = 0, have_heartrate = 0, have_bearing = 0; @@ -1210,7 +1216,7 @@ uwatec_smart_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata); } - time += 4; + time += interval; complete--; } }