summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-11-25 14:27:09 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-25 07:30:23 -0800
commit81fce5ad19a5886c9495fe5012bd5c48359b173f (patch)
tree2ee19878058350a21284859ca675e4d8513b30bb /planner.c
parent702c751ecfb64260c1fe6dbe1f524a99af70c608 (diff)
downloadsubsurface-81fce5ad19a5886c9495fe5012bd5c48359b173f.tar.gz
Assign setpoint to correct sample in planner
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index 2de66e1b3..bad995e6e 100644
--- a/planner.c
+++ b/planner.c
@@ -332,11 +332,11 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
sample = prepare_sample(dc);
/* set po2 at beginning of this segment */
/* and keep it valid for last sample - where it likely doesn't matter */
- sample->setpoint.mbar = po2;
+ sample[-1].setpoint.mbar = po2;
sample->time.seconds = lasttime = time;
sample->depth.mm = lastdepth = depth;
sample->manually_entered = dp->entered;
- if (track_gas && !sample->setpoint.mbar) { /* Don't track gas usage for CCR legs of dive */
+ if (track_gas && !sample[-1].setpoint.mbar) { /* Don't track gas usage for CCR legs of dive */
update_cylinder_pressure(&displayed_dive, sample[-1].depth.mm, depth, time - sample[-1].time.seconds,
dp->entered ? diveplan->bottomsac : diveplan->decosac, cyl, !dp->entered);
if (cyl->type.workingpressure.mbar)