From d1242a28cfb2f69115486ce491c5165e1fe9cde8 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 7 Feb 2022 21:36:59 +0100 Subject: [PATCH] Use the correct model number from the final block During the download, the model number is obtained from the hardware type because the model number isn't available before downloading the first dive. Since the list with available hardware types is incomplete, the correct model number is not always available. However, during parsing the correct model number is available in the final block. --- src/shearwater_predator_parser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c index b6f223b..d7a8ad8 100644 --- a/src/shearwater_predator_parser.c +++ b/src/shearwater_predator_parser.c @@ -524,6 +524,11 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser) divemode = data[parser->opening[4] + (pnf ? 1 : 112)]; } + // Get the correct model number from the final block. + if (parser->final != UNDEFINED) { + parser->model = data[parser->final + 13]; + } + // Cache the data for later use. parser->pnf = pnf; parser->logversion = logversion;