summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2015-01-16 13:49:12 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-17 08:18:08 +1300
commit881803441e3c0a24004a25e84197280c4722b679 (patch)
treea285649894f5a4dc390aea1caed92b9f7fa9d573 /planner.c
parentf2939dd991f5f9cd40501d419e7a816492857311 (diff)
downloadsubsurface-881803441e3c0a24004a25e84197280c4722b679.tar.gz
Save predefined SAC
When planning a dive, the gas consumption is based on a user configured SAC. Thus we should use that SAC and not try to recompute it from samples. 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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/planner.c b/planner.c
index e6bd088c9..d7f80b407 100644
--- a/planner.c
+++ b/planner.c
@@ -278,6 +278,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
oldgasmix = cyl->gasmix;
sample = prepare_sample(dc);
sample->setpoint.mbar = dp->setpoint;
+ sample->sac.mliter = prefs.bottomsac;
oldpo2 = dp->setpoint;
if (track_gas && cyl->type.workingpressure.mbar)
sample->cylinderpressure.mbar = cyl->end.mbar;
@@ -323,6 +324,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
sample->time.seconds = lasttime + 1;
sample->depth.mm = lastdepth;
sample->manually_entered = dp->entered;
+ sample->sac.mliter = dp->entered ? prefs.bottomsac : prefs.decosac;
if (track_gas && cyl->type.workingpressure.mbar)
sample->cylinderpressure.mbar = cyl->sample_end.mbar;
finish_sample(dc);
@@ -337,6 +339,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
sample->time.seconds = lasttime = time;
sample->depth.mm = lastdepth = depth;
sample->manually_entered = dp->entered;
+ sample->sac.mliter = dp->entered ? prefs.bottomsac : prefs.decosac;
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);