Planner: Don't store a setpoint unless we are in CCR mode

Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
Robert C. Helling 2018-05-17 22:01:12 +02:00
parent fb09784060
commit 2c53eef50e

View file

@ -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);