diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-05-04 10:24:46 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-05-04 10:24:46 -0400 |
commit | 7843c23b8cd704e5af4dc3c52345fa30f5160ae0 (patch) | |
tree | 71e42eb36da5d93e7f5494fd176f6562e287e6ff /klippy/chelper/itersolve.c | |
parent | dac42efbd9236cfdeea6baefe65bbd3ab46abcdb (diff) | |
download | kutter-7843c23b8cd704e5af4dc3c52345fa30f5160ae0.tar.gz kutter-7843c23b8cd704e5af4dc3c52345fa30f5160ae0.tar.xz kutter-7843c23b8cd704e5af4dc3c52345fa30f5160ae0.zip |
itersolve: Fix numeric stability of flush range times
Don't assume the times passed to itersolve_gen_steps_range() are
contained within the move. It's possible the checks in
itersolve_generate_steps() may round to different values when
converting the times to a relative move time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/chelper/itersolve.c')
-rw-r--r-- | klippy/chelper/itersolve.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/klippy/chelper/itersolve.c b/klippy/chelper/itersolve.c index 9cae55fd..28a337ad 100644 --- a/klippy/chelper/itersolve.c +++ b/klippy/chelper/itersolve.c @@ -64,11 +64,15 @@ itersolve_find_step(struct stepper_kinematics *sk, struct move *m // Generate step times for a portion of a move static int32_t itersolve_gen_steps_range(struct stepper_kinematics *sk, struct move *m - , double move_start, double move_end) + , double abs_start, double abs_end) { sk_calc_callback calc_position_cb = sk->calc_position_cb; double half_step = .5 * sk->step_dist; - double start = move_start - m->print_time, end = move_end - m->print_time; + double start = abs_start - m->print_time, end = abs_end - m->print_time; + if (start < 0.) + start = 0.; + if (end > m->move_t) + end = m->move_t; struct timepos last = { start, sk->commanded_pos }, low = last, high = last; double seek_time_delta = SEEK_TIME_RESET; int sdir = stepcompress_get_step_dir(sk->sc), is_dir_change = 0; |