diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-04-11 12:11:03 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-04-11 12:19:57 -0400 |
commit | dce9971aa9ea75c56d6762ec1978e01006951e94 (patch) | |
tree | 87581c4ba824d66c45c65f19913eca7eb21b1351 /klippy | |
parent | a93d09cdf4a715bc8952c12bdaac35e696986c3a (diff) | |
download | kutter-dce9971aa9ea75c56d6762ec1978e01006951e94.tar.gz kutter-dce9971aa9ea75c56d6762ec1978e01006951e94.tar.xz kutter-dce9971aa9ea75c56d6762ec1978e01006951e94.zip |
stepcompress: Improve numerical stability of step+dir+step filter
Apply the step+dir+step filter even if, for some reason, a negative
time is found.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/chelper/stepcompress.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/klippy/chelper/stepcompress.c b/klippy/chelper/stepcompress.c index 8622df21..09fedf7a 100644 --- a/klippy/chelper/stepcompress.c +++ b/klippy/chelper/stepcompress.c @@ -499,7 +499,7 @@ stepcompress_append(struct stepcompress *sc, int sdir // Flush previous pending step (if any) if (sc->next_step_clock) { if (unlikely(sdir != sc->next_step_dir)) { - double diff = step_clock - sc->next_step_clock; + double diff = (int64_t)(step_clock - sc->next_step_clock); if (diff < SDS_FILTER_TIME * sc->mcu_freq) { // Rollback last step to avoid rapid step+dir+step sc->next_step_clock = 0; |