Add a function for detecting CCR dives

This commit is contained in:
Jef Driesen 2023-07-10 17:52:23 +02:00
parent ceaaba3e77
commit f818a5a92a

View File

@ -179,6 +179,12 @@ static const dc_parser_vtable_t shearwater_petrel_parser_vtable = {
};
static unsigned int
shearwater_predator_is_ccr (unsigned int divemode)
{
return divemode == M_CC || divemode == M_CC2 || divemode == M_SC;
}
static unsigned int
shearwater_predator_find_gasmix (shearwater_predator_parser_t *parser, unsigned int o2, unsigned int he, unsigned int dil)
{
@ -659,8 +665,7 @@ shearwater_predator_parser_cache (shearwater_predator_parser_t *parser)
for (unsigned int i = 0; i < ngasmixes; ++i) {
if (gasmix[i].oxygen == 0 && gasmix[i].helium == 0)
continue;
if (gasmix[i].diluent &&
(divemode != M_CC && divemode != M_CC2 && divemode != M_SC))
if (gasmix[i].diluent && !shearwater_predator_is_ccr (divemode))
continue;
parser->gasmix[parser->ngasmixes] = gasmix[i];
parser->ngasmixes++;