From 17b3e0739877bb44c78af7a30a3e414d55826a7e Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 9 Aug 2018 23:49:25 +0200 Subject: [PATCH] Fix the average depth for older OSTC dives For older OSTC dives, using logbook format version 0x20, the average depth is not available in the dive header. It's only available since version 0x21, which increased the header size from 47 to 57 bytes. --- src/hw_ostc_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hw_ostc_parser.c b/src/hw_ostc_parser.c index bf28be9..f377684 100644 --- a/src/hw_ostc_parser.c +++ b/src/hw_ostc_parser.c @@ -465,6 +465,8 @@ hw_ostc_parser_get_field (dc_parser_t *abstract, dc_field_type_t type, unsigned *((double *) value) = array_uint16_le (data + layout->maxdepth) / 100.0; break; case DC_FIELD_AVGDEPTH: + if (parser->version < 0x21) + return DC_STATUS_UNSUPPORTED; *((double *) value) = array_uint16_le (data + layout->avgdepth) / 100.0; break; case DC_FIELD_GASMIX_COUNT: