mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-08-05 13:04:05 -06:00
homing: Add EndstopMoveError wrapper around EndstopError
Allow an EndstopError to be raised without a destination position. Introduce EndstopMoveError wrapper so that current callers can continue to pass in a move destination. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
2b5b899d35
commit
4f30dce64f
4 changed files with 15 additions and 11 deletions
|
@ -104,9 +104,11 @@ class QueryEndstops:
|
|||
return False
|
||||
|
||||
class EndstopError(Exception):
|
||||
def __init__(self, pos, msg="Move out of range"):
|
||||
self.pos = pos
|
||||
self.msg = msg
|
||||
def __init__(self, msg="Endstop error"):
|
||||
self._msg = msg
|
||||
def __str__(self):
|
||||
return "%s: %.3f %.3f %.3f [%.3f]" % (
|
||||
self.msg, self.pos[0], self.pos[1], self.pos[2], self.pos[3])
|
||||
return self._msg
|
||||
|
||||
def EndstopMoveError(pos, msg="Move out of range"):
|
||||
return EndstopError("%s: %.3f %.3f %.3f [%.3f]" % (
|
||||
msg, pos[0], pos[1], pos[2], pos[3]))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue