summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-28 19:54:05 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-28 21:39:25 -0800
commit55b3fd12a8b8c4df4e69ec9d747c77d99b40807a (patch)
treec27abb0b3d371962055d3902c47433add58c9870 /divelist.c
parent9df9fc088daedc71b56acc176cf3b8ee3de870fa (diff)
downloadsubsurface-55b3fd12a8b8c4df4e69ec9d747c77d99b40807a.tar.gz
Make dive planner more useful for closed circuit diving
Add a sample at time 0 to allow for a pO2 from the start of the dive. Remember the last pO2 so it doesn't have to be repeated (and the right thing happens for the planned part of the dive). This still doesn't allow us to change the setpoint at a certain depth (which would be analogous to being able to switch to a certain gas at a certain depth in OC plans), but with this commit it's already usable. This commit also fixes a couple of small bugs in commit b8ee3de870fa ("Dive planning for closed circuit rebreather") where a pO2 of 1.1 was hardcoded in one place, throwing off all plan calculations and integer math was used to calculate a floating point value (leading to most pO2 values actually used being 1.0). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/divelist.c b/divelist.c
index d6c68eaaf..82ef339d8 100644
--- a/divelist.c
+++ b/divelist.c
@@ -763,7 +763,7 @@ static int calculate_otu(struct dive *dive, struct divecomputer *dc)
struct sample *psample = sample - 1;
t = sample->time.seconds - psample->time.seconds;
if (sample->po2) {
- po2 = sample->po2 / 1000;
+ po2 = sample->po2 / 1000.0;
} else {
int o2 = active_o2(dive, dc, sample->time);
po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive) / 1000.0;