diff options
author | Rick Walsh <rickmwalsh@gmail.com> | 2016-07-06 22:40:34 +1000 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-07-09 12:08:20 -0700 |
commit | ae9e147314231e3396252d892a7702886acfb5ae (patch) | |
tree | 279682bc32336dab32bf2facd60165a7cd1641f3 /core/dive.c | |
parent | 274ff270d88cf5de60accb23dcfbbed6ca9794e6 (diff) | |
download | subsurface-ae9e147314231e3396252d892a7702886acfb5ae.tar.gz |
Validate O2 in best mix
We can't have >100% O2
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/dive.c')
-rw-r--r-- | core/dive.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/dive.c b/core/dive.c index 9db233dca..8c74bc24b 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3653,6 +3653,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; } |