diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2015-08-17 21:45:51 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-17 21:45:51 -0700 |
commit | d93984448c3ee1c089c09dcfb9c4b1f38345044c (patch) | |
tree | 2b5d20be9cf5695ea3885cb15b372cd70510b79d /planner.c | |
parent | 2e8286623d3f4e1b8bf3a4d5141cda0839d1d506 (diff) | |
parent | ffe2884f72ace4d04158b72fc806823c87a62e4b (diff) | |
download | subsurface-d93984448c3ee1c089c09dcfb9c4b1f38345044c.tar.gz |
Merge branch 'boyle-ready' of https://github.com/Slagvi/subsurface
Fixed merge conflicts in
deco.c
dive.h
planner.c
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r-- | planner.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -892,6 +892,10 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time clear_to_ascend = false; break; } + if (prefs.deco_mode == VPMB && (!is_vpmb_ok(depth_to_mbar(trial_depth - deltad, &displayed_dive) / 1000.0))){ + clear_to_ascend = false; + break; + } trial_depth -= deltad; } restore_deco_state(trial_cache); @@ -923,6 +927,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool int bottom_depth; int bottom_gi; int bottom_stopidx; + int first_stop_pressure; bool is_final_plan = true; int deco_time; int previous_deco_time; @@ -1102,6 +1107,9 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool //CVA do { is_final_plan = (prefs.deco_mode == BUEHLMANN) || (previous_deco_time - deco_time < 10); // CVA time converges + if (deco_time != 10000000) + vpmb_next_gradient(deco_time, diveplan->surface_pressure / 1000.0); + previous_deco_time = deco_time; restore_deco_state(bottom_cache); @@ -1115,12 +1123,12 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool breaktime = -1; breakcylinder = 0; o2time = 0; + first_stop_pressure = 0; last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time); if ((current_cylinder = get_gasidx(&displayed_dive, &gas)) == -1) { report_error(translate("gettextFromC", "Can't find gas %s"), gasname(&gas)); current_cylinder = 0; } - vpmb_next_gradient(deco_time); while (1) { /* We will break out when we hit the surface */ @@ -1204,6 +1212,11 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool plan_add_segment(diveplan, clock - previous_point_time, depth, gas, po2, false); previous_point_time = clock; stopping = true; + + // Boyles Law compensation + if (first_stop_pressure == 0) + first_stop_pressure = depth_to_mbar(depth, &displayed_dive); + boyles_law(first_stop_pressure / 1000.0, depth_to_mbar(stoplevels[stopidx], &displayed_dive) / 1000.0); } /* Are we waiting to switch gas? |