aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar willem ferguson <willemferguson@zoology.up.ac.za>2014-10-14 11:37:30 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-10-14 20:33:46 +0200
commit51a112c8bfa8e3d7eb78abeb516261f342c8aced (patch)
tree13395b694e7c4670683ef13e257382d8c03a6dc8
parent34bb461c3de7cd0b8d9d3eaf13b1bc45973c16d3 (diff)
downloadsubsurface-51a112c8bfa8e3d7eb78abeb516261f342c8aced.tar.gz
CCR patch: Correction of inconsistency in profile.c
fill_o2_values() in profile.c: Robert identified the inconsistency of po2 assignmemts when using OC dives as opposed to CCR dives. This is corrected here. OC dives still need to be processed in this function because the po2 values have not been initialised anywhere else before thos code executes. Signed-off-by: willem ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--profile.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/profile.c b/profile.c
index 2af81100f..93222f5f1 100644
--- a/profile.c
+++ b/profile.c
@@ -946,12 +946,13 @@ void fill_o2_values(struct divecomputer *dc, struct plot_info *pi, struct dive *
last_sensor[j] = entry->o2sensor[j];
else
entry->o2sensor[j] = last_sensor[j];
- }
+ } // having initialised the empty o2 sensor values for this point on the profile,
+ amb_pressure = depth_to_mbar(entry->depth, dive) / 1000.0;
+ o2pressure = calculate_ccr_po2(entry,dc); // ...calculate the po2 based on the sensor data
+ entry->pressures.o2 = MIN(o2pressure, amb_pressure);
+ } else {
+ entry->pressures.o2 = 0.0; // initialise po2 to zero for dctype = OC
}
- amb_pressure = depth_to_mbar(entry->depth, dive) / 1000.0;
- o2pressure = calculate_ccr_po2(entry,dc);
- if (o2pressure > amb_pressure) o2pressure = amb_pressure;
- entry->pressures.o2 = o2pressure;
}
}