aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2019-06-26 22:30:34 +0200
committerGravatar Robert C. Helling <helling@atdotde.de>2019-06-28 15:58:52 +0200
commit5c1446a87acbdd8c8859a381eb89a131d49ce49f (patch)
tree7dce7d7957851a2b2093614c43c7afdf0458cb7d
parent019eeec93d3399a2e277ff9399320764043e38c1 (diff)
downloadsubsurface-5c1446a87acbdd8c8859a381eb89a131d49ce49f.tar.gz
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 <helling@atdotde.de>
-rw-r--r--core/planner.c14
1 files 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