Remove code causing problems with CCR dive log rendering.


Currently, if there is a po2 value for a point in the dive log, the dive is assumed to be CCR. Currently, when a CCR dive has a fo2 of 100%, then the po2 is set as
the same as ambient pressure. This destroys the CCR po2 graph in the dive
profile that derives from oxygen with a fo2 of 100% in one of the
cylinders but which, after adding the dilent gas, has a po2 far below
ambient pressure. The calculation for 100% oxygen only applies to deco
using 100% o2 and then the dive computer calculates the appropriate po2.
This patch removes the setting of po2 to ambient when fo2 is 100%,
1) to enable accurate graphing of po2 values for CCR dives using 100% o2
   in the first cylinder.
2) To use the po2 value reported by the DC in the first place.

Signed-off-by: willem ferguson <[email protected]>


>From f64f69fdfd9a766981a24ecfc0b62e75bbe29060 Mon Sep 17 00:00:00 2001
From: willem ferguson <[email protected]>
Date: Sat, 1 Nov 2014 12:06:49 +0200
Subject: [PATCH 2/2] Remove code causing problems with CCR dive log rendering.

Currently, if there is a po2 given in the dive log, the dive is assumed
to be CCR. When a CCR dive has a fo2 of 100%, then the po2 is set as
the same as ambient pressure. This destroys the CCR po2 graph in the dive
profile that derives from oxygen with a fo2 of 100% in one of the
cylinders but which, after adding the dilent gas, has a po2 far below
ambient pressure. The calculation for 100% oxygen only applies to deco
using 100% o2 and then the dive computer calculates the appropriate po2.
This patch removes the setting of po2 to ambient when fo2 is 100%,
1) to enable accurate graphing of po2 values for CCR dives using 100% o2
   in the first cylinder.
2) To use the po2 value reported by the DC in the first place.

Signed-off-by: willem ferguson <[email protected]>
---
 dive.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/dive.c b/dive.c
index 4320626..5bcdf3a 100644
--- a/dive.c
+++ b/dive.c
@@ -1529,7 +1529,7 @@ int gasmix_distance(const struct gasmix *a, const struct gasmix *b)
 extern void fill_pressures(struct gas_pressures *pressures, const double amb_pressure, const struct gasmix *mix, double po2)
 {
 	if (po2) {	// This is probably a CCR dive where pressures->o2 is defined
-		if (po2 >= amb_pressure || get_o2(mix) == 1000) {
+		if (po2 >= amb_pressure) {
 			pressures->o2 = amb_pressure;
 			pressures->n2 = pressures->he = 0.0;
 		} else {
@@ -1537,8 +1537,7 @@ extern void fill_pressures(struct gas_pressures *pressures, const double amb_pre
 			pressures->he = (amb_pressure - pressures->o2) * (double)get_he(mix) / (1000 - get_o2(mix));
 			pressures->n2 = amb_pressure - pressures->o2 - pressures->he;
 		}
-	} else {
-		// Open circuit dives: no gas pressure values available, they need to be calculated
+	} else {	// Open circuit dives: no gas pressure values available, they need to be calculated
 		pressures->o2 = get_o2(mix) / 1000.0 * amb_pressure; // These calculations are also used if the CCR calculation above..
 		pressures->he = get_he(mix) / 1000.0 * amb_pressure; // ..returned a po2 of zero (i.e. o2 sensor data not resolvable)
 		pressures->n2 = (1000 - get_o2(mix) - get_he(mix)) / 1000.0 * amb_pressure;
-- 
1.9.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to