summaryrefslogtreecommitdiffstats
path: root/core/planner.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/planner.c')
-rw-r--r--core/planner.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/planner.c b/core/planner.c
index e13fdf9a3..ab53dc0be 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -1056,8 +1056,11 @@ bool plan(struct diveplan *diveplan, struct dive *dive, int timestep, struct dec
stopping = false;
}
}
-
- deco_time = clock - deco_state->bottom_time;
+ /* When calculating deco_time, we should pretend the final ascent rate is always the same,
+ * 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_time = clock - deco_state->bottom_time - stoplevels[2] / last_ascend_rate + 20;
} while (!is_final_plan);
decostoptable[decostopcounter].depth = 0;