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>
This commit is contained in:
Robert C. Helling 2014-06-25 00:08:36 +02:00 committed by Dirk Hohndel
parent 2ae6f8078a
commit 772727fc7f
6 changed files with 146 additions and 73 deletions

View file

@ -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)