diff --git a/macros/z_tramming.cfg b/macros/z_tramming.cfg index 97caaff..f92fe8d 100644 --- a/macros/z_tramming.cfg +++ b/macros/z_tramming.cfg @@ -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}' diff --git a/macros/z_tramming_settings.cfg b/macros/z_tramming_settings.cfg index 117aff5..7524330 100644 --- a/macros/z_tramming_settings.cfg +++ b/macros/z_tramming_settings.cfg @@ -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