From 5c1446a87acbdd8c8859a381eb89a131d49ce49f Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Wed, 26 Jun 2019 22:30:34 +0200 Subject: Planner: Wait minimum switch time when bailing out to OC Bailing out does not happen instantly. Rather wait for the minimum stop switch duration before ascending. Signed-off-by: Robert C. Helling --- core/planner.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/planner.c b/core/planner.c index 0abb62920..36ae92c60 100644 --- a/core/planner.c +++ b/core/planner.c @@ -736,10 +736,6 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i printf("depth %5.2lfm \n", depth / 1000.0); printf("current_cylinder %i\n", current_cylinder); #endif - if ((divemode == CCR || divemode == PSCR) && prefs.dobailout) { - divemode = OC; - po2 = 0; - } best_first_ascend_cylinder = current_cylinder; /* Find the gases available for deco */ @@ -832,6 +828,16 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i // VPM-B or Buehlmann Deco tissue_at_end(ds, dive, cached_datap); + if ((divemode == CCR || divemode == PSCR) && prefs.dobailout) { + divemode = OC; + po2 = 0; + add_segment(ds, depth_to_bar(depth, dive), + dive->cylinder[current_cylinder].gasmix, + prefs.min_switch_duration, po2, divemode, prefs.bottomsac); + plan_add_segment(diveplan, prefs.min_switch_duration, depth, current_cylinder, po2, false, divemode); + clock += prefs.min_switch_duration; + last_segment_min_switch = true; + } previous_deco_time = 100000000; ds->deco_time = 10000000; cache_deco_state(ds, &bottom_cache); // Lets us make several iterations -- cgit v1.2.3-70-g09d2