diff options
author | Robert C. Helling <helling@atdotde.de> | 2020-09-29 23:59:56 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-09-29 15:46:55 -0700 |
commit | efdc875aa3174ba53a819490e498a59ba0399dc6 (patch) | |
tree | 8ae826cccd72201712ed0662472c7582297ee43f /core | |
parent | a7ca27d0712d1e73893c541aabcaaf68aac7afc7 (diff) | |
download | subsurface-efdc875aa3174ba53a819490e498a59ba0399dc6.tar.gz |
Use correct pO2 when computing MOD in equipment tab
The cylinder model is used both in the planner and the
equipment tab. We have three preferences for the pO2 that
is used to compute MOD: In the planner, there is one for
the bottom part of the dive and another one for deco.
Those are set in the planenr UI. There is another value,
controlled in the Tec Prefernces. That one should be
used in the equipment tab rather than the one from
the planner.
Fixes #2984
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'core')
-rw-r--r-- | core/dive.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/dive.c b/core/dive.c index 35d5c5972..f79af7ed2 100644 --- a/core/dive.c +++ b/core/dive.c @@ -3628,8 +3628,9 @@ int get_depth_at_time(const struct divecomputer *dc, unsigned int time) fraction_t best_o2(depth_t depth, const struct dive *dive) { fraction_t fo2; + int po2 = in_planner() ? prefs.bottompo2 : prefs.modpO2 * 1000; - fo2.permille = (prefs.bottompo2 * 100 / depth_to_mbar(depth.mm, dive)) * 10; //use integer arithmetic to round down to nearest percent + fo2.permille = (po2 * 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; |