diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-05-05 16:34:50 +0200 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2018-05-07 21:17:22 +0300 |
commit | ac1ec486ae0cd0295166bb1dc0d5b82dc237a5b1 (patch) | |
tree | 89348c0d05372257bd765e9c9110f716066be2de /core/planner.c | |
parent | 70bb4c145bd60c80153b9700edd5a914a45fea84 (diff) | |
download | subsurface-ac1ec486ae0cd0295166bb1dc0d5b82dc237a5b1.tar.gz |
Planner: Unify final ascent rates in plan() and fake_dc()
When generating fake profiles for manually entered dives, fake_dc() and
plan() used different final ascent rates of 5 m/min and 4.5 m/min,
respectively. This led to dives that were 6 seconds longer than entered
by the user and to confusion. See #554.
Therefore, use the same ascent rate taken from the preferences field
flag.ascratelast6m in both cases.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/planner.c')
-rw-r--r-- | core/planner.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/planner.c b/core/planner.c index b4b842fcf..93f0c233b 100644 --- a/core/planner.c +++ b/core/planner.c @@ -732,7 +732,10 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i /* if all we wanted was the dive just get us back to the surface */ if (!is_planner) { - transitiontime = depth / 75; /* this still needs to be made configurable */ + /* Attn: for manually entered dives, we depend on the last segment having the + * same ascent rate as in fake_dc(). If you change it here, also change it there. + */ + transitiontime = lrint(depth / (double)prefs.ascratelast6m); plan_add_segment(diveplan, transitiontime, 0, current_cylinder, po2, false); create_dive_from_plan(diveplan, dive, is_planner); return false; |