mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
3dc864f1b1
commit
61239a890c
1 changed files with 16 additions and 3 deletions
19
file.c
19
file.c
|
@ -242,7 +242,8 @@ enum csv_format {
|
||||||
POSEIDON_SENSOR1,
|
POSEIDON_SENSOR1,
|
||||||
POSEIDON_SENSOR2,
|
POSEIDON_SENSOR2,
|
||||||
POSEIDON_PRESSURE,
|
POSEIDON_PRESSURE,
|
||||||
POSEIDON_O2CYLINDER
|
POSEIDON_O2CYLINDER,
|
||||||
|
POSEIDON_NDL
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add_sample_data(struct sample *sample, enum csv_format type, double val)
|
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:
|
case POSEIDON_O2CYLINDER:
|
||||||
sample->o2cylinderpressure.mbar = val * 1000;
|
sample->o2cylinderpressure.mbar = val * 1000;
|
||||||
break;
|
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) {
|
if (MATCH(memtxt.buffer, "MkVI_Config") == 0) {
|
||||||
int d, m, y, he;
|
int d, m, y, he;
|
||||||
int hh = 0, mm = 0, ss = 0;
|
int hh = 0, mm = 0, ss = 0;
|
||||||
int prev_depth = 0, cur_sampletime = 0, prev_setpoint = -1;
|
int prev_depth = 0, cur_sampletime = 0, prev_setpoint = -1, prev_ndl = -1;
|
||||||
bool has_depth = false, has_setpoint = false;
|
bool has_depth = false, has_setpoint = false, has_ndl = false;
|
||||||
char *lineptr, *key, *value;
|
char *lineptr, *key, *value;
|
||||||
int o2cylinder_pressure = 0, cylinder_pressure = 0, cur_cylinder_index = 0;
|
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_depth = false;
|
||||||
has_setpoint = false;
|
has_setpoint = false;
|
||||||
|
has_ndl = false;
|
||||||
sample = prepare_sample(dc);
|
sample = prepare_sample(dc);
|
||||||
sample->time.seconds = cur_sampletime;
|
sample->time.seconds = cur_sampletime;
|
||||||
|
|
||||||
|
@ -615,6 +620,12 @@ int parse_txt_file(const char *filename, const char *csv)
|
||||||
prev_setpoint = value;
|
prev_setpoint = value;
|
||||||
add_sample_data(sample, POSEIDON_SETPOINT, value);
|
add_sample_data(sample, POSEIDON_SETPOINT, value);
|
||||||
break;
|
break;
|
||||||
|
case 37:
|
||||||
|
//Remaining dive time #2?
|
||||||
|
has_ndl = true;
|
||||||
|
prev_ndl = value;
|
||||||
|
add_sample_data(sample, POSEIDON_NDL, value);
|
||||||
|
break;
|
||||||
case 39:
|
case 39:
|
||||||
add_sample_data(sample, POSEIDON_TEMP, value);
|
add_sample_data(sample, POSEIDON_TEMP, value);
|
||||||
break;
|
break;
|
||||||
|
@ -642,6 +653,8 @@ int parse_txt_file(const char *filename, const char *csv)
|
||||||
add_sample_data(sample, POSEIDON_DEPTH, prev_depth);
|
add_sample_data(sample, POSEIDON_DEPTH, prev_depth);
|
||||||
if (!has_setpoint)
|
if (!has_setpoint)
|
||||||
add_sample_data(sample, POSEIDON_SETPOINT, prev_setpoint);
|
add_sample_data(sample, POSEIDON_SETPOINT, prev_setpoint);
|
||||||
|
if (!has_ndl)
|
||||||
|
add_sample_data(sample, POSEIDON_NDL, prev_ndl);
|
||||||
if (cylinder_pressure)
|
if (cylinder_pressure)
|
||||||
dive->cylinder[1].sample_end.mbar = cylinder_pressure * 1000;
|
dive->cylinder[1].sample_end.mbar = cylinder_pressure * 1000;
|
||||||
if (o2cylinder_pressure)
|
if (o2cylinder_pressure)
|
||||||
|
|
Loading…
Add table
Reference in a new issue