Fix the oxygen percentage for air dives.

When the dive mode setting is set to air, the oxygen percentage stored
in the header is different from the expected 21%. It might be the last
used nitrox percentage.
This commit is contained in:
Björn Spruck 2012-03-29 21:28:29 +02:00 committed by Jef Driesen
parent 45c0750631
commit 407c40ed38

View File

@ -244,11 +244,23 @@ mares_nemo_parser_get_field (parser_t *abstract, parser_field_type_t type, unsig
*((double *) value) = array_uint16_le (p + 53 - 10) / 10.0;
break;
case FIELD_TYPE_GASMIX_COUNT:
*((unsigned int *) value) = 1;
if (parser->mode == 0 || parser->mode == 1)
*((unsigned int *) value) = 1;
else
*((unsigned int *) value) = 0;
break;
case FIELD_TYPE_GASMIX:
switch (parser->mode) {
case 0: // Air
gasmix->oxygen = 0.21;
break;
case 1: // Nitrox
gasmix->oxygen = p[53 - 43] / 100.0;
break;
default:
return PARSER_STATUS_UNSUPPORTED;
}
gasmix->helium = 0.0;
gasmix->oxygen = p[53 - 43] / 100.0;
gasmix->nitrogen = 1.0 - gasmix->oxygen - gasmix->helium;
break;
default: