Get the gas mix index directly from the event data

There is no need to lookup the gas mix index, because the number is
stored directly in the event data, right next to the oxygen and helium
values. This actually removes an ambiguity in cases where the user has
configured two or more identical gas mixes. In that case, the lookup
would always find the first gas mix.
This commit is contained in:
Jef Driesen 2019-04-02 21:01:21 +02:00
parent 530b28bf6f
commit 5116ee8f2d

View File

@ -729,7 +729,7 @@ suunto_d9_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t ca
ERROR (abstract->context, "Buffer overflow detected!");
return DC_STATUS_DATAFORMAT;
}
unknown = data[offset + 0];
type = data[offset + 0];
he = data[offset + 1];
o2 = data[offset + 2];
if (parser->model == DX || parser->model == VYPERNOVO ||
@ -738,7 +738,7 @@ suunto_d9_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t ca
} else {
seconds = data[offset + 3];
}
idx = suunto_d9_parser_find_gasmix(parser, o2, he);
idx = type & 0x0F;
if (idx >= parser->ngasmixes) {
ERROR (abstract->context, "Invalid gas mix.");
return DC_STATUS_DATAFORMAT;