205 lines
6.3 KiB
INI
205 lines
6.3 KiB
INI
########################################
|
|
# Useful Macros
|
|
########################################
|
|
|
|
[gcode_shell_command Klipper_Backup]
|
|
command: sh /usr/data/helper-script/files/scripts/useful_macros.sh -backup_klipper
|
|
timeout: 600.0
|
|
verbose: true
|
|
|
|
[gcode_shell_command Klipper_Restore]
|
|
command: sh /usr/data/helper-script/files/scripts/useful_macros.sh -restore_klipper
|
|
timeout: 600.0
|
|
verbose: true
|
|
|
|
[gcode_shell_command Moonraker_Backup]
|
|
command: sh /usr/data/helper-script/files/scripts/useful_macros.sh -backup_moonraker
|
|
timeout: 600.0
|
|
verbose: true
|
|
|
|
[gcode_shell_command Moonraker_Restore]
|
|
command: sh /usr/data/helper-script/files/scripts/useful_macros.sh -restore_moonraker
|
|
timeout: 600.0
|
|
verbose: true
|
|
|
|
|
|
[gcode_macro KLIPPER_BACKUP_CONFIG]
|
|
gcode:
|
|
RUN_SHELL_COMMAND CMD=Klipper_Backup
|
|
|
|
|
|
[gcode_macro KLIPPER_RESTORE_CONFIG]
|
|
gcode:
|
|
RUN_SHELL_COMMAND CMD=Klipper_Restore
|
|
|
|
|
|
[gcode_macro MOONRAKER_BACKUP_DATABASE]
|
|
gcode:
|
|
RUN_SHELL_COMMAND CMD=Moonraker_Backup
|
|
|
|
|
|
[gcode_macro MOONRAKER_RESTORE_DATABASE]
|
|
gcode:
|
|
RUN_SHELL_COMMAND CMD=Moonraker_Restore
|
|
|
|
|
|
[gcode_macro BED_LEVELING]
|
|
description: Start Bed Leveling
|
|
gcode:
|
|
{% if 'PROBE_COUNT' in params|upper %}
|
|
{% set get_count = ('PROBE_COUNT=' + params.PROBE_COUNT) %}
|
|
{%else %}
|
|
{% set get_count = "" %}
|
|
{% endif %}
|
|
{% set bed_temp = params.BED_TEMP|default(50)|float %}
|
|
{% set hotend_temp = params.HOTEND_TEMP|default(140)|float %}
|
|
{% set nozzle_clear_temp = params.NOZZLE_CLEAR_TEMP|default(240)|float %}
|
|
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
|
|
{% if printer.toolhead.homed_axes != "xyz" %}
|
|
G28
|
|
{% endif %}
|
|
BED_MESH_CLEAR
|
|
NOZZLE_CLEAR HOT_MIN_TEMP={hotend_temp} HOT_MAX_TEMP={nozzle_clear_temp} BED_MAX_TEMP={bed_temp}
|
|
ACCURATE_G28
|
|
M204 S5000
|
|
SET_VELOCITY_LIMIT ACCEL_TO_DECEL=5000
|
|
BED_MESH_CALIBRATE {get_count}
|
|
BED_MESH_OUTPUT
|
|
{% set y_park = printer.toolhead.axis_maximum.y/2 %}
|
|
{% set x_park = printer.toolhead.axis_maximum.x|float - 10.0 %}
|
|
G1 X{x_park} Y{y_park} F20000
|
|
TURN_OFF_HEATERS
|
|
SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1
|
|
|
|
|
|
[gcode_macro PID_BED]
|
|
description: Start Bed PID
|
|
gcode:
|
|
G90
|
|
{% if printer.toolhead.homed_axes != "xyz" %}
|
|
G28
|
|
{% endif %}
|
|
G1 Z10 F600
|
|
M106
|
|
PID_CALIBRATE HEATER=heater_bed TARGET={params.BED_TEMP|default(70)}
|
|
M107
|
|
{% set y_park = printer.toolhead.axis_maximum.y/2 %}
|
|
{% set x_park = printer.toolhead.axis_maximum.x|float - 10.0 %}
|
|
G1 X{x_park} Y{y_park} F20000
|
|
|
|
|
|
[gcode_macro PID_HOTEND]
|
|
description: Start Hotend PID
|
|
gcode:
|
|
G90
|
|
{% if printer.toolhead.homed_axes != "xyz" %}
|
|
G28
|
|
{% endif %}
|
|
G1 Z10 F600
|
|
M106
|
|
PID_CALIBRATE HEATER=extruder TARGET={params.HOTEND_TEMP|default(250)}
|
|
M107
|
|
{% set y_park = printer.toolhead.axis_maximum.y/2 %}
|
|
{% set x_park = printer.toolhead.axis_maximum.x|float - 10.0 %}
|
|
G1 X{x_park} Y{y_park} F20000
|
|
WAIT_TEMP_START
|
|
|
|
|
|
[gcode_macro LUBRICATE_RODS]
|
|
description: Distribute lubricant on Rods
|
|
gcode:
|
|
{% set min_speed = 3000 %} # Minimum speed in mm/min
|
|
{% set max_speed = 18000 %} # Maximum speed in mm/min
|
|
{% if printer.toolhead.homed_axes != "xyz" %}
|
|
G28
|
|
{% endif %}
|
|
G1 Z50 F300
|
|
{% set x_max = printer.toolhead.axis_maximum.x|int %}
|
|
{% set y_max = printer.toolhead.axis_maximum.y|int %}
|
|
{% set edge_offset_x = x_max * 0.05 %}
|
|
{% set edge_offset_y = y_max * 0.05 %}
|
|
{% set x_range = x_max - edge_offset_x %}
|
|
{% set y_range = y_max - edge_offset_y %}
|
|
{% set num_steps_x = (x_range / 10)|int %}
|
|
{% set num_steps_y = (y_range / 10)|int %}
|
|
{% set speed_increment_x = (max_speed - min_speed) / num_steps_x %}
|
|
{% set speed_increment_y = (max_speed - min_speed) / num_steps_y %}
|
|
{% set current_speed_x = min_speed %}
|
|
{% set current_speed_y = min_speed %}
|
|
{% for i in range(num_steps_x) %}
|
|
G1 X{edge_offset_x + i * 10} Y{edge_offset_y} F{current_speed_x}
|
|
G1 X{edge_offset_x + i * 10} Y{y_range} F{current_speed_x}
|
|
{% set current_speed_x = current_speed_x + speed_increment_x %}
|
|
{% endfor %}
|
|
{% for j in range(num_steps_y) %}
|
|
G1 Y{edge_offset_y + j * 10} X{edge_offset_x} F{current_speed_y}
|
|
G1 Y{edge_offset_y + j * 10} X{x_range} F{current_speed_y}
|
|
{% set current_speed_y = current_speed_y + speed_increment_y %}
|
|
{% endfor %}
|
|
|
|
[gcode_macro WARMUP]
|
|
description: Stress Test
|
|
variable_maxd: 14142.14 ; = SQRT(2*maxy)
|
|
gcode:
|
|
{% set min_loops = 2 %}
|
|
{% set max_loops = params.LOOPS|default(3)|int %}
|
|
{% if 'LOOPS' in params|upper %}
|
|
{% if max_loops < min_loops %}
|
|
{% set max_loops = min_loops %}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% set loop_cnt = max_loops %}
|
|
{% if 'X_ACCEL_MAX' in params|upper %}
|
|
{% set maxx = params.X_ACCEL_MAX|default(10000)|int %}
|
|
{% endif %}
|
|
{% if 'Y_ACCEL_MAX' in params|upper %}
|
|
{% set maxy = params.Y_ACCEL_MAX|default(10000)|int %}
|
|
{% endif %}
|
|
{% set max_x = (printer.toolhead.axis_maximum.x|int-5) %}
|
|
{% set max_y = (printer.toolhead.axis_maximum.y|int-5) %}
|
|
{% set loop_step_y = max_y//(loop_cnt-1) %}
|
|
{% set loop_step_x = max_x//(loop_cnt-1) %}
|
|
{% set y_park = printer.toolhead.axis_maximum.y/2 %}
|
|
{% set x_park = printer.toolhead.axis_maximum.x|float - 10.0 %}
|
|
{% if printer.toolhead.homed_axes != "xyz" %}
|
|
G28
|
|
{% endif %}
|
|
SET_VELOCITY_LIMIT ACCEL={maxx} ACCEL_TO_DECEL={maxx/2}
|
|
{% for number in range(10,max_y+11,loop_step_y) %}
|
|
{% if number >= max_y %}
|
|
{% set number = max_y %}
|
|
{% endif %}
|
|
G1 F{maxy} X10 Y{number}
|
|
G1 F{maxx} X{max_x} Y{number}
|
|
{% endfor %}
|
|
SET_VELOCITY_LIMIT ACCEL={maxy} ACCEL_TO_DECEL={maxy/2}
|
|
{% for number in range(10,max_x+11,loop_step_y) %}
|
|
{% if number >= max_x %}
|
|
{% set number = max_x %}
|
|
{% endif %}
|
|
G1 F{maxy} X{number} Y{max_y}
|
|
G1 F{maxy} X{number} Y10
|
|
{% endfor %}
|
|
SET_VELOCITY_LIMIT ACCEL={maxd} ACCEL_TO_DECEL={maxd/2}
|
|
{% for times in range(loop_cnt) %}
|
|
G1 F{maxx} X10 Y10
|
|
G1 F{maxd} X{max_x} Y{max_y}
|
|
G1 F{maxx} X10 Y{max_y}
|
|
G1 F{maxd} X{max_x} Y10
|
|
G1 F{maxy} X{max_x} Y{max_y}
|
|
G1 F{maxd} X10 Y10
|
|
G1 F{maxy} X10 Y{max_y}
|
|
G1 F{maxd} X{max_x} Y10
|
|
{% endfor %}
|
|
SET_VELOCITY_LIMIT ACCEL={maxx} ACCEL_TO_DECEL={maxx/2}
|
|
{% for times in range(loop_cnt) %}
|
|
G1 F{maxy} X10 Y10
|
|
G1 F{maxy} X10 Y{max_y}
|
|
G1 F{maxx} X{max_x} Y{max_y}
|
|
G1 F{maxy} X{max_x} Y10
|
|
G1 F{maxx} X10 Y10
|
|
G1 F{maxx} X{max_x} Y10
|
|
G1 F{maxy} X{max_x} Y{max_y}
|
|
G1 F{maxx} X10 Y{max_y}
|
|
{% endfor %}
|
|
G1 X{x_park} Y{y_park} F30000
|