aboutsummaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-20 07:48:13 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-09-20 07:50:19 -0500
commit23ce6b8becfefd4848c05d51dc0a66ed01e39cd1 (patch)
treeeb9a7993b0764fb460a23e9eb12328f3d2b994b8 /planner.c
parent5f4aec867e852129a5eb3b507e06d0c80a021b74 (diff)
downloadsubsurface-23ce6b8becfefd4848c05d51dc0a66ed01e39cd1.tar.gz
When adding a dive, make the final ascent slower
Simply trying to role-model safe behavior I guess. Fundamentally all this should be configurable (so I added comments about that on the planner side as well). One of the interseting side effects of this implementation is that if the user removes the safety stop and comes up directly from a deeper depth, the slope of the ascent will change at 5m :-) Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index 6ed7030c7..4d790dc9e 100644
--- a/planner.c
+++ b/planner.c
@@ -624,9 +624,15 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
po2 = dive->dc.sample[dive->dc.samples - 1].po2;
depth = dive->dc.sample[dive->dc.samples - 1].depth.mm;
- /* if all we wanted was the dive just get us back to the surface */
+ /* if all we wanted was the dive just get us back to the surface
+ * we ascend with 15ft / min to the safety stop and 7.5ft / min from there */
if (!add_deco) {
- transitiontime = depth / 150; /* this still needs to be made configurable */
+ if (depth > 5000) {
+ transitiontime = depth / 75; /* this still needs to be made configurable */
+ plan_add_segment(diveplan, transitiontime, 5000, o2, he, po2);
+ depth = 5000;
+ }
+ transitiontime = 2 * depth / 75; /* this still needs to be made configurable */
plan_add_segment(diveplan, transitiontime, 0, o2, he, po2);
/* re-create the dive */
delete_single_dive(dive_table.nr - 1);
@@ -661,6 +667,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
gi = gaschangenr - 1;
stopidx += gaschangenr;
if (depth > stoplevels[stopidx]) {
+ /* right now all the transitions are at 30ft/min - this needs to be configurable */
transitiontime = (depth - stoplevels[stopidx]) / 150;
#if DEBUG_PLAN & 2
printf("transitiontime %d:%02d to depth %5.2lfm\n", FRACTION(transitiontime, 60), stoplevels[stopidx] / 1000.0);
@@ -701,6 +708,7 @@ void plan(struct diveplan *diveplan, char **cached_datap, struct dive **divep, b
#endif
if (wait_time)
plan_add_segment(diveplan, wait_time, stoplevels[stopidx], o2, he, po2);
+ /* right now all the transitions are at 30ft/min - this needs to be configurable */
transitiontime = (stoplevels[stopidx] - stoplevels[stopidx - 1]) / 150;
#if DEBUG_PLAN & 2
printf("transitiontime %d:%02d to depth %5.2lfm\n", FRACTION(transitiontime, 60), stoplevels[stopidx - 1] / 1000.0);