v2.4: use z_calibration plugin
This commit is contained in:
		
							parent
							
								
									97a84b3338
								
							
						
					
					
						commit
						fce3702a8a
					
				
					 9 changed files with 929 additions and 666 deletions
				
			
		
							
								
								
									
										11
									
								
								z_calibration/README.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								z_calibration/README.md
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | |||
| # Sample Configuration | ||||
| 
 | ||||
| This are some parts of my V2 300 configurations describing all the mag-probe, probing | ||||
| and QGL stuff. | ||||
| 
 | ||||
| These configurations are the essence of the overall configuration from | ||||
| [zellneralex](https://github.com/zellneralex/klipper_config/tree/master) | ||||
| which is really well done !! Have a look if you want to take all of it! | ||||
| 
 | ||||
| **CAUTION: Please, don't just copy it - understand and adapt for your needs instead! | ||||
| Use this on your own risk!** | ||||
							
								
								
									
										129
									
								
								z_calibration/homing.cfg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										129
									
								
								z_calibration/homing.cfg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,129 @@ | |||
| ##################################################################### | ||||
| #    Homing definition | ||||
| ##################################################################### | ||||
| [homing_override] | ||||
| axes: z | ||||
| set_position_z: 0 | ||||
| gcode: | ||||
|   ##### get user defines ##### | ||||
|   # use -10 as default to insure it error in case the variable is not existing | ||||
|   {% set z_endstop_x = printer['gcode_macro _USER_VARIABLE'].z_endstop_x|default(-10) %} | ||||
|   {% set z_endstop_y = printer['gcode_macro _USER_VARIABLE'].z_endstop_y|default(-10) %} | ||||
|   {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop %} | ||||
|   ##### end of definitions ##### | ||||
|   SAVE_GCODE_STATE NAME=HOMING_state | ||||
| 
 | ||||
|   ## reduce current of Z motors | ||||
|   _SET_ACC VAL=HOME | ||||
|   _SET_CURRENT VAL=HOME | ||||
|      | ||||
|   G91                            ; relative positioning | ||||
|   # G0 Z10 F1500 | ||||
|   G0 Z10 F1300 | ||||
|   G90                            ; absolute positioning | ||||
| 
 | ||||
|   # Home X and Y only for G28 or G28 XYZ | ||||
|   {% if 'Z' in params %} | ||||
|     {% if "x" not in printer.toolhead.homed_axes %} | ||||
|       G28 X | ||||
|     {% endif %} | ||||
|     {% if "y" not in printer.toolhead.homed_axes %} | ||||
|       G28 Y | ||||
|     {% endif %} | ||||
|   {% else %} | ||||
|     G28 X Y | ||||
|   {% endif %}  | ||||
| 
 | ||||
|   ##	XY Location of the Z Endstop Switch | ||||
|   G0 X{z_endstop_x} Y{z_endstop_y} F12000 | ||||
|   G28 Z                          ; home Z | ||||
|   # G0 Z2 F1500                   ; move up | ||||
|   G0 Z2 F1300                   ; move up | ||||
| 
 | ||||
|   ## return to org current settings | ||||
|   {% if params.RESET_SETTINGS|default('true') == 'true' %} | ||||
|     DETACH_PROBE | ||||
|     _SET_CURRENT | ||||
|     _SET_ACC | ||||
|   {% endif %} | ||||
| 
 | ||||
|   # Lift Z | ||||
|   # G0 Z{z_hop} F1800 | ||||
|   G0 Z{z_hop} F1300 | ||||
| 
 | ||||
|   RESTORE_GCODE_STATE NAME=HOMING_state | ||||
| 
 | ||||
| ##################################################################### | ||||
| #    Macros | ||||
| ##################################################################### | ||||
| ## conditional home | ||||
| [gcode_macro _CG28] | ||||
| gcode: | ||||
|   {% if "xyz" not in printer.toolhead.homed_axes %} | ||||
|     G28 RESET_SETTINGS={ params.RESET_SETTINGS|default('true') } | ||||
|   {% endif %} | ||||
| 
 | ||||
| [gcode_macro _SET_CURRENT] | ||||
| description: Helper: Set Z-drive motor current | ||||
| variable_last_val: 'CONFIG' | ||||
| gcode: | ||||
|   ###### set default values ##### | ||||
|   {% set default_respond = printer['gcode_macro _USER_VARIABLE'].respond_set_current|int %} | ||||
|   {% set val = params.VAL|default('CONFIG') %} | ||||
|   {% set respond = params.Z_RESPOND|default(default_respond)|int %} | ||||
|   {% if val == 'HOME' %} | ||||
|     {% set xy_run  = printer['gcode_macro _USER_VARIABLE'].xy_home_current %} | ||||
|     {% set xy_hold = printer['gcode_macro _USER_VARIABLE'].xy_home_current %} | ||||
|     {% set z_run  = printer['gcode_macro _USER_VARIABLE'].z_home_current %} | ||||
|     {% set z_hold = printer['gcode_macro _USER_VARIABLE'].z_home_current %} | ||||
|   {% else %} | ||||
|     {% if 'tmc2209 stepper_z' in printer.configfile.settings %} | ||||
|       {% set xy_run  = printer.configfile.settings['tmc2209 stepper_x'].run_current %} | ||||
|       {% set xy_hold = printer.configfile.settings['tmc2209 stepper_x'].hold_current %} | ||||
|       {% set z_run  = printer.configfile.settings['tmc2209 stepper_z'].run_current %} | ||||
|       {% set z_hold = printer.configfile.settings['tmc2209 stepper_z'].hold_current %} | ||||
|     {% elif 'tmc5160 stepper_z' in printer.configfile.settings %} | ||||
|       {% set xy_run  = printer.configfile.settings['tmc5160 stepper_x'].run_current %} | ||||
|       {% set xy_hold = printer.configfile.settings['tmc5160 stepper_x'].hold_current %} | ||||
|       {% set z_run  = printer.configfile.settings['tmc5160 stepper_z'].run_current %} | ||||
|       {% set z_hold = printer.configfile.settings['tmc5160 stepper_z'].hold_current %} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
|   ##### end of definition ##### | ||||
|   {% if val != last_val %} | ||||
|     SET_GCODE_VARIABLE MACRO=_SET_CURRENT VARIABLE=last_val VALUE='"{val}"' | ||||
|     {% if respond == 1 %} | ||||
|       {action_respond_info("Home&Probe: RunCur %.2fA rms HoldCur %.2fA rms" % (z_run|float, z_hold|float))} | ||||
|     {% endif %} | ||||
|     SET_TMC_CURRENT STEPPER=stepper_x  CURRENT={xy_run} HOLDCURRENT={xy_hold} | ||||
|     SET_TMC_CURRENT STEPPER=stepper_y  CURRENT={xy_run} HOLDCURRENT={xy_hold} | ||||
|     SET_TMC_CURRENT STEPPER=stepper_z  CURRENT={z_run} HOLDCURRENT={z_hold} | ||||
|     SET_TMC_CURRENT STEPPER=stepper_z1 CURRENT={z_run} HOLDCURRENT={z_hold} | ||||
|     SET_TMC_CURRENT STEPPER=stepper_z2 CURRENT={z_run} HOLDCURRENT={z_hold} | ||||
|     SET_TMC_CURRENT STEPPER=stepper_z3 CURRENT={z_run} HOLDCURRENT={z_hold} | ||||
|     M400 | ||||
|   {% endif %} | ||||
| 
 | ||||
| [gcode_macro _SET_ACC] | ||||
| description: Helper: Set accel and accel_to_decel value | ||||
| variable_last_val: 'CONFIG' | ||||
| gcode: | ||||
|   ##### set default value ##### | ||||
|   {% set default_respond = printer['gcode_macro _USER_VARIABLE'].respond_set_acc|int %} | ||||
|   {% set val = params.VAL|default('CONFIG') %} | ||||
|   {% set respond = params.RESPOND|default(default_respond)|int %} | ||||
|   {% if val == 'HOME' %} | ||||
|     {% set accel = printer['gcode_macro _USER_VARIABLE'].home_accel %} | ||||
|     {% set accel_to_decel = printer['gcode_macro _USER_VARIABLE'].home_accel|int / 2 %} | ||||
|   {% else %} | ||||
|     {% set accel = printer.configfile.settings.printer.max_accel %} | ||||
|     {% set accel_to_decel = printer.configfile.settings.printer.max_accel_to_decel %} | ||||
|   {% endif %} | ||||
|   ##### end of definition ##### | ||||
|   {% if val != last_val %} | ||||
|     SET_GCODE_VARIABLE MACRO=_SET_ACC VARIABLE=last_val VALUE='"{val}"' | ||||
|     {% if respond == 1 %} | ||||
|       {action_respond_info("VELOCITY_LIMIT set ACCEL: %d ACCEL_TO_DECEL: %d" % (accel|int, accel_to_decel|int))} | ||||
|     {% endif %} | ||||
|     SET_VELOCITY_LIMIT ACCEL={accel} ACCEL_TO_DECEL={accel_to_decel} RESPOND=0 | ||||
|   {% endif %} | ||||
							
								
								
									
										48
									
								
								z_calibration/macros.cfg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										48
									
								
								z_calibration/macros.cfg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,48 @@ | |||
| ##################################################################### | ||||
| #    Macros | ||||
| ##################################################################### | ||||
| [gcode_macro PRINT_START] | ||||
| gcode: | ||||
|     {% set bed_temp = params.BED_TEMP|default(100)|float %} | ||||
|     {% set extruder_temp = params.EXTRUDER_TEMP|default(220)|float %} | ||||
|     {% set z_adjust = params.Z_ADJUST|default(0.0)|float %} | ||||
|     {% set retract = 10 %} | ||||
|     BED_MESH_CLEAR                    ; clear mesh | ||||
|     _CG28                             ; Home the printer | ||||
|     G90                               ; Use absolute coordinates | ||||
|     PARKCENTER                        ; Move to center | ||||
|     M117 Heating.. | ||||
|     _HEATER_ON | ||||
|     M106 S255                         ; set print fan to full speed | ||||
|     M140 S{bed_temp}                  ; Start bed heating | ||||
|     M190 S{bed_temp}                  ; Wait for bed to reach temperature | ||||
|     M109 S{extruder_temp}             ; Set and wait for nozzle to reach temperature | ||||
|     M107                              ; turn print fan off | ||||
|     QUAD_GANTRY_LEVEL PARK=false | ||||
|     M109 S{extruder_temp}             ; Set and wait for nozzle to reach temperature | ||||
|     clean_nozzle                      ; clean nozzle | ||||
|     CALIBRATE_Z | ||||
|     #BED_MESH_PROFILE LOAD=default   ; load mesh if needed | ||||
|     # Adjust the G-Code Z offset with the Z_ADJUST parameter if needed | ||||
|     #SET_GCODE_OFFSET Z_ADJUST={z_adjust} MOVE=1 | ||||
|     M117 Intro Line.. | ||||
|     G90                               ; Use absolute coordinates | ||||
|     G1 Y0 X130 Z5 F12000              ; Move the nozzle to the front and near the bed | ||||
|     G1 Z0.7 F300                      ; Move the nozzle very close to the bed | ||||
|     G92 E0.0                          ; set extruder position to 0 | ||||
|     G1 E{retract} F3600               ; extrude retract | ||||
|     G92 E0.0                          ; set extruder option to 0 | ||||
|     G1 X180 E15.0 F500.0              ; intro line | ||||
|     G92 E0.0                          ; set extruder Poisson to 0 | ||||
|     G1 X174 F6000                     ; move away from intro line | ||||
|     M117 | ||||
| 
 | ||||
| [gcode_macro PARKCENTER] | ||||
| gcode: | ||||
|     {% set Z = params.Z|default(30)|float %} | ||||
|     SAVE_GCODE_STATE NAME=PARKCENTER_state | ||||
|     _CG28                          ; Home if not already homed | ||||
|     G90                            ; absolute positioning | ||||
|     G0 X150 Y150 Z{Z} F12000       ; move to center | ||||
|     RESTORE_GCODE_STATE NAME=PARKCENTER_state | ||||
| 
 | ||||
							
								
								
									
										37
									
								
								z_calibration/printer.cfg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								z_calibration/printer.cfg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,37 @@ | |||
| ##################################################################### | ||||
| #    User Variables | ||||
| ##################################################################### | ||||
| [gcode_macro _USER_VARIABLE] | ||||
| description: Helper: Contains User defined printer variables | ||||
| ##### Homing and general movement ##### | ||||
| variable_z_endstop_x: 208             ; z Endstop x position inside right profile | ||||
| variable_z_endstop_y: 305             ; z Endstop y position | ||||
| variable_z_hop: 10.0                  ; z hop for moves e.g homing | ||||
| variable_xy_home_current: 0.4         ; reduced homing current for x and y | ||||
| variable_z_home_current: 0.3          ; reduced homing current for z | ||||
| variable_home_accel: 1200             ; reduced ACCEL for homing | ||||
| ##### Mag Probe ##### | ||||
| variable_probe_dock_x: 148            ; x toolhead position before docking probe | ||||
| variable_probe_dock_y: 285            ; y toolhead position before docking probe | ||||
| variable_probe_dock_z: 10             ; z toolhead position before docking probe (only for bed dock) | ||||
| variable_probe_undock_x: 200          ; x toolhead position after docking probe | ||||
| variable_probe_undock_y: 305          ; y toolhead position after docking probe | ||||
| variable_probe_undock_z: 10           ; z toolhead position after docking probe (only for bed dock) | ||||
| variable_probe_z_min: 10              ; z minimum height to avoid crash | ||||
| variable_probe_travel_speed: 200      ; dock moves travel speed | ||||
| variable_probe_dock_speed: 100        ; dock speed for attach/dock | ||||
| ##### Respond defaults ##### | ||||
| variable_respond_set_current: 0       ; default of RESPOND if not set in the call | ||||
| variable_respond_set_acc: 0           ; default of RESPOND if not set in the call | ||||
| variable_respond_probe_action: 1      ; default of RESPOND if not set in the call | ||||
| ##### Park Position ##### | ||||
| variable_park_bed: [150,150,30]       ; different park position | ||||
| gcode: | ||||
| 
 | ||||
| ##################################################################### | ||||
| #    Includes | ||||
| ##################################################################### | ||||
| [include macros.cfg] | ||||
| [include homing.cfg] | ||||
| [include probing.cfg] | ||||
| [include z_calibration.cfg] | ||||
							
								
								
									
										567
									
								
								z_calibration/probing.cfg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										567
									
								
								z_calibration/probing.cfg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,567 @@ | |||
| ##################################################################### | ||||
| #    Mag Probe | ||||
| ##################################################################### | ||||
| # defined in printer.cfg | ||||
|    | ||||
| ##################################################################### | ||||
| #    Gantry Adjustment Routines | ||||
| ##################################################################### | ||||
| [quad_gantry_level] | ||||
| ##	Gantry Corners for 300mm Build | ||||
| gantry_corners: | ||||
| 	-60,-10 | ||||
| 	360,370 | ||||
| #	Probe points for 300m Build | ||||
| points: | ||||
| 	50,25 | ||||
| 	50,225 | ||||
| 	250,225 | ||||
| 	250,25 | ||||
| speed: 300 | ||||
| horizontal_move_z: 10 | ||||
| retries: 5 | ||||
| retry_tolerance: 0.007 | ||||
| max_adjust: 10 | ||||
| 
 | ||||
| ##################################################################### | ||||
| #    Macros | ||||
| ##################################################################### | ||||
| [gcode_macro QUAD_GANTRY_LEVEL] | ||||
| description: Level a flying gantry to a stationary bed | ||||
| rename_existing: QUAD_GANTRY_LEVEL_BASE | ||||
| gcode: | ||||
|   #####  get user defines  ##### | ||||
|   {% set park_pos = printer['gcode_macro _USER_VARIABLE'].park_bed %} | ||||
|   {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|float %} | ||||
|   ##### get toolhead position ##### | ||||
|   {% set act_z = printer.toolhead.position.z|float %} | ||||
|   #####  set default  ##### | ||||
|   {% set park = params.PARK|default('true') %} | ||||
|   #####  end of definitions  ##### | ||||
|   # home all axes if not already | ||||
|   {% if "xyz" not in printer.toolhead.homed_axes %} | ||||
|     _CG28 | ||||
|   {% endif %} | ||||
|   SAVE_GCODE_STATE NAME=STATE_QUAD_GANTRY_LEVEL | ||||
|   _SET_ACC VAL=HOME | ||||
|   _SET_CURRENT VAL=HOME | ||||
|   _CG28 RESET_SETTINGS=false | ||||
|   {% if act_z < z_hop %} | ||||
|     G1 Z{z_hop} F900 ; move head up to insure Probe is not triggered in error case | ||||
|   {% endif %} | ||||
|   ATTACH_PROBE  | ||||
|   QUAD_GANTRY_LEVEL_BASE | ||||
|   {% if params.CALIBRATE|default('false') == 'true' %} | ||||
|     CALIBRATE_Z RESET_SETTINGS=false | ||||
|   {% else %} | ||||
|     DETACH_PROBE | ||||
|   {% endif %} | ||||
|   #G28 Z | ||||
|   {% if params.RESET_SETTINGS|default('true') == 'true' %} | ||||
|     _SET_CURRENT | ||||
|     _SET_ACC | ||||
|   {% endif %} | ||||
|   {% if park|lower == 'true' %} | ||||
|     G90 | ||||
|     G0 Z{park_pos[2]} F1800           ; move nozzle to z high first | ||||
|     G0 X{park_pos[0]} Y{park_pos[1]} F18000 ; home to get toolhead in the middle | ||||
|   {% endif %} | ||||
|   RESTORE_GCODE_STATE NAME=STATE_QUAD_GANTRY_LEVEL | ||||
| 
 | ||||
| [gcode_macro ATTACH_PROBE] | ||||
| description: Attaching the MagProbe if not already attached | ||||
| gcode: | ||||
|   _MAG_PROBE ACTION=ATTACH | ||||
|   _MAG_PROBE ACTION=CHECK_ATTACH | ||||
| 
 | ||||
| [gcode_macro DETACH_PROBE] | ||||
| description: Dock the MagProbe if not already docked | ||||
| gcode: | ||||
|   _MAG_PROBE ACTION=DOCK | ||||
|   _MAG_PROBE ACTION=CHECK_DOCK | ||||
|    | ||||
| [gcode_macro GET_PROBE_STATUS] | ||||
| description: Prints the current MagProbe state, valid probe states are UNKNOWN, ATTACHED and DOCKED | ||||
| gcode: | ||||
|   _MAG_PROBE ACTION=GET_STATUS RESPOND=1 | ||||
|    | ||||
| 
 | ||||
| [gcode_macro SET_PROBE_STATUS] | ||||
| description: Manually specify MagProbe status, valid probe states are UNKNOWN, ATTACHED and DOCKED | ||||
| variable_state: 'unknown' | ||||
| gcode: | ||||
|   {% if 'STATE' in params|upper and  | ||||
|         (params.STATE|lower == 'unknown' or params.STATE|lower == 'attached' or params.STATE|lower == 'docked') %} | ||||
|     SET_GCODE_VARIABLE MACRO=SET_PROBE_STATUS VARIABLE=state VALUE='"{params.STATE|lower}"' | ||||
|     SET_GCODE_VARIABLE MACRO=_MAG_PROBE VARIABLE=state VALUE='"{params.STATE|lower}"' | ||||
|   {% else %} | ||||
|     {% set state = params.STATE|default('none') %} | ||||
|     {action_raise_error("Invalid probe state: %s. Valid probe states are [UNKNOWN, ATTACHED, DOCKED]" % state|upper)} | ||||
|   {% endif %} | ||||
|      | ||||
| ##################################################################### | ||||
| #    Helper Macros | ||||
| ##################################################################### | ||||
| # QUERY_PROBE must run direct before _PROBE_ACTION | ||||
| # that relation is insured by the caller id | ||||
| [gcode_macro _MAG_PROBE] | ||||
| description: Helper: Query MagProbe state and request action | ||||
| variable_state: 'unknown' | ||||
| variable_id: 0 | ||||
| gcode: | ||||
|   ##### add RESPOND if specified ##### | ||||
|   {% if 'RESPOND' in params|upper %} | ||||
|     {% set respond = "RESPOND=" + params.RESPOND %} | ||||
|   {% else %} | ||||
|     {% set respond = "" %} | ||||
|   {% endif %} | ||||
|   ##### generate an id not equal to 0 ##### | ||||
|   {% if id == 0 %} | ||||
|     {% set id = 1 %} | ||||
|   {% else %} | ||||
|     {% set id = id + 1 %} | ||||
|   {% endif %} | ||||
|   ##### end of definition ##### | ||||
|   QUERY_PROBE ID={id} | ||||
|   _PROBE_ACTION ACTION={params.ACTION} ID={id} {respond} | ||||
|   SET_GCODE_VARIABLE MACRO=_MAG_PROBE VARIABLE=id VALUE={id} | ||||
|   M400 | ||||
| 
 | ||||
| [gcode_macro _PROBE_ACTION] | ||||
| description: Helper: Perform MagProbe action | ||||
| gcode: | ||||
|   ##### get params and defaults ##### | ||||
|   {% set default_respond = printer['gcode_macro _USER_VARIABLE'].respond_probe_action|default(1)|int %} | ||||
|   {% set respond = params.RESPOND|default(default_respond)|int %} | ||||
|   {% set action = params.ACTION|lower %} | ||||
|   {% set id = params.ID|default(0)|int %} ; call id 0 means invalid | ||||
|   ##### get probe variables ##### | ||||
|   {% set probe_id = printer['gcode_macro QUERY_PROBE'].id|default(0)|int %} | ||||
|   {% set man_state = printer['gcode_macro SET_PROBE_STATUS'].state|lower %} | ||||
|   ##### generate state ##### | ||||
|   {% if man_state != 'unknown' %} | ||||
|     SET_GCODE_VARIABLE MACRO=SET_PROBE_STATUS VARIABLE=state VALUE='"unknown"' | ||||
|     {% set state = man_state %} | ||||
|     {% if respond == 1 %} | ||||
|       {action_respond_info("MagProbe: State was set to %s by SET_PROBE_STATUS"% man_state|upper)} | ||||
|     {% endif %} | ||||
|   {% elif id == 0 or id != probe_id %} | ||||
|     {action_raise_error("MagProbe: Call ID invalid or does not match QUERY_PROBE call ID")} | ||||
|   {% elif printer.probe.last_query|lower == 'false' %} | ||||
|     {action_raise_error("MagProbe: Please execute QUERY_PROBE first")} | ||||
|   {% else %} | ||||
|     {% if printer.probe.last_query|int == 0 %} | ||||
|       {% set state = 'attached' %} | ||||
|     {% else %} | ||||
|       {% set state = 'docked' %} | ||||
|     {% endif %} | ||||
|   {% endif %} | ||||
|   ##### end of defines ##### | ||||
|   SET_GCODE_VARIABLE MACRO=_MAG_PROBE VARIABLE=state VALUE='"{state}"' | ||||
|   {% if action == 'attach' %} | ||||
|     {% if state == 'docked' %} | ||||
|       {% if respond == 1 %} | ||||
|         {action_respond_info("MagProbe: Attach Probe")} | ||||
|       {% endif %} | ||||
|       _ATTACH_PROBE | ||||
|     {% else %} | ||||
|       {% if respond == 1 %} | ||||
|         {action_respond_info("MagProbe: already attached")} | ||||
|       {% endif %} | ||||
|     {% endif %} | ||||
|   {% elif action == 'dock' %} | ||||
|     {% if state == 'attached' %} | ||||
|       {% if respond == 1 %} | ||||
|         {action_respond_info("MagProbe: Dock Probe")} | ||||
|       {% endif %} | ||||
|       _DOCK_PROBE | ||||
|     {% else %} | ||||
|       {% if respond == 1 %} | ||||
|         {action_respond_info("MagProbe: already docked")} | ||||
|       {% endif %} | ||||
|     {% endif %} | ||||
|   {% elif action == 'check_dock' %} | ||||
|     {% if state != 'docked' %} | ||||
|       {action_raise_error("MagProbe: dock failed!")} | ||||
|     {% endif %} | ||||
|   {% elif action == 'check_attach' %} | ||||
|     {% if state != 'attached' %} | ||||
|       {action_raise_error("MagProbe: attach failed!")} | ||||
|     {% endif %} | ||||
|   {% elif action == 'get_status' %} | ||||
|     {% if respond == 1 %} | ||||
|       {action_respond_info("MagProbe Status: %s" % state)} | ||||
|     {% endif %} | ||||
|   {% else %} | ||||
|     {action_raise_error("MagProbe: action not defined")} | ||||
|   {% endif %} | ||||
| 
 | ||||
| [gcode_macro _ATTACH_PROBE] | ||||
| description: Helper: Attach MagProbe | ||||
| gcode: | ||||
|   ##### Get user defines ##### | ||||
|   {% set dock_x = printer['gcode_macro _USER_VARIABLE'].probe_dock_x %} | ||||
|   {% set dock_y = printer['gcode_macro _USER_VARIABLE'].probe_dock_y %} | ||||
|   {% set dock_z = printer['gcode_macro _USER_VARIABLE'].probe_dock_z %} | ||||
|   {% set undock_x = printer['gcode_macro _USER_VARIABLE'].probe_undock_x %} | ||||
|   {% set undock_y = printer['gcode_macro _USER_VARIABLE'].probe_undock_y %} | ||||
|   {% set undock_z = printer['gcode_macro _USER_VARIABLE'].probe_undock_z %} | ||||
|   {% set z_min = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %} | ||||
|   {% set t_speed = printer['gcode_macro _USER_VARIABLE'].probe_travel_speed|float * 60 %} | ||||
|   {% set d_speed = printer['gcode_macro _USER_VARIABLE'].probe_dock_speed|float * 60 %} | ||||
|   ##### get toolhead position ##### | ||||
|   {% set act_z = printer.toolhead.position.z|float %} | ||||
|   ##### end of definitions ##### | ||||
|   SAVE_GCODE_STATE NAME=STATE_ATTACH_PROBE | ||||
|   SET_GCODE_OFFSET Z=0.0                ; reset offset - will be restored | ||||
|   G90                                   ; absolute positioning | ||||
|   {% if act_z < z_min %} | ||||
|     G0 Z{z_min} F1500                   ; move head up | ||||
|   {% endif %} | ||||
| 
 | ||||
|   ################################################################### | ||||
|   #        !!! Caution !!! | ||||
|   # | ||||
|   # Adapt for your needs if needed !! | ||||
|   ################################################################### | ||||
| 
 | ||||
|   ##### Example for a bed dock: | ||||
|   #G0 X{undock_x} Y{undock_y} F{t_speed} ; move to mag-probe | ||||
|   #G0 Z{dock_z} F1500 FORCE              ; move down to probe | ||||
|   #G0 Y{dock_y} F{d_speed}               ; move out of holder | ||||
|   #G0 Z{undock_z} F1500                  ; move head up | ||||
| 
 | ||||
|   ##### Example for a gantry dock: | ||||
|   G0 X{undock_x} Y{undock_y} F{t_speed} ; move next to mag-probe | ||||
|   G0 X{dock_x} F{d_speed}               ; move sideways to attach probe | ||||
|   G0 Y{dock_y} F{d_speed}               ; move out of holder | ||||
| 
 | ||||
|   RESTORE_GCODE_STATE NAME=STATE_ATTACH_PROBE | ||||
| 
 | ||||
| [gcode_macro _DOCK_PROBE] | ||||
| description: Helper: Dock MagProbe | ||||
| gcode: | ||||
|   ##### Get user defines ##### | ||||
|   {% set dock_x = printer['gcode_macro _USER_VARIABLE'].probe_dock_x %} | ||||
|   {% set dock_y = printer['gcode_macro _USER_VARIABLE'].probe_dock_y %} | ||||
|   {% set dock_z = printer['gcode_macro _USER_VARIABLE'].probe_dock_z %} | ||||
|   {% set undock_x = printer['gcode_macro _USER_VARIABLE'].probe_undock_x %} | ||||
|   {% set undock_y = printer['gcode_macro _USER_VARIABLE'].probe_undock_y %} | ||||
|   {% set undock_z = printer['gcode_macro _USER_VARIABLE'].probe_undock_z %} | ||||
|   {% set z_min = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %} | ||||
|   {% set t_speed = printer['gcode_macro _USER_VARIABLE'].probe_travel_speed|float * 60 %} | ||||
|   {% set d_speed = printer['gcode_macro _USER_VARIABLE'].probe_dock_speed|float * 60 %} | ||||
|   ##### get toolhead position ##### | ||||
|   {% set act_z = printer.toolhead.position.z|float %} | ||||
|   ##### end of definitions ##### | ||||
|   SAVE_GCODE_STATE NAME=STATE_DOCK_PROBE | ||||
|   SET_GCODE_OFFSET Z=0.0                ; reset offset - will be restored | ||||
|   G90                                   ; absolute positioning | ||||
|   {% if act_z < z_min %} | ||||
|     G0 Z{z_min} F900                    ; move head up | ||||
|   {% endif %} | ||||
| 
 | ||||
|   ################################################################### | ||||
|   #        !!! Caution !!! | ||||
|   # | ||||
|   # Adapt for your needs if needed !! | ||||
|   ################################################################### | ||||
| 
 | ||||
|   ##### Example for a bed dock: | ||||
|   #G0 X{dock_x} Y{dock_y} F{t_speed}     ; move to mag-probe | ||||
|   #G0 Z{dock_z} F1500 FORCE              ; move down to probe | ||||
|   #G0 Y{undock_y} F{d_speed}             ; move into the holder | ||||
|   #G0 Z{undock_z} F1500                  ; move upwards to remove probe | ||||
| 
 | ||||
|   ##### Example for a gantry dock: | ||||
|   G0 X{dock_x} Y{dock_y} F{t_speed}     ; move in front of mag-probe | ||||
|   G0 Y{undock_y} F{d_speed}             ; move into the holder | ||||
|   G0 X{undock_x} F{d_speed}             ; move sideways to remove probe   | ||||
|    | ||||
|   RESTORE_GCODE_STATE NAME=STATE_DOCK_PROBE | ||||
| 
 | ||||
| ##################################################################### | ||||
| #	Customized standard macros | ||||
| ##################################################################### | ||||
| # | ||||
| #        !!! Caution !!! | ||||
| # | ||||
| # PROBE_CALIBRATE can not dock the Magprobe automatically, as it  | ||||
| # start's a scripting process we need to stop at the execution  | ||||
| # of the base macro. Use  | ||||
| #  - PROBE_ABORT | ||||
| #  - PROBE_ACCEPT | ||||
| # instead of the original ABORT and ACCEPT to also dock the probe | ||||
| # | ||||
| ##################################################################### | ||||
| # | ||||
| # If your probe needs a Z move for attach/detach use either | ||||
| #   G0 .... FORCE | ||||
| #   G1 .... FORCE | ||||
| # | ||||
| ##################################################################### | ||||
| [gcode_macro G0] | ||||
| description: Move gcode that prevents moves lower than the limit when probe attached | ||||
| rename_existing: G0.1 | ||||
| gcode: | ||||
|   ##### set manual override ##### | ||||
|   {% if 'FORCE' in params|upper %} | ||||
|     {% set force = 1 %} | ||||
|   {% else %} | ||||
|     {% set force = 0 %} | ||||
|   {% endif %} | ||||
|   ##### get params ##### | ||||
|   {% set get_params = [] %} | ||||
|   {% for key in params %} | ||||
|     {% if key is not in ['G', 'FORCE'] %} ;G1/G0 is also seen as parameter | ||||
|       {% set get_params = get_params.append(key + "=" + params[key])  %} | ||||
|     {% endif %} | ||||
|   {% endfor %} | ||||
|   ##### add caller ##### | ||||
|   {% set tmp = get_params.append("CALLER=G0") %} ;hack to append list objects outside of a loop | ||||
|   ##### add force ##### | ||||
|   {% set tmp = get_params.append("FORCE=" + force|string) %} ;hack to append list objects outside of a loop | ||||
|   ##### end of definition ##### | ||||
|   {% if printer['gcode_macro _MAG_PROBE'].state|lower == 'unknown' and force == 0 %} | ||||
|     _MAG_PROBE ACTION=GET_STATUS RESPOND=0 | ||||
|   {% endif %} | ||||
|   _Z_MOVE_CHECK {get_params|join(" ")} | ||||
| 
 | ||||
| [gcode_macro G1] | ||||
| description: Move gcode that prevents moves lower than the limit when probe attached | ||||
| rename_existing: G1.1 | ||||
| gcode: | ||||
|   ##### set manual override ##### | ||||
|   {% if 'FORCE' in params|upper %} | ||||
|     {% set force = 1 %} | ||||
|   {% else %} | ||||
|     {% set force = 0 %} | ||||
|   {% endif %} | ||||
|   ##### get params ##### | ||||
|   {% set get_params = [] %} | ||||
|   {% for key in params %} | ||||
|     {% if key is not in ['G', 'FORCE'] %} ;G1/G0 is also seen as parameter | ||||
|       {% set get_params = get_params.append(key + "=" + params[key])  %} | ||||
|     {% endif %} | ||||
|   {% endfor %} | ||||
|   ##### add caller ##### | ||||
|   {% set tmp = get_params.append("CALLER=G1") %} ;hack to append list objects outside of a loop | ||||
|   ##### add force ##### | ||||
|   {% set tmp = get_params.append("FORCE=" + force|string) %} ;hack to append list objects outside of a loop | ||||
|   ##### end of definition ##### | ||||
|   {% if printer['gcode_macro _MAG_PROBE'].state|lower == 'unknown' and force == 0 %} | ||||
|     _MAG_PROBE ACTION=GET_STATUS RESPOND=0 | ||||
|   {% endif %} | ||||
|   _Z_MOVE_CHECK {get_params|join(" ")} | ||||
|    | ||||
| [gcode_macro _Z_MOVE_CHECK] | ||||
| description: Helper: Check limit and perform move | ||||
| gcode: | ||||
|   ##### define defaults ###### | ||||
|   {% set caller = params.CALLER|default('G0')|upper %} | ||||
|   {% set force = params.FORCE|default(0)|int %} | ||||
|   ##### z values ##### | ||||
|   {% set z_min = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %} | ||||
|   {% set z_act = printer.toolhead.position.z|float %} | ||||
|   ##### MagProbe state ##### | ||||
|   {% set probe_state = printer['gcode_macro _MAG_PROBE'].state|lower %} | ||||
|   ##### get params and prepare to send them to the base macro ##### | ||||
|   {% set get_params = [] %} | ||||
|   {% for key in params %} | ||||
|     {% if key is not in ['Z', 'CALLER', 'FORCE'] %} | ||||
|       {% set get_params = get_params.append(key + params[key]) %} | ||||
|     {% elif key is in ['Z'] %} | ||||
|       {% if force == 1 %} ;manual override of probe check | ||||
|         {% set get_params = get_params.append(key + params[key]) %} | ||||
|       {% elif probe_state ==  'unknown' %} | ||||
|         {action_raise_error("%s: MagProbe state %s run \"_MAG_PROBE ACTION=GET_STATUS\"" % (caller, probe_state|upper))} | ||||
|       {% elif probe_state ==  'docked' %} | ||||
|         {% set get_params = get_params.append(key + params[key]) %} | ||||
|       {% elif probe_state ==  'attached' %} | ||||
|         ##### define move target position depending on absolute_coordinates ##### | ||||
|         {% if printer.gcode_move.absolute_coordinates|lower == 'true' %} | ||||
|           {% set z_target = params.Z|float %} | ||||
|         {% else %} | ||||
|           {% set z_target = z_act + params.Z|float %} | ||||
|         {% endif %} | ||||
|         ##### decide if a Z move can be executed ##### | ||||
|         {% if z_target > z_min or z_act < z_target %} | ||||
|           {% set get_params = get_params.append(key + params[key]) %}               | ||||
|         {% else %} | ||||
|           {action_respond_info("%s: Z Moves lower than %.1fmm not allowed with installed probe" % (caller,z_min))}   | ||||
|         {% endif %} | ||||
|       {% else %} | ||||
|         {action_raise_error("%s: MagProbe state %s not valid" % (caller, probe_state|upper))} | ||||
|       {% endif %} | ||||
|     {% endif %} | ||||
|   {% endfor %} | ||||
|   ##### end of definitions ##### | ||||
|   {caller}.1 {get_params|join(" ")} | ||||
| 
 | ||||
| [gcode_macro QUERY_PROBE] | ||||
| description: Return the status of the z-probe and store ID | ||||
| rename_existing: QUERY_PROBE_BASE | ||||
| variable_id: 0 | ||||
| gcode: | ||||
|   {% set id = params.ID|default(0) %} ; call id 0 means invalid | ||||
|   QUERY_PROBE_BASE | ||||
|   SET_GCODE_VARIABLE MACRO=QUERY_PROBE VARIABLE=id VALUE={id} | ||||
| 
 | ||||
| [gcode_macro PROBE_ACCURACY] | ||||
| description: Probe Z-height accuracy at current XY position and dock/undock MagProbe | ||||
| rename_existing: PROBE_ACCURACY_BASE | ||||
| gcode: | ||||
|   #####  get new parameter. ##### | ||||
|   {% set dock = params.DOCK|default(1)|int %} ; use DOCK=0 to omit the probe docking | ||||
|   ##### get user defines  ##### | ||||
|   {% set z_min = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %} | ||||
|   {% set t_speed = printer['gcode_macro _USER_VARIABLE'].probe_travel_speed|float * 60 %} | ||||
|   ##### get toolhead parameters ##### | ||||
|   {% set act_z = printer.gcode_move.gcode_position.z|float %} | ||||
|   {% set absolute_coordinates = printer.gcode_move.absolute_coordinates|lower %} | ||||
|   ##### get params and prepare to send them to the base macro ##### | ||||
|   {% set get_params = [] %} | ||||
|   {% for key in params %} | ||||
|     {% set get_params = get_params.append(key + "=" + params[key])  %} | ||||
|   {% endfor %} | ||||
|   ##### end of definitions ##### | ||||
|   # as we need to return to the position with the probe we need to be at least at z_min | ||||
|   G90 ; absolute positioning | ||||
|   {% if act_z < z_min %} | ||||
|     {action_respond_info("PROBE_ACCURACY: High must be above %.2f" % z_min)} | ||||
|     G1 Z{z_min} F900 ; move head up | ||||
|   {% endif %} | ||||
|   M400 ; get the buffer cleared first | ||||
|   SAVE_GCODE_STATE NAME=STATE_PROBE_ACCURACY | ||||
|   ATTACH_PROBE | ||||
|   RESTORE_GCODE_STATE NAME=STATE_PROBE_ACCURACY MOVE=1 MOVE_SPEED={t_speed} | ||||
|   PROBE_ACCURACY_BASE {get_params|join(" ")} | ||||
|   {% if dock == 1 %} | ||||
|     DETACH_PROBE | ||||
|     RESTORE_GCODE_STATE NAME=STATE_PROBE_ACCURACY MOVE=1 MOVE_SPEED={t_speed} | ||||
|   {% endif %} | ||||
|   {% if absolute_coordinates == 'false' %} G91 {% endif %} | ||||
|    | ||||
| [gcode_macro PROBE] | ||||
| description: Probe Z-height at current XY position and dock/undock MagProbe | ||||
| rename_existing: PROBE_BASE | ||||
| gcode: | ||||
|   #####  get new parameter. ##### | ||||
|   {% set dock = params.DOCK|default(1)|int %} ; use DOCK=0 to omit the probe docking | ||||
|   ##### get user defines  ##### | ||||
|   {% set z_min = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %} | ||||
|   {% set t_speed = printer['gcode_macro _USER_VARIABLE'].probe_travel_speed|float * 60 %} | ||||
|   ##### get toolhead parameters ##### | ||||
|   {% set act_z = printer.gcode_move.gcode_position.z|float %} | ||||
|   {% set absolute_coordinates = printer.gcode_move.absolute_coordinates|lower %} | ||||
|   ##### get params and prepare to send them to the base macro ##### | ||||
|   {% set get_params = [] %} | ||||
|   {% for key in params %} | ||||
|     {% set get_params = get_params.append(key + "=" + params[key])  %} | ||||
|   {% endfor %} | ||||
|   ##### end of definitions ##### | ||||
|   # as we need to return to the position with the probe we need to be at least at z_min | ||||
|   G90 ; absolute positioning | ||||
|   {% if act_z < z_min %} | ||||
|     {action_respond_info("PROBE: High must be above %.2f" % z_min)} | ||||
|     G1 Z{z_min} F900 ; move head up | ||||
|   {% endif %} | ||||
|   M400 ; get the buffer cleared first | ||||
|   SAVE_GCODE_STATE NAME=STATE_PROBE | ||||
|   ATTACH_PROBE | ||||
|   RESTORE_GCODE_STATE NAME=STATE_PROBE MOVE=1 MOVE_SPEED={t_speed} | ||||
|   PROBE_BASE {get_params|join(" ")} | ||||
|   G1 Z{z_min} F900 ; move head up to remove trigger | ||||
|   {% if dock == 1 %} | ||||
|     DETACH_PROBE | ||||
|     RESTORE_GCODE_STATE NAME=STATE_PROBE MOVE=1 MOVE_SPEED={t_speed} | ||||
|   {% endif %} | ||||
|   {% if absolute_coordinates == 'false' %} G91 {% endif %} | ||||
|    | ||||
| [gcode_macro PROBE_CALIBRATE] | ||||
| description: Calibrate the probes z_offset and undock MagProbe | ||||
| rename_existing: PROBE_CALIBRATE_BASE | ||||
| gcode: | ||||
|   ##### get user defines  ##### | ||||
|   {% set z_min = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %} | ||||
|   {% set t_speed = printer['gcode_macro _USER_VARIABLE'].probe_travel_speed|float * 60 %} | ||||
|   ##### get toolhead parameters ##### | ||||
|   {% set act_z = printer.gcode_move.gcode_position.z|float %} | ||||
|   {% set absolute_coordinates = printer.gcode_move.absolute_coordinates|lower %} | ||||
|   ##### get params and prepare to send them to the base macro ##### | ||||
|   {% set get_params = [] %} | ||||
|   {% for key in params %} | ||||
|     {% set get_params = get_params.append(key + "=" + params[key])  %} | ||||
|   {% endfor %} | ||||
|   ##### end of definitions ##### | ||||
|   # as we need to return to the position with the probe we need to be at least at z_min | ||||
|   G90 ; absolute positioning | ||||
|   {% if act_z < z_min %} | ||||
|     {action_respond_info("PROBE_CALIBRATE: High must be above %.2f" % z_min)} | ||||
|     G1 Z{z_min} F900 ; move head up | ||||
|   {% endif %} | ||||
|   M400 ; get the buffer cleared first | ||||
|   SAVE_GCODE_STATE NAME=STATE_PROBE_CALIBRATE | ||||
|   ATTACH_PROBE | ||||
|   RESTORE_GCODE_STATE NAME=STATE_PROBE_CALIBRATE MOVE=1 MOVE_SPEED={t_speed} | ||||
|   SET_GCODE_VARIABLE MACRO=PROBE_ABORT VARIABLE=caller VALUE='"calib"' | ||||
|   SET_GCODE_VARIABLE MACRO=PROBE_ABORT VARIABLE=absolute_coordinates VALUE='"{absolute_coordinates}"' | ||||
|   PROBE_CALIBRATE_BASE {get_params|join(" ")} | ||||
|    | ||||
| [gcode_macro BED_MESH_CALIBRATE] | ||||
| description: Perform QGL and bed mesh leveling | ||||
| rename_existing: BED_MESH_CALIBRATE_BASE | ||||
| gcode: | ||||
|   ##### get params and prepare to send them to the base macro ##### | ||||
|   {% set get_params = [] %} | ||||
|   {% for key in params %} | ||||
|     {% set get_params = get_params.append(key + "=" + params[key])  %} | ||||
|   {% endfor %} | ||||
|   ##### end of definitions ##### | ||||
|   _CG28 | ||||
|   BED_MESH_CLEAR | ||||
|   ## check if QGL was already executed | ||||
|   {% if printer.quad_gantry_level.applied|lower == 'false' %} | ||||
|     QUAD_GANTRY_LEVEL PARK=false | ||||
|   {% endif %} | ||||
|   ATTACH_PROBE | ||||
|   BED_MESH_CALIBRATE_BASE {get_params|join(" ")} | ||||
|   DETACH_PROBE | ||||
| 
 | ||||
| [gcode_macro PROBE_ABORT] | ||||
| description: Abort manual Z probing tool for Probe and dock MagProbe | ||||
| variable_caller: 'unknown' | ||||
| variable_absolute_coordinates: False | ||||
| gcode: | ||||
|   ##### get user defines  ##### | ||||
|   {% set t_speed = printer['gcode_macro _USER_VARIABLE'].probe_travel_speed|float * 60 %} | ||||
|   ##### end of definitions ##### | ||||
|   {% if caller|lower|string == 'calib' %} | ||||
|     ABORT | ||||
|     DETACH_PROBE | ||||
|     RESTORE_GCODE_STATE NAME=STATE_PROBE_CALIBRATE MOVE=1 MOVE_SPEED={t_speed} | ||||
|     {% if absolute_coordinates == 'false' %} G91 {% endif %} | ||||
|       SET_GCODE_VARIABLE MACRO=PROBE_ABORT VARIABLE=caller VALUE='"unknown"' | ||||
|   {% else %} | ||||
|     {action_respond_info("PROBE_ABORT: Executed while PROBE_CALIBRATE is not running")} | ||||
|   {% endif %} | ||||
| 
 | ||||
| [gcode_macro PROBE_ACCEPT] | ||||
| description: Accept the current Z position for Probe and dock MagProbe | ||||
| gcode: | ||||
|   #####  get variables from ABORT  ##### | ||||
|   {% set caller = printer['gcode_macro PROBE_ABORT'].caller %} | ||||
|   {% set absolute_coordinates = printer['gcode_macro PROBE_ABORT'].absolute_coordinates %} | ||||
|   ##### get user defines  ##### | ||||
|   {% set t_speed = printer['gcode_macro _USER_VARIABLE'].probe_travel_speed|float * 60 %} | ||||
|   ##### end of definitions ##### | ||||
|   {% if caller|lower|string == 'calib' %} | ||||
|     ACCEPT | ||||
|     DETACH_PROBE | ||||
|     RESTORE_GCODE_STATE NAME=STATE_PROBE_CALIBRATE MOVE=1 MOVE_SPEED={t_speed} | ||||
|     {% if absolute_coordinates == 'false' %} G91 {% endif %} | ||||
|       SET_GCODE_VARIABLE MACRO=PROBE_ABORT VARIABLE=caller VALUE='"unknown"' | ||||
|   {% else %} | ||||
|     {action_respond_info("PROBE_ACCEPT: Executed while PROBE_CALIBRATE is not running")} | ||||
|   {% endif %} | ||||
| 
 | ||||
							
								
								
									
										127
									
								
								z_calibration/z_calibration.cfg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								z_calibration/z_calibration.cfg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,127 @@ | |||
| ##################################################################### | ||||
| #    Z Calibration | ||||
| ##################################################################### | ||||
| [z_calibration] | ||||
| #   The X and Y coordinates (in mm) for clicking the nozzle on the | ||||
| #   Z endstop. | ||||
| probe_nozzle_x: 208 | ||||
| probe_nozzle_y: 305 | ||||
| #   The X and Y coordinates (in mm) for clicking the probe's switch | ||||
| #   on the Z endstop. | ||||
| probe_switch_x: 201 | ||||
| probe_switch_y: 284 | ||||
| #   The X and Y coordinates (in mm) for probing on the print surface | ||||
| #   (e.g. the center point) These coordinates will be adapted by the | ||||
| #   probe's X and Y offsets. The default is the relative_reference_index | ||||
| #   of the configured bed_mesh. It will raise an error if there is no | ||||
| #   probe_bed site and no bed_mesh with a relative_reference_index | ||||
| #   configured. | ||||
| probe_bed_x: 150 | ||||
| probe_bed_y: 150 | ||||
| #   The trigger point offset of the used mag-probe switch. | ||||
| #   This needs to be fined out manually. More on this later | ||||
| #   in this section.. | ||||
| switch_offset: 0.42 | ||||
| #   The maximum allowed deviation of the calculated offset. | ||||
| #   If the offset exceeds this value, it will stop! | ||||
| #   The default is 1.0 mm. | ||||
| max_deviation: 1.5 | ||||
| #   The number of times to probe each point. The probed z-values | ||||
| #   will be averaged. The default is from the probe's configuration. | ||||
| #samples: default from "probe:samples" section | ||||
| #   The maximum Z distance (in mm) that a sample may differ from other | ||||
| #   samples. The default is from the probe's configuration. | ||||
| #samples_tolerance: default from "probe:samples_tolerance" section | ||||
| #   The number of times to retry if a sample is found that exceeds | ||||
| #   samples_tolerance. The default is from the probe's configuration. | ||||
| #samples_tolerance_retries: default from "probe:samples_tolerance_retries" section | ||||
| #   The calculation method when sampling more than once - either | ||||
| #   "median" or "average". The default is from the probe's configuration. | ||||
| #samples_result: default from "probe:samples_result" section | ||||
| #   The distance in mm to move up before moving to the next | ||||
| #   position. The default is two times the z_offset from the probe's | ||||
| #   configuration. | ||||
| clearance: 7.5 | ||||
| #position_min: default from "stepper_z:position_min" section. | ||||
| #   The moving speed in X and Y. The default is 50 mm/s. | ||||
| speed: 200 | ||||
| #   Speed (in mm/s) of the Z axis when lifting the probe between | ||||
| #   samples and clearance moves. The default is from the probe's | ||||
| #   configuration. | ||||
| #lift_speed: default from "probe:lift_speed" section | ||||
| #   The fast probing speed (in mm/s) used, when probing_first_fast | ||||
| #   is activated. The default is from the Z rail configuration. | ||||
| #probing_speed: default from "stepper_z:homing_speed" section. | ||||
| #   The slower speed (in mm/s) for probing the recorded samples. | ||||
| #   The default is second_homing_speed of the Z rail configuration. | ||||
| #probing_second_speed: default from "stepper_z:second_homing_speed" section. | ||||
| #   Distance to back off (in mm) before probing the next sample. | ||||
| #   The default is homing_retract_dist from the Z rail configuration. | ||||
| #probing_retract_dist: default from "stepper_z:homing_retract_dist" section. | ||||
| #   If true, the first probing is done faster by the probing speed. | ||||
| #   This is to get faster down and the result is not recorded as a | ||||
| #   probing sample. The default is false. | ||||
| probing_first_fast: true | ||||
| #   If true, the first probing is done faster by the probing speed. | ||||
| #   This is to get faster down and the result is not recorded as a | ||||
| #   probing sample. The default is false. | ||||
| start_gcode: DETACH_PROBE | ||||
| #   A list of G-Code commands to execute prior to each calibration command. | ||||
| #   See docs/Command_Templates.md for G-Code format. This can be used to | ||||
| #   attach the probe. | ||||
| before_switch_gcode: ATTACH_PROBE | ||||
| #   A list of G-Code commands to execute prior to each probing on the | ||||
| #   mag-probe. See docs/Command_Templates.md for G-Code format. This can be | ||||
| #   used to attach the probe after probing on the nozzle and before probing | ||||
| #   on the mag-probe. | ||||
| end_gcode: DETACH_PROBE | ||||
| #   A list of G-Code commands to execute after each calibration command. | ||||
| #   See docs/Command_Templates.md for G-Code format. This can be used to | ||||
| #   detach the probe afterwards. | ||||
| 
 | ||||
| ##################################################################### | ||||
| ## With these settings, the probe is attached after probing the nozzle | ||||
| ## and before probing the switch !! | ||||
| ##################################################################### | ||||
| ## Otherwise, starting with the probe attached would be like this: | ||||
| start_gcode: ATTACH_PROBE | ||||
| #before_switch_gcode: ATTACH_PROBE | ||||
| end_gcode: DETACH_PROBE | ||||
| ##################################################################### | ||||
| 
 | ||||
| ##################################################################### | ||||
| #    Macros | ||||
| ##################################################################### | ||||
| 
 | ||||
| ################################################################### | ||||
| #        !!! Caution !!! | ||||
| # | ||||
| # This Macro is only needed if not using the start/end_gcode | ||||
| # properties to attach/detach the probe | ||||
| ################################################################### | ||||
| [gcode_macro CALIBRATE_Z] | ||||
| description: Automatically calibrates the nozzles offset to the print surface and dock/undock MagProbe  | ||||
| rename_existing: CALIBRATE_Z_BASE | ||||
| gcode: | ||||
|   ##### get user defines  ##### | ||||
|   {% set z_hop = printer['gcode_macro _USER_VARIABLE'].probe_z_min|float %} | ||||
|   ##### get toolhead parameters ##### | ||||
|   {% set act_z = printer.gcode_move.gcode_position.z|float %} | ||||
|   #### end of definitions ##### | ||||
|   ## reduce current of motors | ||||
|   _SET_ACC VAL=HOME | ||||
|   _SET_CURRENT VAL=HOME | ||||
|   _CG28 RESET_SETTINGS=false | ||||
|   {% if act_z < z_hop %} | ||||
|     G90 ; absolute positioning | ||||
|     {action_respond_info("CALIBRATE_Z: High must be above %.2f" % z_hop)} | ||||
|     G1 Z{z_hop} F900 ; move head up | ||||
|   {% endif %} | ||||
|   #ATTACH_PROBE | ||||
|   CALIBRATE_Z_BASE | ||||
|   #DETACH_PROBE  | ||||
|   {% if params.RESET_SETTINGS|default('true') == 'true' %} | ||||
|     ## return to org current settings | ||||
|     _SET_CURRENT | ||||
|     _SET_ACC | ||||
|   {% endif %} | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue