summaryrefslogtreecommitdiffstats
path: root/core/device.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-05-05 16:34:50 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-07 21:17:22 +0300
commitac1ec486ae0cd0295166bb1dc0d5b82dc237a5b1 (patch)
tree89348c0d05372257bd765e9c9110f716066be2de /core/device.c
parent70bb4c145bd60c80153b9700edd5a914a45fea84 (diff)
downloadsubsurface-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/device.c')
-rw-r--r--core/device.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/device.c b/core/device.c
index 57f7576e1..a22815633 100644
--- a/core/device.c
+++ b/core/device.c
@@ -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;
/*