summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-06-25 00:08:36 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-25 13:48:44 +0800
commit772727fc7f44faaf94afc24bd1f151e40ddaefef (patch)
treecf74530d4a42e244f174c23e4e723b0a013189f0 /planner.c
parent2ae6f8078a7ea2a034295fcd00f210854a572ee7 (diff)
downloadsubsurface-772727fc7f44faaf94afc24bd1f151e40ddaefef.tar.gz
Hook up UI elements for ascent rates to planner
That provides some UI elements that were recently introduced with function of allowing the ascent rates of the planner to be configured by the user. I tried to make it work both with senisble as well as with imperial units. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/planner.c b/planner.c
index 3168f0ff9..13a9a489a 100644
--- a/planner.c
+++ b/planner.c
@@ -687,13 +687,18 @@ int ascend_velocity(int depth, int avg_depth, int bottom_time)
/* As an example (and possibly reasonable default) this is the Tech 1 provedure according
* to http://www.globalunderwaterexplorers.org/files/Standards_and_Procedures/SOP_Manual_Ver2.0.2.pdf */
- if (depth <= 6000)
- return 1000 / 60;
-
- if (depth * 4 > avg_depth * 3)
- return 9000 / 60;
- else
- return 6000 / 60;
+ if (depth * 4 > avg_depth * 3) {
+ return prefs.ascrate75;
+ } else {
+ if (depth * 2 > avg_depth) {
+ return prefs.ascrate50;
+ } else {
+ if (depth > 6000)
+ return prefs.ascratestops;
+ else
+ return prefs.ascratelast6m;
+ }
+ }
}
void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, struct dive *master_dive, bool add_deco, bool show_disclaimer)