diff options
author | Henrik Brautaset Aronsen <subsurface@henrik.synth.no> | 2011-12-31 17:00:36 +0100 |
---|---|---|
committer | Henrik Brautaset Aronsen <subsurface@henrik.synth.no> | 2011-12-31 17:00:36 +0100 |
commit | 2175226580a523a9a3abba3723991b003eee5a2a (patch) | |
tree | 268af57d2a836482fa63f348959587aec2723ecc /divelist.c | |
parent | e5b6bfc7ed03bb6649abcfbac79f06aafd235918 (diff) | |
download | subsurface-2175226580a523a9a3abba3723991b003eee5a2a.tar.gz |
Display OTU for dives using air
Zero o2 means 20.9% o2, which can be confusing...
Signed-off-by: Henrik Brautaset Aronsen <subsurface@henrik.synth.no>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/divelist.c b/divelist.c index 86e7daf57..32dc92b99 100644 --- a/divelist.c +++ b/divelist.c @@ -392,8 +392,10 @@ static int calculate_otu(struct dive *dive) struct sample *sample = dive->sample + i; struct sample *psample = sample - 1; t = sample->time.seconds - psample->time.seconds; - po2 = dive->cylinder[sample->cylinderindex].gasmix.o2.permille / 1000.0 * - (sample->depth.mm + 10000) / 10000.0; + int o2 = dive->cylinder[sample->cylinderindex].gasmix.o2.permille; + if (!o2) + o2 = 209; + po2 = o2 / 1000.0 * (sample->depth.mm + 10000) / 10000.0; if (po2 >= 0.5) otu += pow(po2 - 0.5, 0.83) * t / 30.0; } |