Skip to content

Commit

Permalink
Autogenerated - Upstream 13cea1c
Browse files Browse the repository at this point in the history
  • Loading branch information
Klippy-Tools-Bot committed Oct 27, 2024
1 parent da2d849 commit cf71b6c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion klippy/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9a2e079
13cea1c
1 change: 0 additions & 1 deletion klippy/docs/Sponsors.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ serve the 3D printing community better. Follow them on
## Sponsors

[<img src="./img/sponsors/obico-light-horizontal.png" width="200" style="margin:25px" />](https://obico.io/klipper.html?source=klipper_sponsor)
[<img src="./img/sponsors/peopoly-logo.png" width="200" style="margin:25px" />](https://peopoly.net)

## Klipper Developers

Expand Down
14 changes: 12 additions & 2 deletions klippy/extras/homing.py
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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion klippy/mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,10 @@ def _ready(self):
systime = self._reactor.monotonic()
get_clock = self._clocksync.get_clock
calc_freq = get_clock(systime + 1) - get_clock(systime)
freq_diff = abs(mcu_freq - calc_freq)
mcu_freq_mhz = int(mcu_freq / 1000000. + 0.5)
calc_freq_mhz = int(calc_freq / 1000000. + 0.5)
if mcu_freq_mhz != calc_freq_mhz:
if freq_diff > mcu_freq*0.01 and mcu_freq_mhz != calc_freq_mhz:
pconfig = self._printer.lookup_object('configfile')
msg = ("MCU '%s' configured for %dMhz but running at %dMhz!"
% (self._name, mcu_freq_mhz, calc_freq_mhz))
Expand Down
6 changes: 4 additions & 2 deletions klippy/stepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ def set_position(self, coord):
def get_commanded_position(self):
ffi_main, ffi_lib = chelper.get_ffi()
return ffi_lib.itersolve_get_commanded_pos(self._stepper_kinematics)
def get_mcu_position(self):
mcu_pos_dist = self.get_commanded_position() + self._mcu_position_offset
def get_mcu_position(self, cmd_pos=None):
if cmd_pos is None:
cmd_pos = self.get_commanded_position()
mcu_pos_dist = cmd_pos + self._mcu_position_offset
mcu_pos = mcu_pos_dist / self._step_dist
if mcu_pos >= 0.:
return int(mcu_pos + 0.5)
Expand Down

0 comments on commit cf71b6c

Please sign in to comment.