From 13b909cf82efeac3a7be0c9867a01c4cf393cfab Mon Sep 17 00:00:00 2001 From: Rick Walsh Date: Wed, 8 Nov 2017 20:09:23 +1100 Subject: 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 --- core/planner.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- cgit v1.2.3-70-g09d2