mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
70bb4c145b
commit
ac1ec486ae
2 changed files with 6 additions and 3 deletions
|
@ -146,7 +146,7 @@ void fake_dc(struct divecomputer *dc)
|
|||
if (avg_d == 0) {
|
||||
/* we try for a sane slope, but bow to the insanity of
|
||||
* the user supplied data */
|
||||
fill_samples_no_avg(fake, max_d, max_t, MAX(2.0 * max_d / max_t, 5000.0 / 60));
|
||||
fill_samples_no_avg(fake, max_d, max_t, MAX(2.0 * max_d / max_t, (double)prefs.ascratelast6m));
|
||||
if (fake[3].time.seconds == 0) { // just a 4 point profile
|
||||
dc->samples = 4;
|
||||
fake[3].time.seconds = max_t;
|
||||
|
@ -165,7 +165,7 @@ void fake_dc(struct divecomputer *dc)
|
|||
* Ok, first we try a basic profile with a specific ascent
|
||||
* rate (5 meters per minute) and d_frac (1/3).
|
||||
*/
|
||||
if (fill_samples(fake, max_d, avg_d, max_t, 5000.0 / 60, 0.33))
|
||||
if (fill_samples(fake, max_d, avg_d, max_t, (double)prefs.ascratelast6m, 0.33))
|
||||
return;
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue