aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Rick Walsh <rickmwalsh@gmail.com>2017-11-08 20:09:23 +1100
committerGravatar Robert C. Helling <helling@atdotde.de>2017-11-08 15:22:32 +0100
commit13b909cf82efeac3a7be0c9867a01c4cf393cfab (patch)
tree37de6929c9dc266e25bdf32cebd5bedce79b0c00
parent05b411360936f879ac1ea8b131d22fe073255f9d (diff)
downloadsubsurface-13b909cf82efeac3a7be0c9867a01c4cf393cfab.tar.gz
VPMB: calculate time of final ascent properly
Commit d15779a calculates final stop based on stoplevels[2], but if final stop is 6m/20ft, we should use stoplevels[3]. This fixes it. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
-rw-r--r--core/planner.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/planner.c b/core/planner.c
index 6632c76a4..c18dd8553 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -1060,7 +1060,7 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
* otherwise odd things can happen, such as CVA causing the final ascent to start *later*
* if the ascent rate is slower, which is completely nonsensical.
* Assume final ascent takes 20s, which is the time taken to ascend at 9m/min from 3m */
- deco_state->deco_time = clock - bottom_time - stoplevels[2] / last_ascend_rate + 20;
+ deco_state->deco_time = clock - bottom_time - stoplevels[stopidx + 1] / last_ascend_rate + 20;
} while (!is_final_plan);
decostoptable[decostopcounter].depth = 0;