Skip to content

Commit

Permalink
add lift_direction
Browse files Browse the repository at this point in the history
allows configuring how to move the screw to lift the bed
  • Loading branch information
Jomik committed Jul 12, 2024
1 parent 205232a commit 268666f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions macros/z_tramming.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,27 @@ gcode:
{% set probe = printer.configfile.settings.probe %}
{% set tolerance = config.tolerance | default(probe.samples_tolerance * 2)%}
{% set screw_lead = config.screw_lead %}
{% set lift_direction = config.lift_direction | default("CW") | upper %}

{% if not lift_direction in ["CW", "CCW"] %}
{action_raise_error("%s is not a valid lift_direction" % lift_direction)}
{% endif %}
{% set drop_direction = "CW" if lift_direction == "CCW" else "CCW" %}

{% set variance = (left - right) | abs %}

# If we are outside of tolerance, prompt the user to adjust the right lead screw
{% if variance > tolerance %}
{% set right_is = "higher" if left > right else "lower" %}
{% set drop_bed = left > right %}
# Right is closer to the toolhead, which means it is higher up.
{% set right_is = "higher" if drop_bed else "lower" %}
RESPOND TYPE=error MSG='{"Right is %0.3fmm %s" % (variance, right_is)}'

{action_respond_info("01:20 means 1 full turn and 20 minutes, CW = clockwise, CCW = counter clockwise")}
# One full turn will move the Z axis by the screw lead
{% set hours = (variance / screw_lead) | int %}
{% set minutes = ((variance / screw_lead * 60) % 60) | int %}
{% set direction = "CCW" if left > right else "CW" %}
{% set direction = drop_direction if drop_bed else lift_direction %}

RESPOND TYPE=command MSG="action:prompt_begin Z axis needs adjustment"
RESPOND TYPE=command MSG='{"action:prompt_text Tolerance is set to %0.3fmm" % tolerance}'
Expand Down
1 change: 1 addition & 0 deletions macros/z_tramming_settings.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# variable_left: 0 # Defaults to minmum position accounting for probe offset
# variable_right: 169.5 # Defaults to minmum position accounting for probe offset
# variable_speed: 150 # Defaults to safe_z_home.speed
# variable_lift_direction: CW # The direction to turn a lead screw to lift the bed. Defaults to CW. Either CW or CCW
gcode:

# This is an example for a Sovol SV06
Expand Down

0 comments on commit 268666f

Please sign in to comment.