Skip to content

Commit

Permalink
STEAPP-733: Added recursive offset measurement for the С-axis
Browse files Browse the repository at this point in the history
  • Loading branch information
SokolovJek committed Feb 12, 2024
1 parent 1e5a0d9 commit 8215781
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion klippy/extras/c_axis_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def __init__(self, config):
self.gcode.register_command(
'SAVE_C_AXIS_POINT', self.cmd_SAVE_C_AXIS_POINT,
desc=self.cmd_SAVE_C_AXIS_POINT_help)
self.gcode.register_command(
'MOVE_ALIGN_C_AXIS', self.cmd_MOVE_ALIGN_C_AXIS,
desc=self.cmd_MOVE_ALIGN_C_AXIS_help)

cmd_SAVE_C_AXIS_POINT_help = "Save point for C axis align"

Expand All @@ -50,12 +53,17 @@ def cmd_ALIGN_C_AXIS(self, gcmd):
self.gcode.run_script_from_command("MOVE_ALIGN_C_AXIS")
offset = self._calc_c_axis_align(
self.point_coords[0], self.point_coords[1])
if (self.threshold_value * -1) <= offset <= self.threshold_value:
if abs(offset) <= self.threshold_value:
logging.info("align the axis C completed")
break
else:
self._apply_offset_c(offset)

cmd_MOVE_ALIGN_C_AXIS_help = "By default, it returns the offset of the\
axis, if necessary, perform rename_existing of this command in the macro"
def cmd_MOVE_ALIGN_C_AXIS(self, gcmd):
gcmd.respond_info("the MOVE_ALIGN_C_AXIS command is not supported")

def _calc_c_axis_align(self, point_0, point_1):
offset = math.atan((point_1[1] - point_0[1]) / 90) * RAD_TO_DEG / 3
logging.info("calculate offset for the axis C: %f." % offset)
Expand Down
1 change: 1 addition & 0 deletions stereotech_config/calibrate/probe_5d_template.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ gcode:

[gcode_macro MOVE_ALIGN_C_AXIS]
description: moves for align template along axis X
rename_existing: MOVE_ALIGN_C_AXIS_OLD
gcode:
PROBE_TEMPLATE_POINT POINT=D_Y
SET_POINT MACRO=SAVE_C_AXIS_POINT POINT=1
Expand Down

0 comments on commit 8215781

Please sign in to comment.