summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2014-11-01 10:06:46 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-01 22:09:36 -0700
commitdd73f422e08ad41dd78bdc549ed97bd57e32d864 (patch)
tree95e4ab88f563ff8f823943adabb1aa4274a57360 /file.c
parent9e2ce3d99aee3832187be21b93e525e8508da9da (diff)
downloadsubsurface-dd73f422e08ad41dd78bdc549ed97bd57e32d864.tar.gz
Add pressures to cylinder declaration for MK6 import
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> 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 c22f29f91..bab7909d7 100644
--- a/file.c
+++ b/file.c
@@ -449,6 +449,7 @@ int parse_txt_file(const char *filename, const char *csv)
int prev_depth = 0, cur_sampletime = 0, prev_setpoint = -1;
bool has_depth = false, has_setpoint = false;
char *lineptr;
+ static int diluent_pressure = 0, cylinder_pressure = 0;
struct dive *dive;
struct divecomputer *dc;
@@ -545,9 +546,19 @@ int parse_txt_file(const char *filename, const char *csv)
break;
case 13:
add_sample_data(sample, POSEIDON_PRESSURE, value);
+ if (!cylinder_pressure) {
+ dive->cylinder[0].sample_start.mbar = value * 1000;
+ cylinder_pressure = value;
+ } else
+ cylinder_pressure = value;
break;
case 14:
add_sample_data(sample, POSEIDON_DILUENT, value);
+ if (!diluent_pressure) {
+ dive->cylinder[1].sample_start.mbar = value * 1000;
+ diluent_pressure = value;
+ } else
+ diluent_pressure = value;
break;
case 20:
has_setpoint = true;
@@ -581,6 +592,10 @@ 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 (cylinder_pressure)
+ dive->cylinder[0].sample_end.mbar = cylinder_pressure * 1000;
+ if (diluent_pressure)
+ dive->cylinder[1].sample_end.mbar = diluent_pressure * 1000;
finish_sample(dc);
if (!lineptr || !*lineptr)