diff --git a/src/suunto_d9_parser.c b/src/suunto_d9_parser.c index f982902..e3b97f4 100644 --- a/src/suunto_d9_parser.c +++ b/src/suunto_d9_parser.c @@ -335,6 +335,16 @@ suunto_d9_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t ca if (rc != DC_STATUS_SUCCESS) return rc; + // Initial gasmix. + unsigned int gasmix = 0; + if (parser->model == HELO2) { + gasmix = data[0x26]; + } + if (gasmix >= parser->ngasmixes) { + ERROR (abstract->context, "Invalid initial gas mix."); + return DC_STATUS_DATAFORMAT; + } + // Number of parameters in the configuration data. unsigned int nparams = data[parser->config]; if (nparams == 0 || nparams > MAXPARAMS) @@ -433,6 +443,23 @@ suunto_d9_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t ca } } + // Initial gasmix. + if (time == 0) { + unsigned int he = 0; + unsigned int o2 = 0; + if (parser->mode == AIR) { + he = 0; + o2 = 21; + } else { + he = parser->helium[gasmix]; + o2 = parser->oxygen[gasmix]; + } + sample.event.type = SAMPLE_EVENT_GASCHANGE2; + sample.event.time = 0; + sample.event.value = o2 | (he << 16); + if (callback) callback (DC_SAMPLE_EVENT, sample, userdata); + } + // Events if ((nsamples + 1) == marker) { while (offset < size) {