aboutsummaryrefslogtreecommitdiffstats
path: root/core/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2019-09-08 16:55:00 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-11 14:55:33 +0100
commit00c902d66ca114836846132ba775e51e8003ab56 (patch)
treef5cfae6d083b052e9914925271252186ec1fbb5d /core/planner.c
parentdd423bffb9f248735311ab639639c7b1996d759c (diff)
downloadsubsurface-00c902d66ca114836846132ba775e51e8003ab56.tar.gz
Show correct notes entry when switching on stops
When gas switching only on stops is selected, the notes showed an extra line at the not realized stop depth. This eliminates it. It also makes sure there are no 0 second spurious entries. And gas switching takes more than zero time (otherwise we would have to print a line of zero duration for at the gas switch depth). Reported-by: tormento <turment@gmail.com> Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core/planner.c')
-rw-r--r--core/planner.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/planner.c b/core/planner.c
index b7bc56eab..fd4ed2c36 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -932,10 +932,6 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
if (gi >= 0 && stoplevels[stopidx] <= gaschanges[gi].depth) {
/* We have reached a gas change.
* Record this in the dive plan */
- if (is_final_plan)
- plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false, divemode);
- previous_point_time = clock;
- stopping = true;
/* Check we need to change cylinder.
* We might not if the cylinder was chosen by the user
@@ -946,6 +942,10 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
if (!prefs.switch_at_req_stop ||
!trial_ascent(ds, 0, depth, stoplevels[stopidx - 1], avg_depth, bottom_time,
dive->cylinder[current_cylinder].gasmix, po2, diveplan->surface_pressure / 1000.0, dive, divemode) || get_o2(dive->cylinder[current_cylinder].gasmix) < 160) {
+ if (is_final_plan)
+ plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false, divemode);
+ stopping = true;
+ previous_point_time = clock;
current_cylinder = gaschanges[gi].gasidx;
gas = dive->cylinder[current_cylinder].gasmix;
#if DEBUG_PLAN & 16