aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2023-07-09 18:59:20 +0200
committerGravatar Tim Segers <tsegers@pm.me>2023-07-09 18:59:20 +0200
commit8dae03b00b8a24b690214a79af057b8d0de83cd0 (patch)
tree3b3203986183699ffe4b95bf54be20ed89fd9dc5
parenta4a5e8c7137c5156343ac93a6c1e82739c00995e (diff)
downloadopendeco-8dae03b00b8a24b690214a79af057b8d0de83cd0.tar.gz
Tweak first stop calculation procedure
-rw-r--r--src/schedule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/schedule.c b/src/schedule.c
index b2c50c1..7fbfaf5 100644
--- a/src/schedule.c
+++ b/src/schedule.c
@@ -139,9 +139,9 @@ decoinfo_t calc_deco(decostate_t *ds, const gas_t *deco_gasses, int nof_gasses,
return (decoinfo_t){.tts = 0, .ndl = calc_ndl(ds, asc_per_min)};
/* prepare for the first stop */
- next_stop = abs_depth(ds->ceil_multiple * (ceil(gauge_depth(ds->depth) / ds->ceil_multiple) - 1));
+ next_stop = abs_depth(ds->ceil_multiple * (ceil(gauge_depth(ds->depth) / ds->ceil_multiple)));
- if (next_stop == ds->depth)
+ while (next_stop >= ds->depth)
next_stop -= ds->ceil_multiple;
current_gf = get_gf(ds, next_stop);