diff --git a/planner.c b/planner.c
index c734cc09a..2de66e1b3 100644
--- a/planner.c
+++ b/planner.c
@@ -514,9 +514,9 @@ static unsigned int *sort_stops(int *dstops, int dnr, struct gaschanges *gstops,
static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool show_disclaimer, int error)
{
char buffer[20000], temp[1000];
- int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1;
+ int len, lastdepth = 0, lasttime = 0, lastsetpoint = -1, newdepth = 0;
struct divedatapoint *dp = diveplan->dp;
- bool gaschange = !plan_verbatim;
+ bool gaschange = !plan_verbatim, postponed = plan_verbatim;
struct divedatapoint *nextdp = NULL;
disclaimer = translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE BUHLMANN "
@@ -577,13 +577,14 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
nextdp &&
dp->setpoint == nextdp->setpoint &&
dp->depth != lastdepth &&
- nextdp->depth != dp->depth)
+ nextdp->depth != dp->depth
+ && !gaschange)
continue;
if (dp->time - lasttime < 10 && !(gaschange && dp->next && dp->depth != dp->next->depth))
continue;
len = strlen(buffer);
- if (nextdp && (gasmix_distance(&gasmix, &newgasmix) || dp->setpoint != lastsetpoint))
+ if (nextdp && (gasmix_distance(&gasmix, &newgasmix) || dp->setpoint != nextdp->setpoint))
gaschange = true;
if (plan_verbatim) {
if (dp->depth != lastdepth) {
@@ -604,6 +605,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
gasname(&gasmix));
len += snprintf(buffer + len, sizeof(buffer) - len, "%s
", temp);
+ newdepth = dp->depth;
lasttime = dp->time;
}
} else {
@@ -623,6 +625,7 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
gasname(&gasmix));
len += snprintf(buffer + len, sizeof(buffer) - len, "%s
", temp);
+ newdepth = dp->depth;
lasttime = dp->time;
}
}
@@ -638,38 +641,50 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
snprintf(temp, sizeof(temp), translate("gettextFromC", "%3dmin"), (dp->time - lasttime + 30) / 60);
len += snprintf(buffer + len, sizeof(buffer) - len, "