aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2020-03-24 15:48:49 -0400
committerKevin O'Connor <kevin@koconnor.net>2020-03-24 16:04:11 -0400
commit8a3233b3976d1d79c9d3ba337d99213eac3af3ee (patch)
tree8c3f5df845af07c8c8144289451da5294aed7a19
parent302cd3821770ef2ba0261dc4d52019426a1a0262 (diff)
downloadkutter-8a3233b3976d1d79c9d3ba337d99213eac3af3ee.tar.gz
kutter-8a3233b3976d1d79c9d3ba337d99213eac3af3ee.tar.xz
kutter-8a3233b3976d1d79c9d3ba337d99213eac3af3ee.zip
stepper: Add a config check for obvious incorrect homing_positive_dir
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--config/example.cfg3
-rw-r--r--klippy/stepper.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/config/example.cfg b/config/example.cfg
index b8531691..c579864e 100644
--- a/config/example.cfg
+++ b/config/example.cfg
@@ -64,7 +64,8 @@ position_max: 200
# The default is homing_speed/2.
#homing_positive_dir:
# If true, homing will cause the stepper to move in a positive
-# direction (away from zero); if false, home towards zero. The
+# direction (away from zero); if false, home towards zero. It is
+# better to use the default than to specify this parameter. The
# default is true if position_endstop is near position_max and false
# if near position_min.
diff --git a/klippy/stepper.py b/klippy/stepper.py
index 1ec59974..747e74b3 100644
--- a/klippy/stepper.py
+++ b/klippy/stepper.py
@@ -252,6 +252,13 @@ class PrinterRail:
raise config.error(
"Unable to infer homing_positive_dir in section '%s'" % (
config.get_name(),))
+ elif ((self.homing_positive_dir
+ and self.position_endstop == self.position_min)
+ or (not self.homing_positive_dir
+ and self.position_endstop == self.position_max)):
+ raise config.error(
+ "Invalid homing_positive_dir / position_endstop in '%s'"
+ % (config.get_name(),))
def get_range(self):
return self.position_min, self.position_max
def get_homing_info(self):