aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/deco.c
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2022-10-19 16:48:08 +0200
committerGravatar Tim Segers <tsegers@pm.me>2022-10-19 16:48:08 +0200
commit16d1b52543f73d972d33feaa94316dbb67ab907d (patch)
tree03c1934a0f3d13e9d45e5ab86223919214500fb3 /src/deco.c
parentbc19593e867562f43f4c7ee0a367af3762eb22bd (diff)
downloadopendeco-16d1b52543f73d972d33feaa94316dbb67ab907d.tar.gz
Ascend along fixed stops instead of along rounded ceiling
Diffstat (limited to 'src/deco.c')
-rw-r--r--src/deco.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/deco.c b/src/deco.c
index 3f27a33..51cdf0e 100644
--- a/src/deco.c
+++ b/src/deco.c
@@ -197,31 +197,17 @@ double get_gf(const decostate_t *ds, const double depth)
const unsigned char lo = ds->gflo;
const unsigned char hi = ds->gfhi;
- const double last_stop_gauge = LAST_STOP_AT_SIX ? msw_to_bar(6) : ds->ceil_multiple;
-
if (ds->firststop == -1)
return lo;
- if (depth <= SURFACE_PRESSURE + last_stop_gauge)
+ if (depth <= SURFACE_PRESSURE)
return hi;
if (depth >= ds->firststop)
return lo;
/* interpolate lo and hi between first stop and last stop */
- return hi - (hi - lo) * gauge_depth(depth - ds->ceil_multiple) / gauge_depth(ds->firststop - ds->ceil_multiple);
-}
-
-double round_ceiling(const decostate_t *ds, const double c)
-{
- assert(ds->ceil_multiple != 0);
-
- double ceil_gauge = ds->ceil_multiple * ceil(RND(gauge_depth(c) / ds->ceil_multiple));
-
- if (LAST_STOP_AT_SIX && ceil_gauge < msw_to_bar(6) && ceil_gauge > 0)
- return abs_depth(msw_to_bar(6));
- else
- return abs_depth(ceil_gauge);
+ return hi - (hi - lo) * gauge_depth(depth) / gauge_depth(ds->firststop);
}
double ceiling(const decostate_t *ds, double gf)
@@ -249,7 +235,7 @@ double ceiling(const decostate_t *ds, double gf)
c = max(c, ((pn2 + phe) - (a * gf)) / (gf / b + 1 - gf));
}
- return round_ceiling(ds, c);
+ return c;
}
double gf99(const decostate_t *ds, double depth)