From 1b2d3c29d3cfe36f2109ab306858004e20e82b3e Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Thu, 12 Jun 2014 22:26:58 +0200 Subject: [PATCH] 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 Signed-off-by: Anton Lundin Acked-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- divelist.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++)