From e60eef477ec88530e226357fbcd61590cce5feca Mon Sep 17 00:00:00 2001 From: Tim Segers Date: Thu, 22 Dec 2022 15:57:39 +0100 Subject: Make sure first stop is not equal to current depth Fixes: https://todo.sr.ht/~tsegers/opendeco/8 --- src/schedule.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/schedule.c b/src/schedule.c index f9d3dd4..56349fc 100644 --- a/src/schedule.c +++ b/src/schedule.c @@ -141,6 +141,10 @@ decoinfo_t calc_deco(decostate_t *ds, double start_depth, const gas_t *start_gas } double next_stop = abs_depth(ds->ceil_multiple * (ceil(gauge_depth(depth) / ds->ceil_multiple) - 1)); + + if (next_stop == depth) + next_stop -= ds->ceil_multiple; + double current_gf = get_gf(ds, next_stop); for (;;) { -- cgit v1.2.3-70-g09d2