From 7bbe71ff3399334e617d4e07e321336c03ddc9ab Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Sat, 12 Jul 2014 15:51:03 +0300 Subject: Detect proper event type based on helium content Select proper SAMPLE_EVENT_GASCHANGE "version" based on helium content on the mix. Signed-off-by: Miika Turkia Signed-off-by: Dirk Hohndel --- parse-xml.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'parse-xml.c') diff --git a/parse-xml.c b/parse-xml.c index 606e25196..20eafc31d 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "gettext.h" @@ -712,7 +713,7 @@ void add_gas_switch_event(struct dive *dive, struct divecomputer *dc, int second he = (he + 5) / 10; value = o2 + (he << 16); - add_event(dc, seconds, 25, 0, value, "gaschange"); /* SAMPLE_EVENT_GASCHANGE2 */ + add_event(dc, seconds, he ? SAMPLE_EVENT_GASCHANGE2 : SAMPLE_EVENT_GASCHANGE, 0, value, "gaschange"); } static void get_cylinderindex(char *buffer, uint8_t *i) @@ -1341,7 +1342,7 @@ static void event_end(void) * one on import, if we encounter the type one missing. */ if (cur_event.type == 0 && strcmp(cur_event.name, "gaschange") == 0) - cur_event.type = 25; + cur_event.type = cur_event.value >> 16 > 0 ? SAMPLE_EVENT_GASCHANGE2 : SAMPLE_EVENT_GASCHANGE; add_event(dc, cur_event.time.seconds, cur_event.type, cur_event.flags, -- cgit v1.2.3-70-g09d2