diff options
author | Rick Walsh <rickmwalsh@gmail.com> | 2015-08-29 21:54:22 +1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-08-29 20:06:46 -0700 |
commit | 27ba48a09e1fb43d4ac29e946d2fd97833d69526 (patch) | |
tree | a79ac8520d0c99c883f06404867cc48138130cff /planner.c | |
parent | 2d45e587ba95eacbec41439931f06520fc22df73 (diff) | |
download | subsurface-27ba48a09e1fb43d4ac29e946d2fd97833d69526.tar.gz |
Planner: Change where we clear deco and reset gradients
We should run clear_deco as early as we can. We should calculate the nuclear
regeneration and start gradient after calculating tissue tolerance. We don't
need to redo nuclear regeration and start gradient after that.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r-- | planner.c | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -960,6 +960,8 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth); if (!diveplan->surface_pressure) diveplan->surface_pressure = SURFACE_PRESSURE; + displayed_dive.surface_pressure.mbar = diveplan->surface_pressure; + clear_deco(displayed_dive.surface_pressure.mbar / 1000.0); create_dive_from_plan(diveplan, is_planner); // Do we want deco stop array in metres or feet? @@ -1000,14 +1002,6 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool create_dive_from_plan(diveplan, is_planner); return(false); } - nuclear_regeneration(clock); - clear_deco(displayed_dive.surface_pressure.mbar / 1000.0); - vpmb_start_gradient(); - previous_deco_time = 100000000; - deco_time = 10000000; - - tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); - displayed_dive.surface_pressure.mbar = diveplan->surface_pressure; #if DEBUG_PLAN & 4 printf("gas %s\n", gasname(&gas)); @@ -1037,6 +1031,11 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool bottom_time = clock = previous_point_time = displayed_dive.dc.sample[displayed_dive.dc.samples - 1].time.seconds; gi = gaschangenr - 1; + /* Set tissue tolerance and initial vpmb gradient at start of ascent phase */ + tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); + nuclear_regeneration(clock); + vpmb_start_gradient(); + if(prefs.deco_mode == RECREATIONAL) { bool safety_stop = prefs.safetystop && max_depth >= 10000; track_ascent_gas(depth, &displayed_dive.cylinder[current_cylinder], avg_depth, bottom_time, safety_stop); @@ -1101,8 +1100,7 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool } // VPM-B or Buehlmann Deco - nuclear_regeneration(clock); - vpmb_start_gradient(); + tissue_tolerance = tissue_at_end(&displayed_dive, cached_datap); previous_deco_time = 100000000; deco_time = 10000000; cache_deco_state(tissue_tolerance, &bottom_cache); // Lets us make several iterations |