[PATCH] Profile VPM-B ceiling: ignore negative deco time

Rick Walsh rickmwalsh at gmail.com
Thu Apr 7 01:37:59 PDT 2016


The variable deco_time is used for the CVA iterations to calculate the VPM-B
ceiling. Only positive values should be allowed, otherwise we can get some odd
results in a few cases, such as ceilings being calculated when they shouldn't.

Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
---

This patch corrects the bug reported by John Van Ostrand, where a more conservative ceiling was calculated for a real dive with VPM-B +0 compared to VPM-B +1, which was illogical.

 core/profile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/profile.c b/core/profile.c
index 72c5e02..35b5e42 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -1035,7 +1035,7 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
 			// Do we need to update deco_time?
 			if (final_tts > 0)
 				deco_time = pi->maxtime + final_tts - time_deep_ceiling;
-			else if (time_clear_ceiling > 0)
+			else if (time_clear_ceiling > time_deep_ceiling)
 				deco_time = time_clear_ceiling - time_deep_ceiling;
 			vpmb_next_gradient(deco_time, surface_pressure / 1000.0);
 			final_tts = 0;
-- 
2.5.5



More information about the subsurface mailing list