diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2019-11-04 11:30:19 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2019-11-06 15:51:51 -0500 |
commit | 9945cc0f46b74e8f224c4fd421b36f59e4191905 (patch) | |
tree | 3c0f55140c3fef2a4d68b7174906b078f15acb12 /klippy/chelper | |
parent | 5eb5841eafccae5ca4b849647d39d7c5e3db9e64 (diff) | |
download | kutter-9945cc0f46b74e8f224c4fd421b36f59e4191905.tar.gz kutter-9945cc0f46b74e8f224c4fd421b36f59e4191905.tar.xz kutter-9945cc0f46b74e8f224c4fd421b36f59e4191905.zip |
itersolve: Fix possible infinite loop in itersolve_gen_steps()
If the kinematic position calculation function had an error in it (if
it produces sudden position changes) then it could lead to an infinite
loop in itersolve_gen_steps().
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper')
-rw-r--r-- | klippy/chelper/itersolve.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/klippy/chelper/itersolve.c b/klippy/chelper/itersolve.c index 78989c4d..3ecb4888 100644 --- a/klippy/chelper/itersolve.c +++ b/klippy/chelper/itersolve.c @@ -174,8 +174,10 @@ itersolve_gen_steps(struct stepper_kinematics *sk, struct move *m) if (fabs(dist) < half_step + .000000001) // Only change direction if going past midway point goto seek_new_high_range; - if (last.time >= low.time && high.time > last.time) { + if (last.time >= low.time) { // Must seek new low range to avoid re-finding previous time + if (high.time < last.time + .000000001) + goto seek_new_high_range; high.time = (last.time + high.time) * .5; high.position = calc_position(sk, m, high.time); continue; |