doom-micron/calibration_macros.cfg
2023-12-02 00:55:09 +00:00

169 lines
6 KiB
INI

[gcode_macro FLOW_CALIBRATION]
gcode:
M221 S{params.FLOW}
SET_PRESSURE_ADVANCE ADVANCE={params.PRESSURE_ADVANCE}
[gcode_macro TEST_Z_DOWN]
gcode:
{% set amount = params.amount|default(1)|int %}
TESTZ Z=-{amount}
[gcode_macro TEST_Z_UP]
gcode:
{% set amount = params.amount|default(1)|int %}
TESTZ Z=+{amount}
[gcode_macro TEST_Z_BISECT_UP]
gcode:
TESTZ Z=+
[gcode_macro TEST_Z_BISECT_DOWN]
gcode:
TESTZ Z=-
[gcode_macro PID_HOTEND]
gcode:
PID_CALIBRATE HEATER=extruder TARGET=260
[gcode_macro PID_BED]
gcode:
PID_CALIBRATE HEATER=heater_bed TARGET=110
[gcode_macro DISABLE_Z]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=0
SET_STEPPER_ENABLE STEPPER=stepper_z1 ENABLE=0
SET_STEPPER_ENABLE STEPPER=stepper_z2 ENABLE=0
SET_STEPPER_ENABLE STEPPER=stepper_z3 ENABLE=0
[gcode_macro ENABLE_Z]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_z ENABLE=1
SET_STEPPER_ENABLE STEPPER=stepper_z1 ENABLE=1
SET_STEPPER_ENABLE STEPPER=stepper_z2 ENABLE=1
SET_STEPPER_ENABLE STEPPER=stepper_z3 ENABLE=1
[gcode_macro ENABLE_XY]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_x ENABLE=1
SET_STEPPER_ENABLE STEPPER=stepper_y ENABLE=1
[gcode_macro DISABLE_XY]
gcode:
SET_STEPPER_ENABLE STEPPER=stepper_x ENABLE=0
SET_STEPPER_ENABLE STEPPER=stepper_y ENABLE=0
[gcode_macro TEST_SPEED]
gcode:
# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10
# Speed
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
# Iterations
{% set iterations = params.ITERATIONS|default(1)|int %}
# Acceleration
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
# Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions)
{% set bound = params.BOUND|default(30)|int %}
# Size for small pattern box
{% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %}
# Large pattern
# Max positions, inset by BOUND
{% set x_min = printer.toolhead.axis_minimum.x + bound %}
{% set x_max = printer.toolhead.axis_maximum.x - bound %}
{% set y_min = printer.toolhead.axis_minimum.y + bound %}
{% set y_max = printer.toolhead.axis_maximum.y - bound %}
# Small pattern at center
# Find X/Y center point
{% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %}
{% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %}
# Set small pattern box around center point
{% set x_center_min = x_center - (smallpatternsize/2) %}
{% set x_center_max = x_center + (smallpatternsize/2) %}
{% set y_center_min = y_center - (smallpatternsize/2) %}
{% set y_center_max = y_center + (smallpatternsize/2) %}
# Save current gcode state (absolute/relative, etc)
SAVE_GCODE_STATE NAME=TEST_SPEED
# Output parameters to g-code terminal
{ action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) }
# Home and get position for comparison later:
G28
# Absolute positioning
G90
# Set new limits
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel}
# Go to starting position
G0 X{x_min} Y{y_min} Z{10} F{speed*60}
{% for i in range(iterations) %}
# Large pattern
# Diagonals
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Box
G0 X{x_min} Y{y_min} F{speed*60}
G0 X{x_min} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_max} F{speed*60}
G0 X{x_max} Y{y_min} F{speed*60}
# Small pattern
# Small diagonals
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
# Small box
{% for i in range(10) %}
G0 X{x_center_min} Y{y_center_min} F{speed*60}
G0 X{x_center_min} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_max} F{speed*60}
G0 X{x_center_max} Y{y_center_min} F{speed*60}
{% endfor %}
{% endfor %}
# Restore max speed/accel/accel_to_decel to their configured values
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel}
# Restore previous gcode state (absolute/relative, etc)
RESTORE_GCODE_STATE NAME=TEST_SPEED
[gcode_macro DUMP_VARIABLES]
gcode:
{% set filter_name = params.NAME|default('')|string|lower %}
{% set filter_value = params.VALUE|default('')|string|lower %}
{% set show_cfg = params.SHOW_CFG|default(0)|int %}
{% set out = [] %}
{% for key1 in printer %}
{% for key2 in printer[key1] %}
{% if (show_cfg or not (key1|lower == 'configfile' and key2|lower in ['config', 'settings'])) and (filter_name in key1|lower or filter_name in key2|lower) and filter_value in printer[key1][key2]|string|lower %}
{% set dummy = out.append("printer['%s'].%s = %s" % (key1, key2, printer[key1][key2])) %}
{% endif %}
{% else %}
{% if filter_name in key1|lower and filter_value in printer[key1]|string|lower %}
{% set dummy = out.append("printer['%s'] = %s" % (key1, printer[key1])) %}
{% endif %}
{% endfor %}
{% endfor %}
{action_respond_info(out|join("\n"))}