summaryrefslogtreecommitdiffstats
path: root/planner.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 21:53:33 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 21:53:33 -0700
commit9df3751c04a9ce862aaeaa523df5ad666bd6d8bd (patch)
tree5a5b4510084a68560561d4533d0d5a2964aba1de /planner.c
parenta89533bf372839a7e6992dda5f60ecfc319217fe (diff)
downloadsubsurface-9df3751c04a9ce862aaeaa523df5ad666bd6d8bd.tar.gz
Planner: more accurately track assumed cylinder pressures
This makes things more consistent. The equipment view and the sample view of the beginning and end pressure for each cylinder correspond (and the beginning pressures of each cylinder segment are correctly reflected in the samples). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'planner.c')
-rw-r--r--planner.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/planner.c b/planner.c
index 32411b950..2c1c66810 100644
--- a/planner.c
+++ b/planner.c
@@ -260,10 +260,11 @@ static struct dive *create_dive_from_plan(struct diveplan *diveplan, struct dive
/* reset the end pressure values and start with the gas on the first cylinder */
reset_cylinders(master_dive);
- cyl = &master_dive->cylinder[0];
+ cyl = &dive->cylinder[0];
oldgasmix = cyl->gasmix;
sample = prepare_sample(dc);
sample->po2.mbar = dp->po2;
+ sample->cylinderpressure.mbar = cyl->end.mbar;
finish_sample(dc);
while (dp) {
struct gasmix gasmix = dp->gasmix;
@@ -299,12 +300,13 @@ static struct dive *create_dive_from_plan(struct diveplan *diveplan, struct dive
goto gas_error_exit;
/* need to insert a first sample for the new gas */
add_gas_switch_event(dive, dc, lasttime + 1, idx);
+ cyl = &dive->cylinder[idx];
sample = prepare_sample(dc);
sample[-1].po2.mbar = po2;
sample->time.seconds = lasttime + 1;
sample->depth.mm = lastdepth;
+ sample->cylinderpressure.mbar = cyl->sample_end.mbar;
finish_sample(dc);
- cyl = &dive->cylinder[idx];
oldgasmix = gasmix;
}
/* Create sample */