mcu: Avoid adding the same stepper multiple times to an endstop
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
96acfdc6d2
commit
ad480bd470
|
@ -150,6 +150,8 @@ class MCU_endstop:
|
||||||
def add_stepper(self, stepper):
|
def add_stepper(self, stepper):
|
||||||
if stepper.get_mcu() is not self._mcu:
|
if stepper.get_mcu() is not self._mcu:
|
||||||
raise pins.error("Endstop and stepper must be on the same mcu")
|
raise pins.error("Endstop and stepper must be on the same mcu")
|
||||||
|
if stepper in self._steppers:
|
||||||
|
return
|
||||||
self._steppers.append(stepper)
|
self._steppers.append(stepper)
|
||||||
def get_steppers(self):
|
def get_steppers(self):
|
||||||
return list(self._steppers)
|
return list(self._steppers)
|
||||||
|
|
Loading…
Reference in New Issue