summaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-11-17 12:25:00 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-17 11:45:06 +0000
commit0d7c192e6edc1fba710632fd0844126e7c488599 (patch)
tree575f5746c06ebb8723c65d46aa6008d971d96881 /file.c
parent5ed4876ad29c2952d84814b586572f5515afba94 (diff)
downloadsubsurface-0d7c192e6edc1fba710632fd0844126e7c488599.tar.gz
For CCR dives, the diluent cylinder is the current cylinder
Change the meaning that _the_ cylinder (as we treat it in OC dives) is the diluent cylinder (rather than the O2 cylinder). This eliminates special cases. Now, for CCR, we have to handle the O2 cylinder in addition (rather than the diluent in addition). Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'file.c')
-rw-r--r--file.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/file.c b/file.c
index a71f9d0f3..97095fd6c 100644
--- a/file.c
+++ b/file.c
@@ -242,7 +242,7 @@ enum csv_format {
POSEIDON_SENSOR1,
POSEIDON_SENSOR2,
POSEIDON_PRESSURE,
- POSEIDON_DILUENT
+ POSEIDON_O2CYLINDER
};
static void add_sample_data(struct sample *sample, enum csv_format type, double val)
@@ -275,8 +275,8 @@ static void add_sample_data(struct sample *sample, enum csv_format type, double
case POSEIDON_PRESSURE:
sample->cylinderpressure.mbar = val * 1000;
break;
- case POSEIDON_DILUENT:
- sample->diluentpressure.mbar = val * 1000;
+ case POSEIDON_O2CYLINDER:
+ sample->o2cylinderpressure.mbar = val * 1000;
break;
}
}
@@ -480,7 +480,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, *key, *value;
- int diluent_pressure = 0, cylinder_pressure = 0, cur_cylinder_index = 0;
+ int o2cylinder_pressure = 0, cylinder_pressure = 0, cur_cylinder_index = 0;
struct dive *dive;
struct divecomputer *dc;
@@ -595,6 +595,14 @@ int parse_txt_file(const char *filename, const char *csv)
add_sample_data(sample, POSEIDON_DEPTH, value);
break;
case 13:
+ add_sample_data(sample, POSEIDON_O2CYLINDER, value);
+ if (!o2cylinder_pressure) {
+ dive->cylinder[1].sample_start.mbar = value * 1000;
+ o2cylinder_pressure = value;
+ } else
+ o2cylinder_pressure = value;
+ break;
+ case 14:
add_sample_data(sample, POSEIDON_PRESSURE, value);
if (!cylinder_pressure) {
dive->cylinder[0].sample_start.mbar = value * 1000;
@@ -602,14 +610,6 @@ int parse_txt_file(const char *filename, const char *csv)
} 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;
prev_setpoint = value;
@@ -643,9 +643,9 @@ int parse_txt_file(const char *filename, const char *csv)
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;
+ dive->cylinder[1].sample_end.mbar = cylinder_pressure * 1000;
+ if (o2cylinder_pressure)
+ dive->cylinder[0].sample_end.mbar = o2cylinder_pressure * 1000;
finish_sample(dc);
if (!lineptr || !*lineptr)