From 912e1faaf21afbfac0cec07db036d97b13ed847c Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sat, 11 Jul 2020 13:15:21 +0200 Subject: Make MND display depend on O2 narcotic preference A while ago, we introduced a preference whether O2 should be considered narcotic. We used this when computing best mix or when entering the He content via MND. But we forgot to make the displayed MND depend on this preference. This patch add this. Fixes #2895 Signed-off-by: Robert C. Helling --- core/dive.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/dive.c b/core/dive.c index 427b6a624..b2f29db8b 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3767,7 +3767,10 @@ depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *dive, int rou pressure_t ppo2n2; ppo2n2.mbar = depth_to_mbar(end.mm, dive); - int maxambient = (int)lrint(ppo2n2.mbar / (1 - get_he(mix) / 1000.0)); + int maxambient = prefs.o2narcotic ? + (int)lrint(ppo2n2.mbar / (1 - get_he(mix) / 1000.0)) + : + (int)lrint(ppo2n2.mbar * N2_IN_AIR / (1000 - get_he(mix) - get_o2(mix))); rounded_depth.mm = (int)lrint(((double)mbar_to_depth(maxambient, dive)) / roundto) * roundto; return rounded_depth; } -- cgit v1.2.3-70-g09d2