From 3f74389b883a8c06f2021a26070fdc76c6666880 Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Tue, 17 Jun 2014 20:01:16 +0200 Subject: [PATCH] CNS doesn't increase when PO2 is below 0.5 atm When chasing other bug in CNS code i found this. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- divelist.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/divelist.c b/divelist.c index a07583857..ff493393d 100644 --- a/divelist.c +++ b/divelist.c @@ -248,6 +248,9 @@ static int calculate_cns(struct dive *dive) int o2 = active_o2(dive, dc, sample->time); po2 = o2 * depth_to_atm(sample->depth.mm, dive); } + /* CNS don't increse when below 500 matm */ + if (po2 < 500) + continue; /* Find what table-row we should calculate % for */ for (j = 1; j < sizeof(cns_table) / (sizeof(int) * 3); j++) if (po2 > cns_table[j][0])