summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2015-06-20 11:40:36 +1000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-20 18:20:18 -0700
commite5a4b5a61838d7c3f95856ce11c21fe7aa992eb4 (patch)
tree2bb870d6022cdab9f8afd7a1474c72ee04cfd30d /planner.c
parent2f25fe9f0ba6832020b9a38762a709eaaa09dea1 (diff)
downloadsubsurface-e5a4b5a61838d7c3f95856ce11c21fe7aa992eb4.tar.gz
Planner - end deco stops at whole minutes of runtime
--20cf303ddd3893b1500518e9204e Content-Type: text/plain; charset=UTF-8 Use an adjusted timestep to calculate length of deco stops, so that they always end at whole minutes of runtime. This makes for a cleaner ascent profile. <div dir="ltr">Use an adjusted timestep to calculate length of deco stops, so that they always end at whole minutes of runtime.  This makes for a cleaner ascent profile.<br></div> From 15e08450252f304fc7d46931e2aca5c991c2f3de Mon Sep 17 00:00:00 2001 From: Rick Walsh <rickmwalsh@gmail.com> Date: Sat, 20 Jun 2015 11:36:07 +1000 Subject: [PATCH 2/2] Planner - end deco stops at whole minutes of runtime Use an adjusted timestep to calculate length of deco stops, so that they always end at whole minutes of runtime. This makes for a cleaner ascent profile. 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.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index 63f1f6364..be6986679 100644
--- a/planner.c
+++ b/planner.c
@@ -1076,10 +1076,15 @@ bool plan(struct diveplan *diveplan, char **cached_datap, bool is_planner, bool
previous_point_time = clock;
stopping = true;
}
+
+ /* Deco stop should end when runtime is at a whole minute */
+ int this_decotimestep;
+ this_decotimestep = DECOTIMESTEP - clock % DECOTIMESTEP;
+
tissue_tolerance = add_segment(depth_to_mbar(depth, &displayed_dive) / 1000.0,
&displayed_dive.cylinder[current_cylinder].gasmix,
- DECOTIMESTEP, po2, &displayed_dive, prefs.decosac);
- clock += DECOTIMESTEP;
+ this_decotimestep, po2, &displayed_dive, prefs.decosac);
+ clock += this_decotimestep;
/* Finish infinite deco */
if(clock >= 48 * 3600 && depth >= 6000) {
error = LONGDECO;