aboutsummaryrefslogtreecommitdiffstats
path: root/klippy
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2019-12-02 23:56:42 -0500
committerKevin O'Connor <kevin@koconnor.net>2019-12-02 23:56:42 -0500
commit988ee5754ecef4115de40983020732a2e421ad9e (patch)
tree972f9c20378ea202a6f28d82167cad380721a34d /klippy
parenta8ad1ae726227781507521d619e2fe8f89d7ffdd (diff)
downloadkutter-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>
Diffstat (limited to 'klippy')
-rw-r--r--klippy/chelper/itersolve.c6
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);