diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-02-25 12:54:55 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-03-13 21:53:48 -0400 |
commit | acd165cbea2f48812b7fd96c28b81622e5c13665 (patch) | |
tree | 0496d4905d40c7cfe8a164a7c8cffd1eab53e8b1 /klippy/toolhead.py | |
parent | d86bf0b927b0a56bcef5a2fee98f610884c0d4a5 (diff) | |
download | kutter-acd165cbea2f48812b7fd96c28b81622e5c13665.tar.gz kutter-acd165cbea2f48812b7fd96c28b81622e5c13665.tar.xz kutter-acd165cbea2f48812b7fd96c28b81622e5c13665.zip |
stepcompress: Implement a step+dir+step filter
Some stepper motor drivers do not respond well to rapid "step +
direction change + step" events. In particular, it is believed this
can cause "over current" events on the tmc2208 drivers when they are
in "stealthchop" mode. Detect these events and remove them from the
generated step times.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index ada5f8c3..8ce0935c 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -1,6 +1,6 @@ # Code for coordinating events on the printer toolhead # -# Copyright (C) 2016-2019 Kevin O'Connor <kevin@koconnor.net> +# Copyright (C) 2016-2020 Kevin O'Connor <kevin@koconnor.net> # # This file may be distributed under the terms of the GNU GPLv3 license. import math, logging, importlib @@ -183,6 +183,7 @@ class MoveQueue: MIN_KIN_TIME = 0.100 MOVE_BATCH_TIME = 0.500 +SDS_CHECK_TIME = 0.001 # step+dir+step filter in stepcompress.c DRIP_SEGMENT_TIME = 0.050 DRIP_TIME = 0.100 @@ -236,7 +237,7 @@ class ToolHead: self.print_stall = 0 self.drip_completion = None # Kinematic step generation scan window time tracking - self.kin_flush_delay = 0. + self.kin_flush_delay = SDS_CHECK_TIME self.kin_flush_times = [] self.last_kin_flush_time = self.last_kin_move_time = 0. # Setup iterative solver @@ -512,7 +513,7 @@ class ToolHead: self.kin_flush_times.pop(self.kin_flush_times.index(old_delay)) if delay: self.kin_flush_times.append(delay) - new_delay = max(self.kin_flush_times + [0.]) + new_delay = max(self.kin_flush_times + [SDS_CHECK_TIME]) self.kin_flush_delay = new_delay def register_lookahead_callback(self, callback): last_move = self.move_queue.get_last() |