mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-23 22:54:10 -06:00
bed_tilt: Take into account the XY position used with z_virtual_endstop
If a z_virtual_endstop is in use, then record the last XY position that is used when the Z is homed. Use that XY position to report what change is needed to the z position_endstop. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
1dda4628a0
commit
c95cc3fb66
2 changed files with 54 additions and 8 deletions
|
@ -44,6 +44,10 @@ class BedTiltCalibrate:
|
|||
self.speed = config.getfloat('speed', 50., above=0.)
|
||||
self.horizontal_move_z = config.getfloat('horizontal_move_z', 5.)
|
||||
self.probe_z_offset = config.getfloat('probe_z_offset', 0.)
|
||||
self.z_position_endstop = None
|
||||
if config.has_section('stepper_z'):
|
||||
zconfig = config.getsection('stepper_z')
|
||||
self.z_position_endstop = zconfig.getfloat('position_endstop', None)
|
||||
self.manual_probe = config.getboolean('manual_probe', None)
|
||||
if self.manual_probe is None:
|
||||
self.manual_probe = not config.has_section('probe')
|
||||
|
@ -81,15 +85,30 @@ class BedTiltCalibrate:
|
|||
for pos in positions:
|
||||
logging.info("orig: %s new: %s", adjusted_height(pos, params),
|
||||
adjusted_height(pos, new_params))
|
||||
z_warn = ""
|
||||
z_diff = new_params['z_adjust'] - self.probe_z_offset
|
||||
if abs(z_diff) > .010:
|
||||
z_warn = "Note: Z offset was %.6f\n" % (z_diff,)
|
||||
if self.z_position_endstop is not None:
|
||||
# Cartesian style robot
|
||||
z_extra = ""
|
||||
probe = self.printer.lookup_object('probe', None)
|
||||
if probe is not None:
|
||||
last_home_position = probe.last_home_position()
|
||||
if last_home_position is not None:
|
||||
# Using z_virtual_endstop
|
||||
home_x, home_y = last_home_position[:2]
|
||||
z_diff -= home_x * new_params['x_adjust']
|
||||
z_diff -= home_y * new_params['y_adjust']
|
||||
z_extra = " (when Z homing at %.3f,%.3f)" % (home_x, home_y)
|
||||
z_adjust = "stepper_z position_endstop: %.6f%s\n" % (
|
||||
self.z_position_endstop - z_diff, z_extra)
|
||||
else:
|
||||
# Delta (or other) style robot
|
||||
z_adjust = "Add %.6f to endstop position\n" % (-z_diff,)
|
||||
msg = "%sx_adjust: %.6f y_adjust: %.6f" % (
|
||||
z_adjust, new_params['x_adjust'], new_params['y_adjust'])
|
||||
logging.info("bed_tilt_calibrate: %s", msg)
|
||||
self.gcode.respond_info(
|
||||
"%sx_adjust: %.6f y_adjust: %.6f\n"
|
||||
"To use these parameters, update the printer config file with\n"
|
||||
"the above and then issue a RESTART command" % (
|
||||
z_warn, new_params['x_adjust'], new_params['y_adjust']))
|
||||
"%s\nTo use these parameters, update the printer config file with\n"
|
||||
"the above and then issue a RESTART command" % (msg,))
|
||||
|
||||
def load_config(config):
|
||||
return BedTilt(config)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue