Correct pO2 formula in CNS calculation.

In commit e58f54cac1 ("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>
This commit is contained in:
Robert C. Helling 2014-06-12 22:26:58 +02:00 committed by Dirk Hohndel
parent a4050c2a71
commit 1b2d3c29d3

View file

@ -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++)