From 879de8903e617d9e172a36045dc1b7b7ca4250c1 Mon Sep 17 00:00:00 2001 From: Tim Segers Date: Wed, 12 Oct 2022 16:04:51 +0200 Subject: Add option to perform last deco stop at 6m instead of 3m --- src/deco.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/deco.c') diff --git a/src/deco.c b/src/deco.c index a03ed34..204a2a7 100644 --- a/src/deco.c +++ b/src/deco.c @@ -15,6 +15,8 @@ double P_WV = P_WV_DEFAULT; double PO2_MAX = PO2_MAX_DEFAULT; double END_MAX = END_MAX_DEFAULT; +int LAST_STOP_AT_SIX = LAST_STOP_AT_SIX_DEFAULT; + typedef struct zhl_n2_t { double t; double a[3]; @@ -213,7 +215,12 @@ double round_ceiling(const decostate_t *ds, const double c) { assert(ds->ceil_multiple != 0); - return abs_depth(ds->ceil_multiple * ceil(RND(gauge_depth(c) / ds->ceil_multiple))); + int numbered_stop = ceil(RND(gauge_depth(c) / ds->ceil_multiple)); + + if (numbered_stop == 1 && LAST_STOP_AT_SIX) + numbered_stop = 2; + + return abs_depth(ds->ceil_multiple * numbered_stop); } double ceiling(const decostate_t *ds, double gf) -- cgit v1.2.3-70-g09d2