208 lines
5.9 KiB
INI
208 lines
5.9 KiB
INI
[gcode_macro PRINT_START]
|
|
gcode:
|
|
# Parameters
|
|
{% set bedTemp = params.BED|int %}
|
|
{% set hotendTemp = params.HOTEND|int %}
|
|
{% set DWELL = params.DWELL|default(300)|int %}
|
|
{% set X = 200 %}
|
|
|
|
M104 S{hotendTemp|float*0.8} # set extruder pre warm temp
|
|
M140 S{bedTemp} # set bed temp to warm while starting up
|
|
G28 # home after setting temps
|
|
M117 Waiting for temperatures...
|
|
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={bedTemp} MAXIMUM={bedTemp+1} ; Wait for bed temp (within 1 degree)
|
|
HEATSOAK DWELL={DWELL} # Dwelling
|
|
#ATTACH_PROBE # Have probe ready for calibration
|
|
CLEAN_NOZZLE # Clean before getting offsets
|
|
#BED_MESH_CALIBRATE AREA_START={params.AREA_START} AREA_END={params.AREA_END}
|
|
G28 Z
|
|
#CALIBRATE_Z # Auto calibrate the bed height
|
|
GO_TO_BUCKET # No cleanup from nozzle ooze
|
|
M109 S{hotendTemp} # Set extruder to printing temperature
|
|
CLEAN_NOZZLE # Final clean before print
|
|
G90
|
|
G1 X{X} F{1000*60} # Avoid brush
|
|
G91
|
|
|
|
[gcode_macro PRINT_END]
|
|
gcode:
|
|
SAFE_RETRACT
|
|
M106 S0 # Part fan off
|
|
TURN_OFF_HEATERS
|
|
GO_TO_BUCKET
|
|
BED_MESH_CLEAR
|
|
|
|
[gcode_macro HEATSOAK]
|
|
gcode:
|
|
M117 Waiting for thermal expansion...
|
|
G4 P{params.DWELL|int*1000/4}
|
|
M117 Waiting for thermal expansion 25%
|
|
G4 P{params.DWELL|int*1000/4}
|
|
M117 Waiting for thermal expansion 50%
|
|
G4 P{params.DWELL|int*1000/4}
|
|
M117 Waiting for thermal expansion 75%
|
|
G4 P{params.DWELL|int*1000/4}
|
|
M117 Thermal expansion done
|
|
|
|
[gcode_macro CANCEL_PRINT]
|
|
rename_existing: BASE_CANCEL_PRINT
|
|
gcode:
|
|
M104 S0
|
|
M140 S0
|
|
M106 S0 # Part fan off
|
|
G91 E-2
|
|
CLEAR_PAUSE
|
|
BASE_CANCEL_PRINT
|
|
SDCARD_RESET_FILE
|
|
M221 S100
|
|
BED_MESH_CLEAR
|
|
|
|
[gcode_macro PAUSE]
|
|
rename_existing: BASE_PAUSE
|
|
gcode:
|
|
#Edit this#
|
|
{% set Z = 2 %}
|
|
###########
|
|
SAVE_GCODE_STATE NAME=PAUSE_state
|
|
BASE_PAUSE
|
|
G91
|
|
SAFE_RETRACT
|
|
G1 Z{Z}
|
|
GO_TO_BUCKET
|
|
G91
|
|
|
|
[gcode_macro RESUME]
|
|
rename_existing: BASE_RESUME
|
|
gcode:
|
|
#Edit this#
|
|
{% set Z = 10 %}
|
|
###########
|
|
CLEAN_NOZZLE
|
|
G91
|
|
G1 Z{Z}
|
|
G91
|
|
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
|
|
BASE_RESUME
|
|
|
|
[gcode_macro UNLOAD_FILAMENT]
|
|
gcode:
|
|
G91
|
|
G1 E10.0 F{20*60}
|
|
G1 E3.0 F{26*60}
|
|
G1 E-13.14 F{120*60}
|
|
G1 E-100 F{50*60}
|
|
|
|
[gcode_macro M600]
|
|
gcode:
|
|
PAUSE
|
|
|
|
[gcode_macro DISABLE_MOTORS]
|
|
gcode:
|
|
M18
|
|
|
|
[idle_timeout]
|
|
gcode:
|
|
TURN_OFF_HEATERS
|
|
DISABLE_MOTORS
|
|
|
|
[gcode_macro GO_TO_BUCKET]
|
|
gcode:
|
|
#Edit this#
|
|
{% set X = 55 %}
|
|
{% set Y = 325 %}
|
|
{% set Z = 2 %}
|
|
###########
|
|
SAFE_RETRACT
|
|
G91
|
|
G1 Z{Z}
|
|
G90
|
|
G1 X{X} F{1000*60}
|
|
G1 Y{Y} F{1000*60}
|
|
G91
|
|
|
|
[gcode_macro safe_retract]
|
|
gcode:
|
|
{% if printer.extruder.can_extrude %}
|
|
G10
|
|
{% endif %}
|
|
|
|
[gcode_macro safe_unretract]
|
|
gcode:
|
|
{% if printer.extruder.can_extrude %}
|
|
G11
|
|
{% 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:
|
|
{% 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 %}
|
|
|