diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-11-10 23:11:40 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-11 08:50:56 +0100 |
commit | e167108c76c4a74ab50561fd59b2158704767a75 (patch) | |
tree | 5a860e98e9420315b03ff1c2ff88d76e5cb0dc67 /divelist.c | |
parent | f53788e5e4066f0ef36041031de6bc2726274fc9 (diff) | |
download | subsurface-e167108c76c4a74ab50561fd59b2158704767a75.tar.gz |
Add depth to mbar helper function
This ensures that we use consistent math to get the absolute pressure at a
certain depth.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r-- | divelist.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/divelist.c b/divelist.c index 8819f4ab1..913824838 100644 --- a/divelist.c +++ b/divelist.c @@ -710,7 +710,7 @@ static int calculate_otu(struct dive *dive) int o2 = dive->cylinder[sample->cylinderindex].gasmix.o2.permille; if (!o2) o2 = AIR_PERMILLE; - po2 = o2 / 1000.0 * (sample->depth.mm + 10000) / 10000.0; + po2 = o2 / 1000.0 * depth_to_mbar(sample->depth.mm, dive) / 1000.0; if (po2 >= 0.5) otu += pow(po2 - 0.5, 0.83) * t / 30.0; } @@ -770,8 +770,8 @@ static int calculate_sac(struct dive *dive) } } } - /* Mean pressure in atm: 1 atm per 10m */ - pressure = 1 + (dive->meandepth.mm / 10000.0); + /* Mean pressure in bar (SAC calculations are in bar*l/min) */ + pressure = depth_to_mbar(dive->meandepth.mm, dive) / 1000.0; sac = airuse / pressure * 60 / duration; /* milliliters per minute.. */ |