diff options
author | Miika Turkia <miika.turkia@gmail.com> | 2014-07-12 15:51:03 +0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-12 08:05:09 -0700 |
commit | 7bbe71ff3399334e617d4e07e321336c03ddc9ab (patch) | |
tree | a91055bea348cd9858d194d45964e73e885e605a /parse-xml.c | |
parent | 97597dfd97295517383336d2050d7a4b554b0d3c (diff) | |
download | subsurface-7bbe71ff3399334e617d4e07e321336c03ddc9ab.tar.gz |
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 <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'parse-xml.c')
-rw-r--r-- | parse-xml.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 <libxml/parserInternals.h> #include <libxml/tree.h> #include <libxslt/transform.h> +#include <libdivecomputer/parser.h> #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, |