summaryrefslogtreecommitdiffstats
path: root/dive.h
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2014-06-25 14:00:03 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-25 21:07:10 +0800
commit65c5d6815cf7c78231abd76440bb5bab54d9d51c (patch)
tree8f6820921ec40aeeeb5b475d74b7cfb567a782c7 /dive.h
parentc7231adde1cddc64dfa47450393e97afa6c39d0f (diff)
downloadsubsurface-65c5d6815cf7c78231abd76440bb5bab54d9d51c.tar.gz
Make pO2 settings functional in planner
Spin boxes for pO2 are now hooked up to preference values. Adding new cylinders (or changing their fo2) computes the MOD accordin to the current value of decopo2. Note that chaning the limits for deco pO2 does _not_ automatically update the switch depth of all cylinders as those might have been manually entered. Furthermore, MOD has now to option of rounding to multiples of a given depth. That is used for the automatic switch depth which are now always multiples of 3m (so that EAN50 is switched to at 21m rather than 22m). Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'dive.h')
-rw-r--r--dive.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/dive.h b/dive.h
index a5c760640..f06791cc5 100644
--- a/dive.h
+++ b/dive.h
@@ -134,9 +134,10 @@ static inline int interpolate(int a, int b, int part, int whole)
return rint(x / whole);
}
-static inline depth_t gas_mod(struct gasmix *mix, pressure_t po2_limit) {
+/* MOD rounded to multiples of roundto mm */
+static inline depth_t gas_mod(struct gasmix *mix, pressure_t po2_limit, int roundto) {
depth_t depth;
- depth.mm = po2_limit.mbar * 1000 / get_o2(mix) * 10 - 10000;
+ depth.mm = ((po2_limit.mbar * 1000 / get_o2(mix) * 10 - 10000) / roundto) * roundto;
return depth;
}