diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2017-10-03 19:32:08 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2017-10-03 22:06:51 -0400 |
commit | 381304aa6f3ae04b64e673254cafbc4f9fbf1b84 (patch) | |
tree | 37f7b4d3bf84b75217b0a4cf4e8d0f55b0be1190 /klippy | |
parent | ce9523fb90fa537fd9a5eebd77852f6ac4c459de (diff) | |
download | kutter-381304aa6f3ae04b64e673254cafbc4f9fbf1b84.tar.gz kutter-381304aa6f3ae04b64e673254cafbc4f9fbf1b84.tar.xz kutter-381304aa6f3ae04b64e673254cafbc4f9fbf1b84.zip |
stepper: If homing_endstop_phase is configured, make 0.0 be at a full step
If the stepper phases are known then it is possible to arrange for the
0.0 position to occur at a full step. On cartesian style printer,
this makes it possible for the Z levels to occur at full steps (which
may help reduce "Z ribbing").
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'klippy')
-rw-r--r-- | klippy/stepper.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/klippy/stepper.py b/klippy/stepper.py index 5040ce9e..6e75413b 100644 --- a/klippy/stepper.py +++ b/klippy/stepper.py @@ -86,6 +86,20 @@ class PrinterHomingStepper(PrinterStepper): self.homing_endstop_phase = config.getint( 'homing_endstop_phase', None, minval=0 , maxval=self.homing_stepper_phases-1) + if self.homing_endstop_phase is not None: + # Adjust the endstop position so 0.0 is always at a full step + micro_steps = self.homing_stepper_phases // 4 + phase_offset = ( + ((self.homing_endstop_phase + micro_steps // 2) % micro_steps) + - micro_steps // 2) * self.step_dist + full_step = micro_steps * self.step_dist + es_pos = (int(self.position_endstop / full_step + .5) * full_step + + phase_offset) + if es_pos != self.position_endstop: + logging.info("Changing %s endstop position to %.3f" + " (from %.3f)", self.name, es_pos, + self.position_endstop) + self.position_endstop = es_pos if endstop_accuracy is None: self.homing_endstop_accuracy = self.homing_stepper_phases//2 - 1 elif self.homing_endstop_phase is not None: |