summaryrefslogtreecommitdiffstats
path: root/dive.c
diff options
context:
space:
mode:
authorGravatar willem ferguson <willemferguson@zoology.up.ac.za>2014-10-05 16:54:19 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-10 02:34:02 -0400
commitc5490af1927c9cc622b7f9550edf670df94f0c34 (patch)
tree05f641ce0020616cb61642428f596497bae0cab7 /dive.c
parent272f85bb244462acf09cb4235a9b176f68f75a5f (diff)
downloadsubsurface-c5490af1927c9cc622b7f9550edf670df94f0c34.tar.gz
CCR dives: Clear duplicate diluent gas pressure readings
This patch concludes the calculation of gas pressure readings for CCR dives. Duplicate diluent gas pressures are removed from the dive structure and set to zero, as is done for the other gases. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.c')
-rw-r--r--dive.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/dive.c b/dive.c
index ea771f94e..15fcbf51b 100644
--- a/dive.c
+++ b/dive.c
@@ -1046,7 +1046,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
int maxdepth = dc->maxdepth.mm;
int mintemp = 0;
int lastdepth = 0;
- int lasttemp = 0, lastpressure = 0;
+ int lasttemp = 0, lastpressure = 0, lastdiluentpressure = 0;
int pressure_delta[MAX_CYLINDERS] = { INT_MAX, };
/* Fixup duration and mean depth */
@@ -1059,12 +1059,15 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
int depth = sample->depth.mm;
int temp = sample->temperature.mkelvin;
int pressure = sample->cylinderpressure.mbar;
+ int diluent_pressure = sample->diluentpressure.mbar;
int index = sample->sensor;
if (index == lastindex) {
/* Remove duplicate redundant pressure information */
if (pressure == lastpressure)
sample->cylinderpressure.mbar = 0;
+ if (diluent_pressure == lastdiluentpressure)
+ sample->diluentpressure.mbar = 0;
/* check for simply linear data in the samples
+INT_MAX means uninitialized, -INT_MAX means not linear */
if (pressure_delta[index] != -INT_MAX && lastpressure) {
@@ -1082,6 +1085,7 @@ static void fixup_dive_dc(struct dive *dive, struct divecomputer *dc)
}
lastindex = index;
lastpressure = pressure;
+ lastdiluentpressure = diluent_pressure;
if (depth > SURFACE_THRESHOLD) {
if (depth > maxdepth)