From 842c4ca466ec56aaff70e7a774a45dde1c95e2d4 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 9 Nov 2015 20:42:13 +0100 Subject: [PATCH] Fix the salt water conversion. The dive computer records the raw absolute pressure. To convert this pressure value into a depth, we need to divide by the salinity factor, not multiply! --- src/uwatec_smart_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uwatec_smart_parser.c b/src/uwatec_smart_parser.c index 66542b3..969c7e4 100644 --- a/src/uwatec_smart_parser.c +++ b/src/uwatec_smart_parser.c @@ -721,7 +721,7 @@ uwatec_smart_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsi *((unsigned int *) value) = array_uint16_le (data + table->divetime) * 60; break; case DC_FIELD_MAXDEPTH: - *((double *) value) = array_uint16_le (data + table->maxdepth) / 100.0 * salinity; + *((double *) value) = array_uint16_le (data + table->maxdepth) / 100.0 / salinity; break; case DC_FIELD_GASMIX_COUNT: *((unsigned int *) value) = parser->ngasmixes; @@ -1164,7 +1164,7 @@ uwatec_smart_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t } if (have_depth) { - sample.depth = (depth - depth_calibration) * salinity; + sample.depth = (depth - depth_calibration) / salinity; if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata); }