320 lines
11 KiB
INI
320 lines
11 KiB
INI
#####
|
|
# START PRINT MACROS
|
|
# Call this from your slicer (custom g-code).
|
|
# Read more here: https://rat-rig.github.io/V-CoreOS/#/slicers
|
|
#####
|
|
|
|
[gcode_macro START_PRINT]
|
|
description: Start print procedure, use this in your Slicer.
|
|
gcode:
|
|
CLEAR_PAUSE
|
|
{% if printer["gcode_macro RatOS"].force_absolute_position|lower == 'true' %}
|
|
G90
|
|
{% endif %}
|
|
SAVE_GCODE_STATE NAME=start_print_state
|
|
# Metric values
|
|
G21
|
|
# Absolute positioning
|
|
G90
|
|
# Set extruder to absolute mode
|
|
M82
|
|
_USER_START_PRINT_BEFORE_HOMING
|
|
# Home if needed
|
|
MAYBE_HOME
|
|
{% if params.CHAMBER_TEMP is defined %}
|
|
_START_PRINT_HEAT_CHAMBER CHAMBER_TEMP={params.CHAMBER_TEMP} BED_TEMP={printer["gcode_macro RatOS"].start_print_heat_chamber_bed_temp}
|
|
_USER_START_PRINT_HEAT_CHAMBER CHAMBER_TEMP={params.CHAMBER_TEMP} BED_TEMP={printer["gcode_macro RatOS"].start_print_heat_chamber_bed_temp}
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].awd_sync_enabled|lower == 'true' %}
|
|
M117 Motor sync...
|
|
RESPOND MSG="Motor sync..."
|
|
{% if not printer.motors_sync.applied %}
|
|
SYNC_MOTORS
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
|
|
|
|
M117 Heating bed...
|
|
RESPOND MSG="Heating bed..."
|
|
# Wait for bed to heat up
|
|
M190 S{params.BED_TEMP|default(printer.heater_bed.target, true) }
|
|
# Run the user created "AFTER_HEATING_BED" macro
|
|
_USER_START_PRINT_AFTER_HEATING_BED
|
|
# Run the customizable "AFTER_HEATING_BED" macro.
|
|
_START_PRINT_AFTER_HEATING_BED
|
|
# Run the user created "START_PRINT_BED_MESH" macro
|
|
_USER_START_PRINT_BED_MESH
|
|
# Run the customizable "BED_MESH" macro
|
|
_START_PRINT_BED_MESH X0={params.X0} X1={params.X1} Y0={params.Y0} Y1={params.Y1}
|
|
# Start heating extruder
|
|
M104 S{params.EXTRUDER_TEMP|default(printer.extruder.target, true) }
|
|
# Run the users "PARK" macro
|
|
_USER_START_PRINT_PARK
|
|
# Run the customizable "PARK" macro
|
|
_START_PRINT_PARK
|
|
# Wait for extruder to heat up
|
|
M117 Heating Extruder...
|
|
RESPOND MSG="Heating Extruder..."
|
|
M109 S{params.EXTRUDER_TEMP|default(printer.extruder.target, true) }
|
|
|
|
|
|
# M190 S{params.BED_TEMP|default(printer.heater_bed.target, true) } #возможно потребуется чтоб стол догревался
|
|
|
|
# Run the user created "AFTER_HEATING_EXTRUDER" macro.
|
|
_USER_START_PRINT_AFTER_HEATING_EXTRUDER
|
|
# Run the customizable "AFTER_HEATING_EXTRUDER" macro.
|
|
_START_PRINT_AFTER_HEATING_EXTRUDER
|
|
M117 Printing...
|
|
RESPOND MSG="Printing..."
|
|
RESTORE_GCODE_STATE NAME=start_print_state
|
|
# Set extrusion mode based on user configuration
|
|
{% if printer["gcode_macro RatOS"].relative_extrusion|lower == 'true' %}
|
|
M83
|
|
{% else %}
|
|
M82
|
|
{% endif %}
|
|
G92 E0
|
|
|
|
#####
|
|
# START PRINT MACRO HOOKS
|
|
# You can copy these to printer.cfg and modify them to your liking, or just use them as is.
|
|
####
|
|
|
|
[gcode_macro _USER_START_PRINT_BEFORE_HOMING]
|
|
gcode:
|
|
{% if printer["gcode_macro RatOS"].orbiter_sensor_cheat|lower == 'true' %}
|
|
SET_FILAMENT_SENSOR SENSOR=Orbiter_Sensor ENABLE=0
|
|
{% endif %}
|
|
|
|
[gcode_macro _START_PRINT_AFTER_HEATING_BED]
|
|
gcode:
|
|
{% if printer["gcode_macro RatOS"].preheat_extruder|lower == 'true' %}
|
|
{% set min_temp = printer["gcode_macro RatOS"].preheat_extruder_temp|float %}
|
|
{% set max_temp = printer["gcode_macro RatOS"].preheat_extruder_temp|float + 5 %}
|
|
M117 Pre-heating extruder...
|
|
RESPOND MSG="Pre-heating extruder..."
|
|
# Wait for extruder to reach a predefined preheat temp so an inductive probe (if present) is at a predictable temp.
|
|
# Also allows the bed heat to spread a little, and softens any plastic that might be stuck to the nozzle.
|
|
M104 S{min_temp}
|
|
#TEMPERATURE_WAIT SENSOR=extruder MINIMUM={min_temp} MAXIMUM={max_temp}
|
|
# выключил ожидание температуры, для теста
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].z_tilt_enabled|lower == 'true' %}
|
|
{% set TARGET_TEMP = printer.heater_bed.target %}
|
|
{% if printer["gcode_macro RatOS"].high_power_bed|lower == 'true' %}
|
|
M140 S0
|
|
{% endif %}
|
|
M117 Adjusting Z tilt...
|
|
RESPOND MSG="Adjusting Z tilt..."
|
|
# Adjust bed tilt
|
|
SAVE_GCODE_STATE NAME=STATE_Z_TILT
|
|
BED_MESH_CLEAR
|
|
{% if not printer.z_tilt.applied %}
|
|
Z_TILT_ADJUST horizontal_move_z=10 retry_tolerance=1
|
|
{% endif %}
|
|
Z_TILT_ADJUST horizontal_move_z=2
|
|
RESTORE_GCODE_STATE NAME=STATE_Z_TILT
|
|
M117 Rehoming Z after Z tilt adjustment...
|
|
RESPOND MSG="Rehoming Z after Z tilt adjustment..."
|
|
# Home again as Z will have changed after tilt adjustment and bed heating.
|
|
G28 Z
|
|
M140 S{TARGET_TEMP}
|
|
{% endif %}
|
|
|
|
|
|
[gcode_macro _USER_START_PRINT_AFTER_HEATING_BED]
|
|
gcode:
|
|
|
|
[gcode_macro _START_PRINT_BED_MESH]
|
|
gcode:
|
|
{% set default_profile = printer["gcode_macro RatOS"].bed_mesh_profile|default('ratos') %}
|
|
{% set min_temp = printer["gcode_macro RatOS"].preheat_extruder_temp|float %}
|
|
{% if printer["gcode_macro RatOS"].calibrate_bed_mesh|lower == 'true' %}
|
|
BED_MESH_CLEAR
|
|
{% set TARGET_TEMP = printer.heater_bed.target %}
|
|
{% if printer["gcode_macro RatOS"].variable_high_power_bed|lower == 'true' %}
|
|
M140 S0
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].adaptive_mesh|lower == 'true' %}
|
|
ADAPTIVE_BED_MESH FORCE_MESH=1
|
|
{% else %}
|
|
BED_MESH_CALIBRATE PROFILE={default_profile}
|
|
BED_MESH_PROFILE LOAD={default_profile}
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].nozzle_scrub_enabled|lower == 'true' %}
|
|
M190 S{TARGET_TEMP}
|
|
clean_nozzle
|
|
M140 S0
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].touch_cart_enabled|lower == 'true' %}
|
|
M109 S{printer["gcode_macro RatOS"].min_temp}
|
|
CARTOGRAPHER_TOUCH FUZZY={printer["gcode_macro RatOS"].touch_cart_fuzzy} ; Perform touch probe
|
|
{% endif %}
|
|
M140 S{TARGET_TEMP}
|
|
{% elif printer["gcode_macro RatOS"].bed_mesh_profile is defined %}
|
|
BED_MESH_CLEAR
|
|
BED_MESH_PROFILE LOAD={printer["gcode_macro RatOS"].bed_mesh_profile}
|
|
{% endif %}
|
|
|
|
[gcode_macro _USER_START_PRINT_BED_MESH]
|
|
gcode:
|
|
|
|
[gcode_macro _START_PRINT_PARK]
|
|
gcode:
|
|
{% set z = printer["gcode_macro RatOS"].start_print_park_z_height|float %}
|
|
{% set zSpeed = printer["gcode_macro RatOS"].macro_z_speed|float * 60 %}
|
|
_PARK LOCATION={printer["gcode_macro RatOS"].start_print_park_in} X={printer["gcode_macro RatOS"].start_print_park_x}
|
|
G0 Z{z} F{zSpeed}
|
|
|
|
[gcode_macro _USER_START_PRINT_PARK]
|
|
gcode:
|
|
|
|
[gcode_macro _START_PRINT_AFTER_HEATING_EXTRUDER]
|
|
gcode:
|
|
{% set has_offset = printer["gcode_macro RatOS"].probe_for_priming_result|float(9999.9) != 9999.9 %}
|
|
{% if has_offset %}
|
|
ADD_PRIME_PROBE_TO_OFFSET
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].nozzle_priming|lower == 'auto' %}
|
|
{% if params.MATERIAL is defined and params.MATERIAL|lower == 'tpu'%}
|
|
PRIME_LINE
|
|
{% else %}
|
|
PRIME_BLOB
|
|
{% endif %}
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].nozzle_priming|lower == 'primeline' %}
|
|
PRIME_LINE
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].nozzle_priming|lower == 'primeblob' %}
|
|
PRIME_BLOB
|
|
{% endif %}
|
|
{% if has_offset %}
|
|
SUBTRACT_PRIME_PROBE_FROM_OFFSET
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].skew_profile is defined %}
|
|
SKEW_PROFILE LOAD={printer["gcode_macro RatOS"].skew_profile}
|
|
{% endif %}
|
|
|
|
[gcode_macro _USER_START_PRINT_AFTER_HEATING_EXTRUDER]
|
|
gcode:
|
|
|
|
[gcode_macro _START_PRINT_HEAT_CHAMBER]
|
|
description: Uses the extruder sensor to wait for chamber temp. Override the _START_PRINT_HEAT_CHAMBER macro to implement heated chamber handling.
|
|
gcode:
|
|
{% if params.CHAMBER_TEMP is defined and params.BED_TEMP is defined and params.CHAMBER_TEMP|int > 0 %}
|
|
{% set z = printer["gcode_macro RatOS"].start_print_park_z_height|float %}
|
|
{% set zSpeed = printer["gcode_macro RatOS"].macro_z_speed|float * 60 %}
|
|
G0 Z{z} F{zSpeed}
|
|
M84
|
|
M117 Heating chamber...
|
|
RESPOND MSG="Heating chamber..."
|
|
M140 S{params.BED_TEMP}
|
|
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={params.CHAMBER_TEMP}
|
|
MAYBE_HOME
|
|
{% endif %}
|
|
|
|
[gcode_macro _USER_START_PRINT_HEAT_CHAMBER]
|
|
description: Uses the extruder sensor to wait for chamber temp. Override the _START_PRINT_HEAT_CHAMBER macro to implement heated chamber handling.
|
|
gcode:
|
|
|
|
#####
|
|
# END PRINT MACROS
|
|
# Call this from your slicer (custom g-code).
|
|
# Read more here: https://rat-rig.github.io/V-CoreOS/#/slicers
|
|
#####
|
|
# The end_print macro
|
|
[gcode_macro END_PRINT]
|
|
description: End print procedure, use this in your Slicer.
|
|
gcode:
|
|
_END_PRINT_ROUTINE
|
|
M117 Done :)
|
|
RESPOND MSG="Done :)"
|
|
{% if printer["gcode_macro RatOS"].tgbot_enabled|lower == 'true' %}
|
|
RESPOND PREFIX=tgnotify MSG="Допечатато! =)"
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].beep_enabled|lower == 'true' %}
|
|
beep
|
|
{% endif %}
|
|
|
|
[gcode_macro _END_PRINT_ROUTINE]
|
|
description: End print routine procedure
|
|
gcode:
|
|
SAVE_GCODE_STATE NAME=end_print_state
|
|
_USER_END_PRINT_BEFORE_HEATERS_OFF
|
|
_END_PRINT_BEFORE_HEATERS_OFF
|
|
TURN_OFF_HEATERS
|
|
_USER_END_PRINT_AFTER_HEATERS_OFF
|
|
_END_PRINT_AFTER_HEATERS_OFF
|
|
_USER_END_PRINT_PARK
|
|
_END_PRINT_PARK
|
|
# Clear skew profile if any was loaded.
|
|
{% if printer["gcode_macro RatOS"].skew_profile is defined %}
|
|
SET_SKEW CLEAR=1
|
|
{% endif %}
|
|
{% if printer["gcode_macro RatOS"].orbiter_sensor_cheat|lower == 'true' %}
|
|
SET_FILAMENT_SENSOR SENSOR=Orbiter_Sensor ENABLE=1
|
|
{% endif %}
|
|
|
|
# Steppers off
|
|
{% if printer["gcode_macro RatOS"].disable_steppers_after_print|lower == 'true' %}
|
|
M84
|
|
{% else %}
|
|
SET_STEPPER_ENABLE STEPPER=extruder ENABLE=0
|
|
{% endif %}
|
|
# Part cooling fan off
|
|
M107
|
|
# Clear bed mesh so that G28 doesn't fail.
|
|
BED_MESH_CLEAR
|
|
RESTORE_GCODE_STATE NAME=end_print_state
|
|
|
|
|
|
|
|
#####
|
|
# END PRINT MACRO HOOKS
|
|
# You can copy these to printer.cfg and modify them to your liking, or just use them as is.
|
|
####
|
|
|
|
[gcode_macro _END_PRINT_BEFORE_HEATERS_OFF]
|
|
gcode:
|
|
RESPOND MSG="Cleaning up..."
|
|
|
|
|
|
[gcode_macro _USER_END_PRINT_BEFORE_HEATERS_OFF]
|
|
gcode:
|
|
|
|
[gcode_macro _END_PRINT_AFTER_HEATERS_OFF]
|
|
gcode:
|
|
# Calculate safe Z position
|
|
{% set max_z = printer.toolhead.axis_maximum.z|float %}
|
|
{% set act_z = printer.toolhead.position.z|float %}
|
|
{% set z_hop = printer["gcode_macro RatOS"].end_print_park_z_hop|float %}
|
|
{% if act_z < (max_z - z_hop) %}
|
|
{% set z_safe = z_hop %}
|
|
{% else %}
|
|
{% set z_safe = max_z - act_z %}
|
|
{% endif %}
|
|
# Relative positioning
|
|
G91
|
|
# Retract the filament a bit before lifting the nozzle.
|
|
G1 E-1 F3600
|
|
# Move to safe Z position
|
|
G0 Z{z_safe} F3600
|
|
# Retract filament even more
|
|
G1 E-{printer["gcode_macro RatOS"].filament_retract_after_print} F3600
|
|
# Back to absolute positioning
|
|
G90
|
|
|
|
[gcode_macro _USER_END_PRINT_AFTER_HEATERS_OFF]
|
|
gcode:
|
|
{% if printer["gcode_macro RatOS"].orbiter_sensor_cheat|lower == 'true' %}
|
|
SET_FILAMENT_SENSOR SENSOR=Orbiter_Sensor ENABLE=1
|
|
{% endif %}
|
|
|
|
[gcode_macro _END_PRINT_PARK]
|
|
gcode:
|
|
_PARK LOCATION={printer["gcode_macro RatOS"].end_print_park_in} X={printer["gcode_macro RatOS"].end_print_park_x}
|
|
|
|
[gcode_macro _USER_END_PRINT_PARK]
|
|
gcode:
|