From f77e9c03fc1e46f4c6e7e4172ae9507faea8fb40 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 10 Jul 2023 17:53:13 +0200 Subject: [PATCH] Restrict the oxygen/diluent usage to CCR dives For open-circuit dives, the oxygen and diluent usage doesn't make any sense at all. But when an open-circuit diver uses the letter 'D' to indicate a tank for decompression use, it will get incorrectly labeled as a diluent tank. Fixed by restricting the oxygen/diluent usage to CCR dives only. --- src/shearwater_predator_parser.c | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/src/shearwater_predator_parser.c b/src/shearwater_predator_parser.c index 534d8e0..d1a1cd6 100644 --- a/src/shearwater_predator_parser.c +++ b/src/shearwater_predator_parser.c @@ -746,21 +746,24 @@ shearwater_predator_parser_get_field (dc_parser_t *abstract, dc_field_type_t typ tank->beginpressure = parser->tank[flags].beginpressure * 2 * PSI / BAR; tank->endpressure = parser->tank[flags].endpressure * 2 * PSI / BAR; tank->gasmix = DC_GASMIX_UNKNOWN; - switch (parser->tank[flags].name[0]) { - case 'S': - tank->usage = DC_USAGE_SIDEMOUNT; - break; - case 'O': - tank->usage = DC_USAGE_OXYGEN; - break; - case 'D': - tank->usage = DC_USAGE_DILUENT; - break; - case 'T': - case 'B': - default: - tank->usage = DC_USAGE_NONE; - break; + if (shearwater_predator_is_ccr (parser->divemode)) { + switch (parser->tank[flags].name[0]) { + case 'O': + tank->usage = DC_USAGE_OXYGEN; + break; + case 'D': + tank->usage = DC_USAGE_DILUENT; + break; + default: + tank->usage = DC_USAGE_NONE; + break; + } + } else { + if (parser->tank[flags].name[0] == 'S') { + tank->usage = DC_USAGE_SIDEMOUNT; + } else { + tank->usage = DC_USAGE_NONE; + } } break; case DC_FIELD_SALINITY: