stepper: Raise an EndstopError if invalid phase found during homing

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-11-18 14:35:31 -05:00
parent ab1972d1cf
commit 7cf914537b
1 changed files with 4 additions and 3 deletions

View File

@ -4,6 +4,7 @@
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import math, logging import math, logging
import homing
class PrinterStepper: class PrinterStepper:
def __init__(self, printer, config, name): def __init__(self, printer, config, name):
@ -97,7 +98,7 @@ class PrinterStepper:
if delta >= self.homing_stepper_phases - self.homing_endstop_accuracy: if delta >= self.homing_stepper_phases - self.homing_endstop_accuracy:
delta -= self.homing_stepper_phases delta -= self.homing_stepper_phases
elif delta > self.homing_endstop_accuracy: elif delta > self.homing_endstop_accuracy:
logging.error("Endstop %s incorrect phase (got %d vs %d)" % ( raise homing.EndstopError(
self.config.section, pos, self.homing_endstop_phase)) "Endstop %s incorrect phase (got %d vs %d)" % (
return 0 self.name, pos, self.homing_endstop_phase))
return delta return delta