From a8ce8c3ef1562559508c77c63ca2d101b3bdcce6 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Wed, 12 Aug 2015 12:06:52 +0200 Subject: Some unification between Buehlmann and VPM-B This patch makes deco_allowed_depth() work both for Buehlmann as well as VPM-B (as long as the VPM-B internal variable total_gradient[] is valid). As a bonus, in VPM-B mode, in the planner, the ceilings are VPM-B ceilings and not Buehlmann GF. Signed-off-by: Robert C. Helling Signed-off-by: Dirk Hohndel --- planner.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'planner.c') diff --git a/planner.c b/planner.c index 9c0c95f45..3c09a610a 100644 --- a/planner.c +++ b/planner.c @@ -33,6 +33,14 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133 double plangflow, plangfhigh; bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions; +/* This is a bit round about: Currently, we only support VPM-B in the planner, + * so, when we compute ceilings we have to know if we are in planning mode since + * the maximally allowed gradient in the tissues is determined by the critical volume algorithm for + * which we currently have no version for logged dives. But the information about the application state + * is only available in the C++/Qt part. So this global variable is a way to leak this info. */ + +bool in_planner = false; + const char *disclaimer; #if DEBUG_PLAN @@ -879,15 +887,11 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time tissue_tolerance = add_segment(depth_to_mbar(trial_depth, &displayed_dive) / 1000.0, gasmix, TIMESTEP, po2, &displayed_dive, prefs.decosac); - if (prefs.deco_mode != VPMB && deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) > trial_depth - deltad) { + if (deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) > trial_depth - deltad) { /* We should have stopped */ clear_to_ascend = false; break; } - if (prefs.deco_mode == VPMB && (!is_vpmb_ok(depth_to_mbar(trial_depth, &displayed_dive) / 1000.0))){ - clear_to_ascend = false; - break; - } trial_depth -= deltad; } restore_deco_state(trial_cache); -- cgit v1.2.3-70-g09d2