summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-06-12 22:26:58 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-12 14:12:30 -0700
commit1b2d3c29d3cfe36f2109ab306858004e20e82b3e (patch)
tree7ed96c736d806c04c82d0a539e73e8791cdcf17d /divelist.c
parenta4050c2a714861797f3e46d55f3eda1541053387 (diff)
downloadsubsurface-1b2d3c29d3cfe36f2109ab306858004e20e82b3e.tar.gz
Correct pO2 formula in CNS calculation.
In commit e58f54cac1d0 ("Fix ATM-vs-bar confusion") Linus broke the CNS calculations; The partial pressure is fraction of gas times ambient pressure, not divided by. [Dirk Hohndel: identical patch sent by Robert and Anton; I combined the commit messages and added the ACK from the perpetrator] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Anton Lundin <glance@acc.umu.se> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> 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 decc07aa4..a07583857 100644
--- a/divelist.c
+++ b/divelist.c
@@ -246,7 +246,7 @@ static int calculate_cns(struct dive *dive)
po2 = sample->po2.mbar;
} else {
int o2 = active_o2(dive, dc, sample->time);
- po2 = o2 / depth_to_atm(sample->depth.mm, dive);
+ po2 = o2 * depth_to_atm(sample->depth.mm, dive);
}
/* Find what table-row we should calculate % for */
for (j = 1; j < sizeof(cns_table) / (sizeof(int) * 3); j++)