aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Anton Lundin <glance@acc.umu.se>2014-11-19 22:14:19 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-19 17:46:33 -0800
commit61239a890cce5c50c205aca8988e2fed57fa82b3 (patch)
tree79e4c7951f0574334ff47468340e39b493978a70
parent3dc864f1b109012042887ddd9b421871c63e1bd8 (diff)
downloadsubsurface-61239a890cce5c50c205aca8988e2fed57fa82b3.tar.gz
Import NDL 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>
-rw-r--r--file.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/file.c b/file.c
index 4fe4d3526..a3903dc0c 100644
--- a/file.c
+++ b/file.c
@@ -242,7 +242,8 @@ enum csv_format {
POSEIDON_SENSOR1,
POSEIDON_SENSOR2,
POSEIDON_PRESSURE,
- POSEIDON_O2CYLINDER
+ POSEIDON_O2CYLINDER,
+ POSEIDON_NDL
};
static void add_sample_data(struct sample *sample, enum csv_format type, double val)
@@ -278,6 +279,9 @@ static void add_sample_data(struct sample *sample, enum csv_format type, double
case POSEIDON_O2CYLINDER:
sample->o2cylinderpressure.mbar = val * 1000;
break;
+ case POSEIDON_NDL:
+ sample->ndl.seconds = val * 60;
+ break;
}
}
@@ -477,8 +481,8 @@ int parse_txt_file(const char *filename, const char *csv)
if (MATCH(memtxt.buffer, "MkVI_Config") == 0) {
int d, m, y, he;
int hh = 0, mm = 0, ss = 0;
- int prev_depth = 0, cur_sampletime = 0, prev_setpoint = -1;
- bool has_depth = false, has_setpoint = false;
+ int prev_depth = 0, cur_sampletime = 0, prev_setpoint = -1, prev_ndl = -1;
+ bool has_depth = false, has_setpoint = false, has_ndl = false;
char *lineptr, *key, *value;
int o2cylinder_pressure = 0, cylinder_pressure = 0, cur_cylinder_index = 0;
@@ -575,6 +579,7 @@ int parse_txt_file(const char *filename, const char *csv)
has_depth = false;
has_setpoint = false;
+ has_ndl = false;
sample = prepare_sample(dc);
sample->time.seconds = cur_sampletime;
@@ -615,6 +620,12 @@ int parse_txt_file(const char *filename, const char *csv)
prev_setpoint = value;
add_sample_data(sample, POSEIDON_SETPOINT, value);
break;
+ case 37:
+ //Remaining dive time #2?
+ has_ndl = true;
+ prev_ndl = value;
+ add_sample_data(sample, POSEIDON_NDL, value);
+ break;
case 39:
add_sample_data(sample, POSEIDON_TEMP, value);
break;
@@ -642,6 +653,8 @@ int parse_txt_file(const char *filename, const char *csv)
add_sample_data(sample, POSEIDON_DEPTH, prev_depth);
if (!has_setpoint)
add_sample_data(sample, POSEIDON_SETPOINT, prev_setpoint);
+ if (!has_ndl)
+ add_sample_data(sample, POSEIDON_NDL, prev_ndl);
if (cylinder_pressure)
dive->cylinder[1].sample_end.mbar = cylinder_pressure * 1000;
if (o2cylinder_pressure)