aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2022-10-16 16:49:13 +0200
committerGravatar Tim Segers <tsegers@pm.me>2022-10-16 16:49:13 +0200
commitc9efb31b81fc5047dad568959c43e9ea06277473 (patch)
tree5e0f993cdaa3c519c73f653873430617f80a528b /src
parent69d22a2297bc11b712661db1978d1ced7abcdfd4 (diff)
downloadopendeco-c9efb31b81fc5047dad568959c43e9ea06277473.tar.gz
Merge calc_stoplen_rough into deco_stop
Diffstat (limited to 'src')
-rw-r--r--src/schedule.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/schedule.c b/src/schedule.c
index 8f15813..18ab946 100644
--- a/src/schedule.c
+++ b/src/schedule.c
@@ -92,11 +92,13 @@ double calc_ndl(decostate_t *ds, const double depth, const double ascrate, const
return ndl;
}
-double calc_stoplen_rough(const decostate_t *ds, const double depth, const double current_gf, const gas_t *gas)
+double deco_stop(decostate_t *ds, const double depth, const double current_gf, const gas_t *gas)
{
- decostate_t ds_ = *ds;
double stoplen = 0;
+ /* rough steps */
+ decostate_t ds_ = *ds;
+
for (;;) {
double tmp = add_segment_const(&ds_, depth, STOPLEN_ROUGH, gas);
@@ -106,20 +108,8 @@ double calc_stoplen_rough(const decostate_t *ds, const double depth, const doubl
stoplen += tmp;
}
- return stoplen;
-}
-
-double deco_stop(decostate_t *ds, const double depth, const double current_gf, const gas_t *gas)
-{
- double stoplen = 0;
-
- /* rough steps */
- double stoplen_rough = calc_stoplen_rough(ds, depth, current_gf, gas);
-
- if (stoplen_rough) {
- add_segment_const(ds, depth, stoplen_rough, gas);
- stoplen += stoplen_rough;
- }
+ if (stoplen)
+ add_segment_const(ds, depth, stoplen, gas);
/* fine steps */
while (ceiling(ds, current_gf) == depth)