From af1ca93fe8ebae7196c3b0a0f75bc347e2097729 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 2 Jan 2013 16:57:28 +0100 Subject: [PATCH] Add support for trimix gas changes. The second gas change event (type 0x06) contains both the oxygen and helium percentages. These are now reported correctly with the new GASCHANGE2 event. --- src/suunto_d9_parser.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/suunto_d9_parser.c b/src/suunto_d9_parser.c index 38b4459..ba50d3b 100644 --- a/src/suunto_d9_parser.c +++ b/src/suunto_d9_parser.c @@ -393,6 +393,7 @@ suunto_d9_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t ca unsigned int event = data[offset++]; unsigned int seconds, type, unknown, heading, percentage; unsigned int current, next; + unsigned int he, o2; sample.event.time = 0; sample.event.flags = 0; @@ -553,12 +554,12 @@ suunto_d9_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t ca if (offset + 4 > size) return DC_STATUS_DATAFORMAT; unknown = data[offset + 0]; - unknown = data[offset + 1]; - percentage = data[offset + 2]; + he = data[offset + 1]; + o2 = data[offset + 2]; seconds = data[offset + 3]; - sample.event.type = SAMPLE_EVENT_GASCHANGE; + sample.event.type = SAMPLE_EVENT_GASCHANGE2; sample.event.time = seconds; - sample.event.value = percentage; + sample.event.value = o2 | (he << 16); if (callback) callback (DC_SAMPLE_EVENT, sample, userdata); offset += 4; break;