macros: fix pause/resume, add load/unload
This commit is contained in:
		
							parent
							
								
									752733b175
								
							
						
					
					
						commit
						685139afc7
					
				
					 1 changed files with 71 additions and 64 deletions
				
			
		
							
								
								
									
										113
									
								
								macros/print.cfg
									
										
									
									
									
								
							
							
						
						
									
										113
									
								
								macros/print.cfg
									
										
									
									
									
								
							| 
						 | 
					@ -2,12 +2,16 @@
 | 
				
			||||||
# Macros used for printing
 | 
					# Macros used for printing
 | 
				
			||||||
# - BRUSHIE
 | 
					# - BRUSHIE
 | 
				
			||||||
# - CANCEL_PRINT
 | 
					# - CANCEL_PRINT
 | 
				
			||||||
 | 
					# - LOAD_FILAMENT
 | 
				
			||||||
 | 
					# - UNLOAD_FILAMENT
 | 
				
			||||||
# - M600
 | 
					# - M600
 | 
				
			||||||
 | 
					# - M601
 | 
				
			||||||
# - M900
 | 
					# - M900
 | 
				
			||||||
# - PARK
 | 
					# - PARK
 | 
				
			||||||
# - PAUSE
 | 
					# - PAUSE
 | 
				
			||||||
# - PRINT_START
 | 
					# - PRINT_START
 | 
				
			||||||
# - PRINT_END
 | 
					# - PRINT_END
 | 
				
			||||||
 | 
					# - PRINT_LAYER_CHANGE
 | 
				
			||||||
# - PURGE_NOZZLE
 | 
					# - PURGE_NOZZLE
 | 
				
			||||||
# - RESUME
 | 
					# - RESUME
 | 
				
			||||||
####################################################################
 | 
					####################################################################
 | 
				
			||||||
| 
						 | 
					@ -18,7 +22,7 @@
 | 
				
			||||||
gcode:
 | 
					gcode:
 | 
				
			||||||
  {% set x0=250 %}
 | 
					  {% set x0=250 %}
 | 
				
			||||||
  {% set x1=200 %}
 | 
					  {% set x1=200 %}
 | 
				
			||||||
  {% set y0=309.5 %}
 | 
					  {% set y0=308 %}
 | 
				
			||||||
  {% set z0=1.0 %}
 | 
					  {% set z0=1.0 %}
 | 
				
			||||||
  {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %}
 | 
					  {% set z_hop = printer['gcode_macro _USER_VARIABLE'].z_hop|int %}
 | 
				
			||||||
  {% if "xyz" in printer.toolhead.homed_axes %}
 | 
					  {% if "xyz" in printer.toolhead.homed_axes %}
 | 
				
			||||||
