############################################################################### #### Edit this section #### ############################################################################### [gcode_macro GlobalVariables] # Location of the probe when docked. variable_dock_x: 250 # X location variable_dock_z: 9.55 # Z location # What other way can you home the Z-Axis (prior to attaching the probe)? Use 2 or 3 ONLY if you can have the nozzle and part-cooling fan ducts past the bed at Z ~-3 variable_initial_homing: 3 # 1(none/probe only), 2(sensorless homing), 3(Z-min microswitch endstop), 4(Z-max microswitch endstop) # The distance to move along x when docking/undocking the probe from the dock variable_dock_x_offset: 27 # The carriage needs 27mm of clearance with the docked probe # The distance to move along z when attaching/detaching the probe to/from the toolhead variable_dock_z_offset: 9.25 # Travel and Dock speeds variable_travel_speed: 9000 variable_dock_speed: 6000 # World Coordinates variable_home_x: 125 # X coordinate of the center of your bed variable_home_y: 116 # Y coordinate of the center of your bed variable_probe_x_offset: 0 # Probe X offset. Should be 0 for Switchwire/Voron Afterburner toolhead variable_probe_y_offset: 34.5 # Probe Y offset. Depends or the orientation of the microswitch. 34.5 if for modded SW carriage with microswitch trigger facing the rear variable_z_max: 252 # Maximum travel for the Z axis. Look for position_max in stepper_z section of printer.cfg variable_y_min: -20 # Minimum travel for Y axis. Used in sensorless and Z-min initial homing. Nozzle and part-cooling fangs must be past the bed. Look for position_min in stepper_y section of printer.cfg variable_y_max: 230 # Maximum travel for the Y axis. Look for position_max in stepper_y section in printer.cfg ## Sensorless Homing ## # If you plan to use sensorless homing for the Z axis for the initial homing, uncomment the next section and enter stepper motors current as in your printer.cfg file #variable_x_run_current: 0.5 #variable_x_hold_current: 0.3 #variable_z_run_current: 0.5 #variable_z_hold_current: 0.3 #variable_homing_x_run_current: 0.9 # Those are the values I used with good results for sensorless homing #variable_homing_x_hold_current: 0.9 #variable_homing_z_run_current: 0.9 #variable_homing_z_hold_current: 0.9 gcode: ############################################################################### ############################################################################### [homing_override] axes: z gcode: #LIGHTS_ON SET_GCODE_OFFSET Z=0 query_probe do_Home [gcode_macro do_Home] gcode: GlobalVariables {% set dock_x = printer["gcode_macro GlobalVariables"].dock_x %} {% set dock_z = printer["gcode_macro GlobalVariables"].dock_z %} {% set dock_z_offset = printer["gcode_macro GlobalVariables"].dock_z_offset %} {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set initial_homing = printer["gcode_macro GlobalVariables"].initial_homing %} {% if printer.toolhead.homed_axes == 'xyz' %} G90 G0 Z{ dock_z + dock_z_offset } F{ travel_speed } G28 X0 Y0 Attach_probe PROBE_HOMING {% else %} SET_KINEMATIC_POSITION X={ dock_x } Z=0 G90 G0 Z{ dock_z + dock_z_offset } F{ travel_speed } G28 X0 Y0 {% if printer.probe.last_query == 0 %} PROBE_HOMING {% endif %} {% if printer.probe.last_query == 1 %} {% if initial_homing == 1 %} RESPOND TYPE=error MSG="Please attach probe" M117 Please attach probe {% endif %} {% if initial_homing == 2 %} SENSORLESS_HOMING {% endif %} {% if initial_homing == 3 %} PROBELESS_HOMING {% endif %} {% if initial_homing == 4 %} PROBELESS_HOMING {% endif %} {% endif %} {% endif %} [gcode_macro PROBELESS_HOMING] gcode: GlobalVariables {% set dock_z = printer["gcode_macro GlobalVariables"].dock_z %} {% set dock_z_offset = printer["gcode_macro GlobalVariables"].dock_z_offset %} {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set home_x = printer["gcode_macro GlobalVariables"].home_x %} {% set home_y = printer["gcode_macro GlobalVariables"].home_y %} {% set probe_x_offset = printer["gcode_macro GlobalVariables"].probe_x_offset %} {% set probe_y_offset = printer["gcode_macro GlobalVariables"].probe_y_offset %} {% set y_min = printer["gcode_macro GlobalVariables"].y_min %} {% set initial_homing = printer["gcode_macro GlobalVariables"].initial_homing %} {% if initial_homing == 3 %} G0 X{ home_x - probe_x_offset } Y{ y_min } F{ travel_speed } {% endif %} {% if initial_homing == 4 %} G0 X{ home_x - probe_x_offset } Y{ home_y - probe_y_offset } F{ travel_speed } {% endif %} G28 Z0 G0 Z{dock_z + dock_z_offset } F{ travel_speed } Attach_probe Adjust_Z [gcode_macro Set_Home_Current] gcode: GlobalVariables {% set homing_x_run_current = printer["gcode_macro GlobalVariables"].homing_x_run_current %} {% set homing_x_hold_current = printer["gcode_macro GlobalVariables"].homing_x_hold_current %} {% set homing_z_run_current = printer["gcode_macro GlobalVariables"].homing_z_run_current %} {% set homing_z_hold_current = printer["gcode_macro GlobalVariables"].homing_z_hold_current %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT=homing_x_run_current HOLDCURRENT=homing_x_run_current SET_TMC_CURRENT STEPPER=stepper_z CURRENT=homing_x_run_current HOLDCURRENT=homing_x_run_current [gcode_macro Set_Print_Current] gcode: GlobalVariables {% set x_run_current = printer["gcode_macro GlobalVariables"].x_run_current %} {% set x_hold_current = printer["gcode_macro GlobalVariables"].x_hold_current %} {% set z_run_current = printer["gcode_macro GlobalVariables"].z_run_current %} {% set z_hold_current = printer["gcode_macro GlobalVariables"].z_hold_current %} SET_TMC_CURRENT STEPPER=stepper_x CURRENT={ x_run_current } HOLDCURRENT={ x_hold_current } SET_TMC_CURRENT STEPPER=stepper_z CURRENT={ z_run_current } HOLDCURRENT={ z_hold_current } [gcode_macro SENSORLESS_HOMING] gcode: GlobalVariables {% set dock_z = printer["gcode_macro GlobalVariables"].dock_z %} {% set dock_z_offset = printer["gcode_macro GlobalVariables"].dock_z_offset %} {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set home_x = printer["gcode_macro GlobalVariables"].home_x %} {% set probe_x_offset = printer["gcode_macro GlobalVariables"].probe_x_offset %} {% set y_min = printer["gcode_macro GlobalVariables"].y_min %} G0 X{ home_x - probe_x_offset } Y { y_min } F9000 Set_Home_Current G28 Z0 G0 Z{dock_z + dock_z_offset } F{ travel_speed } Set_Print_Current G28 X0 Attach_probe Adjust_Z [gcode_macro PROBE_HOMING] gcode: Adjust_Z [gcode_macro Adjust_Z] gcode: GlobalVariables {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set home_x = printer["gcode_macro GlobalVariables"].home_x %} {% set home_y = printer["gcode_macro GlobalVariables"].home_y %} {% set probe_x_offset = printer["gcode_macro GlobalVariables"].probe_x_offset %} {% set probe_y_offset = printer["gcode_macro GlobalVariables"].probe_y_offset %} {% set z_max = printer["gcode_macro GlobalVariables"].z_max %} {% set probe_offset_z = printer.configfile.config.probe.z_offset|float %} G0 X{ home_x - probe_x_offset } Y{ home_y - probe_y_offset } F { travel_speed } SET_KINEMATIC_POSITION Z={ z_max } PROBE PROBE_SPEED=40 SET_KINEMATIC_POSITION Z={probe_offset_z} G91 G0 Z2 F{ travel_speed } G90 PROBE PROBE_SPEED=20 SET_KINEMATIC_POSITION Z={probe_offset_z} G0 Z{ probe_offset_z + 3 } F{ travel_speed } [gcode_macro Dock_probe] gcode: query_probe do_Dock [gcode_macro do_Dock] gcode: {% if printer.probe.last_query == 1 %} RESPOND PREFIX= MSG="Probe is already docked!" M117 Probe is already docked! {% else %} GlobalVariables {% set dock_x = printer["gcode_macro GlobalVariables"].dock_x %} {% set dock_z = printer["gcode_macro GlobalVariables"].dock_z %} {% set home_y = printer["gcode_macro GlobalVariables"].home_y %} {% set dock_x_offset = printer["gcode_macro GlobalVariables"].dock_x_offset %} {% set dock_z_offset = printer["gcode_macro GlobalVariables"].dock_z_offset %} {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set dock_speed = printer["gcode_macro GlobalVariables"].dock_speed %} {% set probe_y_offset = printer["gcode_macro GlobalVariables"].probe_y_offset %} {% if printer.toolhead.homed_axes != 'xyz' %} G28 # Home All Axes {% endif %} G90 G0 Z{ dock_z + dock_z_offset } F{ travel_speed } G0 X{ dock_x } Y{ home_y - probe_y_offset } F{ dock_speed } G0 Z{ dock_z } F{ dock_speed } G0 X{ dock_x - dock_x_offset } Y{ home_y - probe_y_offset } F{ dock_speed } G0 Z{ dock_z } F{ travel_speed } {% endif %} verify_Docking [gcode_macro verify_Docking] gcode: query_probe safe_Dock [gcode_macro safe_Dock] gcode: {% if printer.probe.last_query != 1 %} M112 {% endif %} [gcode_macro Attach_probe] gcode: query_probe do_Attach [gcode_macro do_Attach] gcode: {% if printer.probe.last_query == 0 %} RESPOND PREFIX= MSG="Probe is already attached!" M117 Probe is already attached! {% else %} GlobalVariables {% set dock_x = printer["gcode_macro GlobalVariables"].dock_x %} {% set dock_z = printer["gcode_macro GlobalVariables"].dock_z %} {% set dock_x_offset = printer["gcode_macro GlobalVariables"].dock_x_offset %} {% set dock_z_offset = printer["gcode_macro GlobalVariables"].dock_z_offset %} {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set dock_speed = printer["gcode_macro GlobalVariables"].dock_speed %} {% set home_y = printer["gcode_macro GlobalVariables"].home_y %} {% set probe_y_offset = printer["gcode_macro GlobalVariables"].probe_y_offset %} {% if printer.toolhead.homed_axes != 'xyz' %} G28 # Home All Axes {% endif %} G90 G0 X{ dock_x - dock_x_offset } F{ travel_speed } G0 Z{ dock_z } F{ travel_speed } G0 X{ dock_x } Y{ home_y - probe_y_offset } F{ dock_speed } G0 Z{ dock_z + dock_z_offset } F{ dock_speed } G0 X{ dock_x - dock_x_offset } Y{ home_y - probe_y_offset } F{ dock_speed } G0 Z{ dock_z } F{ travel_speed } {% endif %} [gcode_macro Park_toolhead] gcode: query_probe do_Park [gcode_macro do_Park] gcode: GlobalVariables {% set dock_x = printer["gcode_macro GlobalVariables"].dock_x %} {% set dock_z = printer["gcode_macro GlobalVariables"].dock_z %} {% set dock_x_offset = printer["gcode_macro GlobalVariables"].dock_x_offset %} {% set dock_z_offset = printer["gcode_macro GlobalVariables"].dock_z_offset %} {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} {% set dock_speed = printer["gcode_macro GlobalVariables"].dock_speed %} {% set home_y = printer["gcode_macro GlobalVariables"].home_y %} {% set probe_y_offset = printer["gcode_macro GlobalVariables"].probe_y_offset %} {% set y_max = printer["gcode_macro GlobalVariables"].y_max %} RESPOND PREFIX= MSG="Parking toolhead" {% if printer.probe.last_query == 0 %} G90 G0 Z{ dock_z + dock_z_offset } G0 X{ dock_x } Y{ home_y - probe_y_offset } F{ dock_speed } G0 Z{ dock_z } F{ dock_speed } {% else %} G91 G0 Z10 F{ travel_speed } # Move toolhead up to prevent hitting printed parts G90 G0 Y{ y_max } F{ travel_speed } # Move the bed to prevent hitting printed parts G0 X{ dock_x - dock_x_offset } F{ travel_speed } G0 Z{ dock_z } F{ travel_speed } G0 X{ dock_x } F{ dock_speed } {% endif %} [gcode_macro BED_MESH_CALIBRATE] rename_existing: _BED_MESH_CALIBRATE ; gcode parameters variable_parameter_AREA_START : 0,0 variable_parameter_AREA_END : 0,0 ; the clearance between print area and probe area variable_mesh_area_offset : 5.0 ; number of sample per probe point variable_probe_samples : 3 ; minimum probe count variable_min_probe_count : 3 gcode: Attach_probe {% if params.AREA_START and params.AREA_END %} {% set bedMeshConfig = printer["configfile"].config["bed_mesh"] %} {% set safe_min_x = bedMeshConfig.mesh_min.split(",")[0]|float %} {% set safe_min_y = bedMeshConfig.mesh_min.split(",")[1]|float %} {% set safe_max_x = bedMeshConfig.mesh_max.split(",")[0]|float %} {% set safe_max_y = bedMeshConfig.mesh_max.split(",")[1]|float %} {% set area_min_x = params.AREA_START.split(",")[0]|float %} {% set area_min_y = params.AREA_START.split(",")[1]|float %} {% set area_max_x = params.AREA_END.split(",")[0]|float %} {% set area_max_y = params.AREA_END.split(",")[1]|float %} {% set meshPointX = bedMeshConfig.probe_count.split(",")[0]|float %} {% set meshPointY = bedMeshConfig.probe_count.split(",")[1]|float %} {% if (area_min_x < area_max_x) and (area_min_y < area_max_y) %} {% if area_min_x - mesh_area_offset >= safe_min_x %} {% set area_min_x = area_min_x - mesh_area_offset %} {% else %} {% set area_min_x = safe_min_x %} {% endif %} {% if area_min_y - mesh_area_offset >= safe_min_y %} {% set area_min_y = area_min_y - mesh_area_offset %} {% else %} {% set area_min_y = safe_min_y %} {% endif %} {% if area_max_x + mesh_area_offset <= safe_max_x %} {% set area_max_x = area_max_x + mesh_area_offset %} {% else %} {% set area_max_x = safe_max_x %} {% endif %} {% if area_max_y + mesh_area_offset <= safe_max_y %} {% set area_max_y = area_max_y + mesh_area_offset %} {% else %} {% set area_max_y = safe_max_y %} {% endif %} {% set meshPointX = (meshPointX * (area_max_x - area_min_x) / (safe_max_x - safe_min_x))|int %} {% if meshPointX < min_probe_count %} {% set meshPointX = min_probe_count %} {% endif %} {% set meshPointY = (meshPointY * (area_max_y -area_min_y ) / (safe_max_y - safe_min_y))|int %} {% if meshPointY < min_probe_count %} {% set meshPointY = min_probe_count %} {% endif %} _BED_MESH_CALIBRATE mesh_min={area_min_x},{area_min_y} mesh_max={area_max_x},{area_max_y} probe_count={meshPointX},{meshPointY} samples={probe_samples|int} {% else %} _BED_MESH_CALIBRATE {% endif %} {% else %} _BED_MESH_CALIBRATE {% endif %} #_BED_MESH_CALIBRATE {% for p in params # %}{'%s=%s' % (p, params[p])}{% # endfor %} [gcode_macro SCREWS_TILT_CALCULATE] rename_existing: _SCREWS_TILT_CALCULATE gcode: Attach_probe _SCREWS_TILT_CALCULATE {% for p in params %}{'%s=%s' % (p, params[p])}{% endfor %} #[gcode_macro PROBE_ACCURACY] #rename_existing: _PROBE_ACCURACY #gcode: # GlobalVariables # {% set travel_speed = printer["gcode_macro GlobalVariables"].travel_speed %} # {% set home_x = printer["gcode_macro GlobalVariables"].home_x %} # {% set home_y = printer["gcode_macro GlobalVariables"].home_y %} # {% set probe_x_offset = printer["gcode_macro GlobalVariables"].probe_x_offset %} # {% set probe_y_offset = printer["gcode_macro GlobalVariables"].probe_y_offset %} # # Attach_probe # G0 X{ home_x - probe_x_offset } Y{ home_y - probe_y_offset } F { travel_speed } # _PROBE_ACCURACY {% for p in params # %}{'%s=%s' % (p, params[p])}{% # endfor %} [force_move] enable_force_move: True