From 9397a70a36b7189e2d810b39966ca3d4e55d2c61 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sun, 8 Mar 2015 20:28:45 +0100 Subject: [PATCH] Add explicit setpoint change at t=0 when planning CCR dives As we now have the logic that there is always an explicit setpoint at t=0sec for CCR dives, also the planner should honor that. This fixes a bug that when planning a CCR dive we later add a setpoint change this influenced the ceiling _before_ the setpoint change. Signed-off-by: Robert C. Helling --- planner.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/planner.c b/planner.c index d12f660..b6f0c4c 100644 --- a/planner.c +++ b/planner.c @@ -307,11 +307,10 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas) /* Check for SetPoint change */ if (oldpo2 != po2) { - if (lasttime) - /* 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, "SP change"); + /* 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, "SP change"); oldpo2 = po2; } -- 1.9.3 (Apple Git-50)