-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
homing: Log a warning if probe alters stepper kinematic positions
After a probe attempt the toolhead position needs to be recalculated to the position that the toolhead ultimately halted at. Check that the position setting wouldn't actually change the internal view of the stepper motor and log a warning if any skew is detected. Signed-off-by: Kevin O'Connor <[email protected]>
- Loading branch information
1 parent
b381f50
commit 31fe50f
Showing
2 changed files
with
16 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Helper code for implementing homing operations | ||
# | ||
# Copyright (C) 2016-2021 Kevin O'Connor <[email protected]> | ||
# Copyright (C) 2016-2024 Kevin O'Connor <[email protected]> | ||
# | ||
# This file may be distributed under the terms of the GNU GPLv3 license. | ||
import logging, math | ||
|
@@ -29,10 +29,17 @@ def __init__(self, stepper, endstop_name): | |
self.endstop_name = endstop_name | ||
self.stepper_name = stepper.get_name() | ||
self.start_pos = stepper.get_mcu_position() | ||
self.start_cmd_pos = stepper.mcu_to_commanded_position(self.start_pos) | ||
self.halt_pos = self.trig_pos = None | ||
def note_home_end(self, trigger_time): | ||
self.halt_pos = self.stepper.get_mcu_position() | ||
self.trig_pos = self.stepper.get_past_mcu_position(trigger_time) | ||
def verify_no_probe_skew(self, haltpos): | ||
new_start_pos = self.stepper.get_mcu_position(self.start_cmd_pos) | ||
if new_start_pos != self.start_pos: | ||
logging.warning( | ||
"Stepper '%s' position skew after probe: pos %d now %d", | ||
self.stepper.get_name(), self.start_pos, new_start_pos) | ||
|
||
# Implementation of homing/probing moves | ||
class HomingMove: | ||
|
@@ -121,6 +128,9 @@ def homing_move(self, movepos, speed, probe_pos=False, | |
haltpos = trigpos = self.calc_toolhead_pos(kin_spos, trig_steps) | ||
if trig_steps != halt_steps: | ||
haltpos = self.calc_toolhead_pos(kin_spos, halt_steps) | ||
self.toolhead.set_position(haltpos) | ||
for sp in self.stepper_positions: | ||
sp.verify_no_probe_skew(haltpos) | ||
else: | ||
haltpos = trigpos = movepos | ||
over_steps = {sp.stepper_name: sp.halt_pos - sp.trig_pos | ||
|
@@ -130,7 +140,7 @@ def homing_move(self, movepos, speed, probe_pos=False, | |
halt_kin_spos = {s.get_name(): s.get_commanded_position() | ||
for s in kin.get_steppers()} | ||
haltpos = self.calc_toolhead_pos(halt_kin_spos, over_steps) | ||
self.toolhead.set_position(haltpos) | ||
self.toolhead.set_position(haltpos) | ||
# Signal homing/probing move complete | ||
try: | ||
self.printer.send_event("homing:homing_move_end", self) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters