aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-11-19 22:14:22 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-19 17:50:01 -0800
commit8486a3251543d1afb391425d3d193a51c3bd1190 (patch)
tree072c8ec18a31b083234f81d94903e491c2778b09 /file.c
parent7caad0c0dfc05964e99786aa3cbf5b38b012d258 (diff)
downloadsubsurface-8486a3251543d1afb391425d3d193a51c3bd1190.tar.gz
Create gaschange events from Poseidon MkVI logs
This is based on the great work done by Søren Reinke's on his MKVI Logfile Analyzer. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/file.c b/file.c
index 85414273a..f9475b71f 100644
--- a/file.c
+++ b/file.c
@@ -11,6 +11,9 @@
#include "dive.h"
#include "file.h"
+/* For SAMPLE_* */
+#include <libdivecomputer/parser.h>
+
/* Crazy windows sh*t */
#ifndef O_BINARY
#define O_BINARY 0
@@ -577,6 +580,7 @@ int parse_txt_file(const char *filename, const char *csv)
int type;
int value;
int sampletime;
+ int gaschange = 0;
/* Collect all the information for one sample */
sscanf(lineptr, "%d,%d,%d", &cur_sampletime, &type, &value);
@@ -658,6 +662,14 @@ int parse_txt_file(const char *filename, const char *csv)
case 39:
add_sample_data(sample, POSEIDON_TEMP, value);
break;
+ case 85:
+ //He diluent part in %
+ gaschange ^= value << 16;
+ break;
+ case 86:
+ //O2 diluent part in %
+ gaschange ^= value;
+ break;
default:
break;
} /* sample types */
@@ -678,6 +690,9 @@ int parse_txt_file(const char *filename, const char *csv)
sscanf(lineptr, "%d,%d,%d", &cur_sampletime, &type, &value);
} while (sampletime == cur_sampletime);
+ if (gaschange)
+ add_event(dc, cur_sampletime, SAMPLE_EVENT_GASCHANGE2, 0, gaschange,
+ QT_TRANSLATE_NOOP("gettextFromC", "gaschange"));
if (!has_depth)
add_sample_data(sample, POSEIDON_DEPTH, prev_depth);
if (!has_setpoint)