diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2020-09-03 16:22:54 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2020-09-03 16:22:54 -0400 |
commit | 1f3a160f47175c44722a3ce1e58e90c359b99c99 (patch) | |
tree | b3dec7de83cea37073ffafa557b8b28b3304b8d3 /klippy/toolhead.py | |
parent | d0ed6e57050d280a412f82e17d2de56a5b8280ad (diff) | |
download | kutter-1f3a160f47175c44722a3ce1e58e90c359b99c99.tar.gz kutter-1f3a160f47175c44722a3ce1e58e90c359b99c99.tar.xz kutter-1f3a160f47175c44722a3ce1e58e90c359b99c99.zip |
toolhead: Add a move.move_error() helper
Move the EndstopMoveError() code from homing.py to a new method in the
toolhead Move class.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy/toolhead.py')
-rw-r--r-- | klippy/toolhead.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/klippy/toolhead.py b/klippy/toolhead.py index ae668429..c6797942 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -54,6 +54,10 @@ class Move: self.accel = min(self.accel, accel) self.delta_v2 = 2.0 * self.move_d * self.accel self.smooth_delta_v2 = min(self.smooth_delta_v2, self.delta_v2) + def move_error(self, msg="Move out of range"): + pos = self.end_pos + return homing.EndstopError("%s: %.3f %.3f %.3f [%.3f]" + % (msg, pos[0], pos[1], pos[2], pos[3])) def calc_junction(self, prev_move): if not self.is_kinematic_move or not prev_move.is_kinematic_move: return |