[PATCH 3/3] Validate O2 in best mix
Rick Walsh
rickmwalsh at gmail.com
Tue May 31 02:31:48 PDT 2016
We can't have >100% O2
Signed-off-by: Rick Walsh <rickmwalsh at gmail.com>
---
core/dive.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/core/dive.c b/core/dive.c
index 20ab2e5..69823f4 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -3646,6 +3646,9 @@ fraction_t best_o2(depth_t depth, struct dive *dive)
fraction_t fo2;
fo2.permille = (prefs.bottompo2 * 100 / depth_to_mbar(depth.mm, dive)) * 10; //use integer arithmetic to round down to nearest percent
+ // Don't permit >100% O2
+ if (fo2.permille > 1000)
+ fo2.permille = 1000;
return fo2;
}
--
2.5.5
More information about the subsurface
mailing list