From 449b65cf1b291e808dfb8dc2f378774438f8ab87 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Fri, 25 Jun 2021 17:15:43 +0200 Subject: [PATCH] Fix the depth decoding With just 12 bits, the depth values are limited to at most 40.95m. However for some deeper dives, this appears to be wrong. The next two higher bits, which were previously unknown, are also part of the depth. This increases the maximum depth to 163.83m. --- src/sporasub_sp2_parser.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sporasub_sp2_parser.c b/src/sporasub_sp2_parser.c index e036dd2..f2208a1 100644 --- a/src/sporasub_sp2_parser.c +++ b/src/sporasub_sp2_parser.c @@ -170,8 +170,7 @@ sporasub_sp2_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t unsigned int value = array_uint32_le (data + offset); unsigned int heartrate = (value & 0xFF000000) >> 24; unsigned int temperature = (value & 0x00FFC000) >> 14; - unsigned int unknown = (value & 0x00003000) >> 12; - unsigned int depth = (value & 0x00000FFF) >> 0; + unsigned int depth = (value & 0x00003FFF) >> 0; // Time (seconds) time += interval;