summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-16 23:04:30 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-07-16 23:04:30 -0700
commit912560f928e68fb1235b17ed4bb06eb8d19a8ae7 (patch)
treed3560504965b9899f9bc93ef9437067b75be1871 /planner.c
parent387553f0b3abdd836c4dfd8368459a67e56e06a2 (diff)
downloadsubsurface-912560f928e68fb1235b17ed4bb06eb8d19a8ae7.tar.gz
Planner: don't track cylinder pressure if working pressure is 0
The pressure graph will go from 0 to negative - one could make a weak argument that this would at least tell you how much pressure you'd need in the cylinder to start with, but that's kinda lame. Fixes #615 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/planner.c b/planner.c
index 0d6d77148..eed6202ea 100644
--- a/planner.c
+++ b/planner.c
@@ -275,7 +275,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
oldgasmix = cyl->gasmix;
sample = prepare_sample(dc);
sample->po2.mbar = dp->po2;
- if (track_gas)
+ if (track_gas && cyl->type.workingpressure.mbar)
sample->cylinderpressure.mbar = cyl->end.mbar;
finish_sample(dc);
while (dp) {
@@ -315,7 +315,7 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
sample[-1].po2.mbar = po2;
sample->time.seconds = lasttime + 1;
sample->depth.mm = lastdepth;
- if (track_gas)
+ if (track_gas && cyl->type.workingpressure.mbar)
sample->cylinderpressure.mbar = cyl->sample_end.mbar;
finish_sample(dc);
oldgasmix = gasmix;
@@ -331,7 +331,8 @@ static void create_dive_from_plan(struct diveplan *diveplan, bool track_gas)
if (track_gas) {
update_cylinder_pressure(&displayed_dive, sample[-1].depth.mm, depth, time - sample[-1].time.seconds,
dp->entered ? diveplan->bottomsac : diveplan->decosac, cyl, !dp->entered);
- sample->cylinderpressure.mbar = cyl->end.mbar;
+ if (cyl->type.workingpressure.mbar)
+ sample->cylinderpressure.mbar = cyl->end.mbar;
}
finish_sample(dc);
dp = dp->next;