From 4f056228465717d04ec6712f129bddad56f21323 Mon Sep 17 00:00:00 2001 From: Rick Walsh Date: Sun, 26 Jul 2015 17:45:47 +1000 Subject: Planner: Hide unwanted transition between deco stops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If display transitions in deco isn't selected, then we shouldn't show the transition segment between two deco stops, even if there is a gas change. We should still show the ascent segment up to the first deco stop. The (gaschange_after && !isascent) condition is necessary to pick up backgas breaks. An example plan is shown below. Previously: depth duration runtime gas 40m 1min 1min air 40m 34min 35min   21m 2min 37min   <--meaningful ascent segment 21m 1min 38min EAN50 18m 1min 39min   15m 3min 42min   12m 4min 46min   9m 5min 51min   6m 0min 51min   <--unnecessary ascent segment 6m 13min 64min oxygen 6m 6min 70min air 6m 2min 72min oxygen 0m 1min 73min   depth duration runtime gas 40m 1min 1min air 40m 34min 35min   21m 2min 37min   <--meaningful ascent segment 21m 1min 38min EAN50 18m 1min 39min   15m 3min 42min   12m 4min 46min   9m 5min 51min   6m 13min 64min oxygen 6m 6min 70min air 6m 2min 72min oxygen 0m 1min 73min   Signed-off-by: Rick Walsh Signed-off-by: Dirk Hohndel --- planner.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/planner.c b/planner.c index bff329bd3..f94676fe0 100644 --- a/planner.c +++ b/planner.c @@ -505,6 +505,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool struct divedatapoint *dp = diveplan->dp; bool gaschange_after = !plan_verbatim; bool gaschange_before; + bool lastentered; struct divedatapoint *nextdp = NULL; plan_verbatim = prefs.verbatim_plan; @@ -639,7 +640,8 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool } else { if (plan_display_transitions || dp->entered || !dp->next || (nextdp && dp->depth != nextdp->depth) || - (!isascent && gaschange_before && nextdp && dp->depth != nextdp->depth) || gaschange_after || + (!isascent && gaschange_before && nextdp && dp->depth != nextdp->depth) || + gaschange_after && lastentered || gaschange_after && !isascent || (isascent && gaschange_after && nextdp && dp->depth != nextdp->depth )) { snprintf(temp, sizeof(temp), translate("gettextFromC", "%3.0f%s"), depthvalue, depth_unit); len += snprintf(buffer + len, sizeof(buffer) - len, "%s", temp); @@ -700,6 +702,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool lastprintdepth = newdepth; lastdepth = dp->depth; lastsetpoint = dp->setpoint; + lastentered = dp->entered; } while ((dp = nextdp) != NULL); len += snprintf(buffer + len, sizeof(buffer) - len, ""); -- cgit v1.2.3-70-g09d2