diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-12-02 23:56:42 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-12-02 23:56:42 -0500 |
commit | 988ee5754ecef4115de40983020732a2e421ad9e (patch) | |
tree | 972f9c20378ea202a6f28d82167cad380721a34d | |
parent | a8ad1ae726227781507521d619e2fe8f89d7ffdd (diff) | |
download | kutter-988ee5754ecef4115de40983020732a2e421ad9e.tar.gz kutter-988ee5754ecef4115de40983020732a2e421ad9e.tar.xz kutter-988ee5754ecef4115de40983020732a2e421ad9e.zip |
itersolve: Fix potential backwards time in itersolve_gen_steps_range()
Make sure that a newly choosen "high" bound is always greater than the
"low" bound.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | klippy/chelper/itersolve.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/klippy/chelper/itersolve.c b/klippy/chelper/itersolve.c index 570ad2df..b7119fa5 100644 --- a/klippy/chelper/itersolve.c +++ b/klippy/chelper/itersolve.c @@ -78,8 +78,10 @@ itersolve_gen_steps_range(struct stepper_kinematics *sk, struct move *m break; // Need to increase next step search range low = high; - high.time = last.time + seek_time_delta; - seek_time_delta += seek_time_delta; + do { + high.time = last.time + seek_time_delta; + seek_time_delta += seek_time_delta; + } while (unlikely(high.time <= low.time)); if (high.time > end) high.time = end; high.position = calc_position_cb(sk, m, high.time); |