From 2c53eef50eaab5d9228ef095e10d7832cb3b7514 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 17 May 2018 22:01:12 +0200 Subject: [PATCH] Planner: Don't store a setpoint unless we are in CCR mode Signed-off-by: Robert C. Helling --- core/planner.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/planner.c b/core/planner.c index 842a86ebf..2b58a2440 100644 --- a/core/planner.c +++ b/core/planner.c @@ -323,7 +323,8 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive, /* this is a bad idea - we should get a different SAMPLE_EVENT type * reserved for this in libdivecomputer... overloading SMAPLE_EVENT_PO2 * with a different meaning will only cause confusion elsewhere in the code */ - add_event(dc, lasttime, SAMPLE_EVENT_PO2, 0, po2, QT_TRANSLATE_NOOP("gettextFromC", "SP change")); + if (dp->divemode == type) + add_event(dc, lasttime, SAMPLE_EVENT_PO2, 0, po2, QT_TRANSLATE_NOOP("gettextFromC", "SP change")); oldpo2 = po2; } @@ -420,7 +421,7 @@ void add_to_end_of_diveplan(struct diveplan *diveplan, struct divedatapoint *dp) struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum divemode_t divemode) { - struct divedatapoint *dp = create_dp(duration, depth, cylinderid, po2); + struct divedatapoint *dp = create_dp(duration, depth, cylinderid, divemode == CCR ? po2 : 0); dp->entered = entered; dp->divemode = divemode; add_to_end_of_diveplan(diveplan, dp);