| 
						 | 
					@ -30,7 +34,7 @@ gcode:
 | 
				
			||||||
    G0 X{x1}                    # 3
 | 
					    G0 X{x1}                    # 3
 | 
				
			||||||
    G0 Z{z_hop} F300            # move Z to travel height
 | 
					    G0 Z{z_hop} F300            # move Z to travel height
 | 
				
			||||||
  {% else %}
 | 
					  {% else %}
 | 
				
			||||||
    M118 Printer not homed
 | 
					    M118 printer not homed
 | 
				
			||||||
  {% endif %}
 | 
					  {% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,14 +51,29 @@ gcode:
 | 
				
			||||||
  _CANCEL_PRINT_BASE
 | 
					  _CANCEL_PRINT_BASE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[gcode_macro LOAD_FILAMENT]
 | 
				
			||||||
 | 
					gcode:
 | 
				
			||||||
 | 
					  T0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[gcode_macro UNLOAD_FILAMENT]
 | 
				
			||||||
 | 
					gcode:
 | 
				
			||||||
 | 
					  ERCF_EJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[gcode_macro M600]
 | 
					[gcode_macro M600]
 | 
				
			||||||
description: Change filament
 | 
					description: Change filament
 | 
				
			||||||
gcode:
 | 
					gcode:
 | 
				
			||||||
  SAVE_GCODE_STATE NAME=M600_state
 | 
					  SAVE_GCODE_STATE NAME=M600_state
 | 
				
			||||||
  PAUSE Y=15
 | 
					  PAUSE
 | 
				
			||||||
  M118 M600 change filament
 | 
					  M118 M600 change filament
 | 
				
			||||||
  RESTORE_GCODE_STATE NAME=M600_state
 | 
					  RESTORE_GCODE_STATE NAME=M600_state
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[gcode_macro M601]
 | 
				
			||||||
 | 
					description: Pause print
 | 
				
			||||||
 | 
					gcode:
 | 
				
			||||||
 | 
					  PAUSE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[gcode_macro M900]
 | 
					[gcode_macro M900]
 | 
				
			||||||
description: Set pressure advance
 | 
					description: Set pressure advance
 | 
				
			||||||
gcode:
 | 
					gcode:
 | 
				
			||||||
| 
						 | 
					@ -85,30 +104,38 @@ gcode:
 | 
				
			||||||
    G90
 | 
					    G90
 | 
				
			||||||
    G0 X{x_park} Y{y_park} F6000
 | 
					    G0 X{x_park} Y{y_park} F6000
 | 
				
			||||||
  {% else %}
 | 
					  {% else %}
 | 
				
			||||||
    M118 Printer not homed
 | 
					    M118 printer not homed
 | 
				
			||||||
  {% endif %}
 | 
					  {% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# - PAUSE
 | 
					# - PAUSE
 | 
				
			||||||
[gcode_macro PAUSE]
 | 
					[gcode_macro PAUSE]
 | 
				
			||||||
description: Pause the actual running print
 | 
					 | 
				
			||||||
rename_existing: _PAUSE_BASE
 | 
					rename_existing: _PAUSE_BASE
 | 
				
			||||||
# change this if you need more or less extrusion
 | 
					 | 
				
			||||||
variable_extrude: 1.0
 | 
					 | 
				
			||||||
gcode:
 | 
					gcode:
 | 
				
			||||||
  {% set YMIN = printer.toolhead.axis_minimum.y|float + 5.0 %}
 | 
					  {% if printer.pause_resume.is_paused|lower == 'false' %}
 | 
				
			||||||
  {% set Y=params.Y|default(YMIN) %}
 | 
					    {% set x_park = printer.toolhead.axis_minimum.x|float + 5.0 %}
 | 
				
			||||||
  # read E from pause macro
 | 
					    {% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
 | 
				
			||||||
  {% set E = printer["gcode_macro PAUSE"].extrude|float %}
 | 
					    {% set max_z = printer.toolhead.axis_maximum.z|float %}
 | 
				
			||||||
  # end of definitions
 | 
					    {% set act_z = printer.toolhead.position.z|float %}
 | 
				
			||||||
  M118 pause
 | 
					    {% if act_z < (max_z - 5.0) %}
 | 
				
			||||||
  _PAUSE_BASE
 | 
					        {% set z_safe = 5.0 %}
 | 
				
			||||||
  {% if printer.extruder.can_extrude|lower == 'true' %}
 | 
					 | 
				
			||||||
    G91
 | 
					 | 
				
			||||||
    G1 E-{E} F2100
 | 
					 | 
				
			||||||
    G90
 | 
					 | 
				
			||||||
    {% else %}
 | 
					    {% else %}
 | 
				
			||||||
    M118 Extruder not hot enough
 | 
					        {% set z_safe = max_z - act_z %}
 | 
				
			||||||
 | 
					    {% endif %}
 | 
				
			||||||
 | 
					    G92 E0
 | 
				
			||||||
 | 
					    {% if printer.extruder.can_extrude %}
 | 
				
			||||||
 | 
					      G1 E-1.0 F1500.0
 | 
				
			||||||
 | 
					    {% endif %}
 | 
				
			||||||
 | 
					    G90
 | 
				
			||||||
 | 
					    SAVE_GCODE_STATE NAME=PAUSE_state
 | 
				
			||||||
 | 
					    _PAUSE_BASE
 | 
				
			||||||
 | 
					    G91
 | 
				
			||||||
 | 
					    G1 Z{z_safe} F900
 | 
				
			||||||
 | 
					    G90
 | 
				
			||||||
 | 
					    G0 X{x_park} Y{y_park} F6000
 | 
				
			||||||
 | 
					  {% else %}
 | 
				
			||||||
 | 
					    M117 already paused
 | 
				
			||||||
 | 
					    M118 already paused
 | 
				
			||||||
  {% endif %}
 | 
					  {% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -135,24 +162,15 @@ gcode:
 | 
				
			||||||
  M83                     # use relative distances for extrusion
 | 
					  M83                     # use relative distances for extrusion
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  BED_MESH_CLEAR
 | 
					  BED_MESH_CLEAR
 | 
				
			||||||
  {% if not "xyz" in printer.toolhead.homed_axes %}
 | 
					  # HOME
 | 
				
			||||||
  M117 HOME
 | 
					  M117 HOME
 | 
				
			||||||
  M118 HOME
 | 
					  M118 HOME
 | 
				
			||||||
  G28
 | 
					  G28
 | 
				
			||||||
  {% else %}
 | 
					  # QGL
 | 
				
			||||||
    M117 NO HOME
 | 
					 | 
				
			||||||
    M118 NO HOME
 | 
					 | 
				
			||||||
  {% endif %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  {% if printer.quad_gantry_level.applied|lower == 'false' %}
 | 
					 | 
				
			||||||
  M117 QGL
 | 
					  M117 QGL
 | 
				
			||||||
  M118 QGL
 | 
					  M118 QGL
 | 
				
			||||||
  QUAD_GANTRY_LEVEL PARK=false
 | 
					  QUAD_GANTRY_LEVEL PARK=false
 | 
				
			||||||
  {% else %}
 | 
					  # BMC
 | 
				
			||||||
    M117 NO QGL
 | 
					 | 
				
			||||||
    M118 NO QGL
 | 
					 | 
				
			||||||
  {% endif %}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  {% if BMC %}
 | 
					  {% if BMC %}
 | 
				
			||||||
    M117 BED MESH CALIBRATE
 | 
					    M117 BED MESH CALIBRATE
 | 
				
			||||||
    M118 BED MESH CALIBRATE
 | 
					    M118 BED MESH CALIBRATE
 | 
				
			||||||
| 
						 | 
					@ -162,10 +180,10 @@ gcode:
 | 
				
			||||||
    M118 BED MESH LOAD {SHEET}
 | 
					    M118 BED MESH LOAD {SHEET}
 | 
				
			||||||
    BED_MESH_PROFILE LOAD={SHEET}
 | 
					    BED_MESH_PROFILE LOAD={SHEET}
 | 
				
			||||||
  {% endif %}
 | 
					  {% endif %}
 | 
				
			||||||
 | 
					  # CALIBRATE_Z
 | 
				
			||||||
  M117 CALIBRATE_Z
 | 
					  M117 CALIBRATE_Z
 | 
				
			||||||
  M118 CALIBRATE_Z
 | 
					  M118 CALIBRATE_Z
 | 
				
			||||||
  G28 Z
 | 
					  # G28 Z # irrelevant?
 | 
				
			||||||
  BRUSHIE
 | 
					  BRUSHIE
 | 
				
			||||||
  CALIBRATE_Z
 | 
					  CALIBRATE_Z
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -230,33 +248,22 @@ gcode:
 | 
				
			||||||
description: Resume the actual running print
 | 
					description: Resume the actual running print
 | 
				
			||||||
rename_existing: _RESUME_BASE
 | 
					rename_existing: _RESUME_BASE
 | 
				
			||||||
gcode:
 | 
					gcode:
 | 
				
			||||||
  {% if printer["gcode_macro ERCF_PAUSE"].is_paused|int != 0 %}
 | 
					    {% if printer.pause_resume.is_paused|lower == 'true' %}
 | 
				
			||||||
 | 
					      {% if printer["gcode_macro _ERCF_PAUSE"].is_paused|int != 0 %}
 | 
				
			||||||
          M118 You can't resume the print without unlocking the ERCF first.
 | 
					          M118 You can't resume the print without unlocking the ERCF first.
 | 
				
			||||||
          M118 Run ERCF_UNLOCK and solve any issue before hitting Resume again
 | 
					          M118 Run ERCF_UNLOCK and solve any issue before hitting Resume again
 | 
				
			||||||
      {% else %}
 | 
					      {% else %}
 | 
				
			||||||
    # read E from pause macro
 | 
					          RESTORE_GCODE_STATE NAME=PAUSE_state
 | 
				
			||||||
    {% set E = printer["gcode_macro PAUSE"].extrude|float %}
 | 
					 | 
				
			||||||
    # get VELOCITY parameter if specified
 | 
					 | 
				
			||||||
    {% if 'VELOCITY' in params|upper %}
 | 
					 | 
				
			||||||
      {% set get_params = ('VELOCITY=' + params.VELOCITY)  %}
 | 
					 | 
				
			||||||
    {%else %}
 | 
					 | 
				
			||||||
      {% set get_params = "" %}
 | 
					 | 
				
			||||||
    {% endif %}
 | 
					 | 
				
			||||||
    # end of definitions
 | 
					 | 
				
			||||||
    M118 resume
 | 
					 | 
				
			||||||
    {% if printer.extruder.can_extrude|lower == 'true' %}
 | 
					 | 
				
			||||||
      G91
 | 
					 | 
				
			||||||
      G1 E{E} F6000
 | 
					 | 
				
			||||||
          G90
 | 
					          G90
 | 
				
			||||||
    {% else %}
 | 
					          {% if printer["gcode_macro _ERCF_VAR"].clog_detection|int == 1 %}
 | 
				
			||||||
      M118 Extruder not hot enough
 | 
					 | 
				
			||||||
    {% endif %}
 | 
					 | 
				
			||||||
    {% if printer["gcode_macro ERCF_VAR"].clog_detection|int == 1 %}
 | 
					 | 
				
			||||||
              SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1
 | 
					              SET_FILAMENT_SENSOR SENSOR=encoder_sensor ENABLE=1
 | 
				
			||||||
          {% endif %}
 | 
					          {% endif %}
 | 
				
			||||||
    G4 P2000
 | 
					 | 
				
			||||||
          _RESUME_BASE
 | 
					          _RESUME_BASE
 | 
				
			||||||
      {% endif %}
 | 
					      {% endif %}
 | 
				
			||||||
 | 
					    {% else %}
 | 
				
			||||||
 | 
					      M117 not paused
 | 
				
			||||||
 | 
					      M118 not paused
 | 
				
			||||||
 | 
					    {% endif %}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[gcode_macro PRINT_LAYER_CHANGE]
 | 
					[gcode_macro PRINT_LAYER_CHANGE]
 | 
				
			||||||
| 
						 | 
					@ -264,4 +271,4 @@ gcode:
 | 
				
			||||||
  {% set layer=params.LAYER|default(0)|int %}
 | 
					  {% set layer=params.LAYER|default(0)|int %}
 | 
				
			||||||
  {% set layer_z=params.LAYER_Z|default(0) %}
 | 
					  {% set layer_z=params.LAYER_Z|default(0) %}
 | 
				
			||||||
  {% set total_layer_count=params.TOTAL_LAYER_COUNT|default(0) %}
 | 
					  {% set total_layer_count=params.TOTAL_LAYER_COUNT|default(0) %}
 | 
				
			||||||
  M117 > layer {layer+1}/{total_layer_count} {layer_z}mm
 | 
					  M117 layer {layer+1}/{total_layer_count} {layer_z}mm
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue