Init
This commit is contained in:
552
macros/main.cfg
Normal file
552
macros/main.cfg
Normal file
@@ -0,0 +1,552 @@
|
||||
[include stealthburner_leds.cfg]
|
||||
|
||||
|
||||
[gcode_macro _KNOMI_STATUS]
|
||||
variable_homing: False
|
||||
variable_probing: False
|
||||
variable_qgling: False
|
||||
variable_heating_nozzle: False
|
||||
variable_heating_bed: False
|
||||
gcode:
|
||||
|
||||
|
||||
[include homing.cfg]
|
||||
#[include private.cfg]
|
||||
#[include nozzle_scrub.cfg]
|
||||
[include ../KAMP_Settings.cfg]
|
||||
#[include ../KAMP/KAMP_Settings.cfg]
|
||||
[include tools.cfg]
|
||||
|
||||
|
||||
|
||||
|
||||
[delayed_gcode init_printer]
|
||||
initial_duration: 1
|
||||
gcode:
|
||||
STATUS_READY
|
||||
SET_FAN_SPEED FAN=SoC SPEED=0.3
|
||||
#SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=0
|
||||
|
||||
[delayed_gcode _INIT_TIMELAPSE_CHECK_TIME]
|
||||
initial_duration: 1
|
||||
gcode: SET_GCODE_VARIABLE MACRO=TIMELAPSE_TAKE_FRAME VARIABLE=check_time VALUE=0.5
|
||||
|
||||
[gcode_button ps_lose]
|
||||
pin: PC2
|
||||
press_gcode:
|
||||
{ action_respond_info("Power lose!") }
|
||||
SHUTDOWN
|
||||
|
||||
[gcode_macro SHUTDOWN]
|
||||
gcode:
|
||||
SET_PIN PIN=ps_on VALUE=0
|
||||
{action_respond_info('action:poweroff')}
|
||||
{action_call_remote_method("shutdown_machine")}
|
||||
|
||||
|
||||
[gcode_macro _CHAMBER_LED_OFF]
|
||||
gcode:
|
||||
SET_LED LED="chamber_leds" RED=0 GREEN=0 BLUE=0 SYNC=0 TRANSMIT=1
|
||||
|
||||
[gcode_macro _CHAMBER_LED_ON]
|
||||
gcode:
|
||||
SET_LED LED="chamber_leds" RED=1 GREEN=1 BLUE=1 SYNC=0 TRANSMIT=1
|
||||
|
||||
[gcode_macro _LED_SWITCH]
|
||||
gcode:
|
||||
{% set color_data = printer["neopixel chamber_leds"].color_data %}
|
||||
{% if color_data[0][0] or color_data[0][1] or color_data[0][2] %}
|
||||
SET_LED LED="chamber_leds" RED=0 GREEN=0 BLUE=0 SYNC=0 TRANSMIT=1
|
||||
{% else %}
|
||||
SET_LED LED="chamber_leds" RED=1 GREEN=1 BLUE=1 SYNC=0 TRANSMIT=1
|
||||
{% endif %}
|
||||
|
||||
|
||||
[gcode_button ps_double_click]
|
||||
pin: !PG13
|
||||
press_gcode:
|
||||
{ action_respond_info("Double click!") }
|
||||
_LED_SWITCH
|
||||
|
||||
[gcode_button ps_triple_click]
|
||||
pin: !PG12
|
||||
press_gcode:
|
||||
{ action_respond_info("Triple click!") }
|
||||
{ action_emergency_stop() }
|
||||
|
||||
|
||||
[gcode_macro START_BED_MESH_CALIBRATE]
|
||||
#rename_existing: _BED_MESH_CALIBRATE
|
||||
gcode:
|
||||
STATUS_MESHING
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=True
|
||||
BED_MESH_CALIBRATE
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=probing VALUE=False
|
||||
STATUS_READY
|
||||
|
||||
|
||||
[gcode_macro QUAD_GANTRY_LEVEL]
|
||||
rename_existing: QUAD_GANTRY_LEVEL_BASE
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=qgling VALUE=True
|
||||
STATUS_LEVELING
|
||||
QUAD_GANTRY_LEVEL_BASE
|
||||
STATUS_READY
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=qgling VALUE=False
|
||||
|
||||
[gcode_macro G32]
|
||||
gcode:
|
||||
M117 Homing
|
||||
BED_MESH_CLEAR
|
||||
G28
|
||||
QUAD_GANTRY_LEVEL
|
||||
STATUS_CALIBRATING_Z
|
||||
#G0 X350 Y350 Z30 F3600
|
||||
G28 Z
|
||||
G0 Z10 F3600
|
||||
STATUS_READY
|
||||
M117
|
||||
|
||||
[gcode_macro SFS_ENABLE]
|
||||
description: Enable smart filament sensor
|
||||
gcode:
|
||||
M117 ENABLING the Smart Filament Sensor
|
||||
G92 E0
|
||||
#SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=1
|
||||
|
||||
[gcode_macro SFS_DISABLE]
|
||||
description: Disable smart filament sensor
|
||||
gcode:
|
||||
M117 DISABLING the Smart Filament Sensor
|
||||
G92 E0
|
||||
#SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=0
|
||||
|
||||
[gcode_macro PRINT_START]
|
||||
gcode:
|
||||
_CHAMBER_LED_ON
|
||||
#PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}
|
||||
{% set BED_TEMP = params.BED|default(60)|float %}
|
||||
{% set EXTRUDER_TEMP = params.EXTRUDER|default(210)|float %}
|
||||
{% set CHAMBER = params.CHAMBER|default(35)|float %}
|
||||
{% if params.BED_TYPE %}
|
||||
INIT_BED_TYPE BED_TYPE="{params.BED_TYPE}"
|
||||
{% endif %}
|
||||
SAVE_GCODE_STATE NAME=start
|
||||
M117 Starting...
|
||||
M140 S{BED_TEMP}
|
||||
M141 S{CHAMBER}
|
||||
M109 S150
|
||||
M190 S{BED_TEMP}
|
||||
BED_MESH_CLEAR
|
||||
G90 # Use absolute coordinates
|
||||
#SET_GCODE_OFFSET Z=0.0
|
||||
G32
|
||||
#{% if not 'xyz' in printer.toolhead.homed_axes %}
|
||||
#G32 ; home all axes
|
||||
#{% elif not printer.quad_gantry_level.applied %}
|
||||
#QUAD_GANTRY_LEVEL
|
||||
#{% else %}
|
||||
#G28 Z10
|
||||
#{% endif %}
|
||||
START_BED_MESH_CALIBRATE #PRINT_MIN={params.PRINT_MIN} PRINT_MAX={params.PRINT_MAX} FORCE_NEW_MESH=True
|
||||
#M191 S{CHAMBER}
|
||||
Smart_Park
|
||||
M117 Heating...
|
||||
#M190 S{BED_TEMP}
|
||||
M109 S{EXTRUDER_TEMP} ; M109 heat and wait for it to reach temp
|
||||
SFS_ENABLE
|
||||
M117
|
||||
STATUS_CLEANING
|
||||
VORON_PURGE
|
||||
STATUS_PRINTING
|
||||
RESTORE_GCODE_STATE NAME=start
|
||||
SKEW_PROFILE LOAD=default
|
||||
#SET_SKEW XY=140.56,141.21,99.82
|
||||
|
||||
|
||||
|
||||
[gcode_macro PRINT_END]
|
||||
# Use PRINT_END for the slicer ending script - please customise for your slicer of choice
|
||||
variable_retract_amount: 16 #
|
||||
variable_park_speed: 6000 #3600
|
||||
variable_park_xy: [350,350]
|
||||
variable_up_z: 4 #12
|
||||
gcode:
|
||||
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
|
||||
STATUS_BUSY
|
||||
SET_SKEW CLEAR=1
|
||||
M400 ; wait for buffer to clear
|
||||
G92 E0 ; zero the extruder
|
||||
G1 E-{retract_amount} F3600 ; retract filament {max_velocity}
|
||||
G91 ; relative positioning
|
||||
G0 Z1.00 X20.0 Y20.0 F20000 ; move nozzle to remove stringing
|
||||
TURN_OFF_HEATERS
|
||||
M107 ; turn off fan
|
||||
G1 Z{up_z} F3000 ; move nozzle up 2mm
|
||||
G90 ; absolute positioning
|
||||
G0 X{park_xy[0]} Y{park_xy[1]} F{park_speed} ; park nozzle at rear
|
||||
#BED_MESH_CLEAR
|
||||
SFS_DISABLE
|
||||
#M141 S35
|
||||
SET_STEPPER_ENABLE STEPPER=extruder ENABLE=0 #disable stepper
|
||||
STATUS_OFF
|
||||
SET_VELOCITY_DEFAULT
|
||||
INIT_BED_TYPE BED_TYPE="None"
|
||||
M400
|
||||
TIMELAPSE_TAKE_FRAME
|
||||
|
||||
|
||||
|
||||
[gcode_macro SET_VELOCITY_DEFAULT]
|
||||
gcode:
|
||||
SET_VELOCITY_LIMIT ACCEL={printer.configfile.settings.printer.max_accel}
|
||||
SET_VELOCITY_LIMIT ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel / 2}
|
||||
SET_VELOCITY_LIMIT SQUARE_CORNER_VELOCITY={printer.configfile.settings.printer.square_corner_velocity}
|
||||
|
||||
|
||||
[gcode_macro M141]
|
||||
gcode:
|
||||
{% set s = params.S|default(0)|float %}
|
||||
SET_TEMPERATURE_FAN_TARGET temperature_fan=chamber target={s}
|
||||
|
||||
[gcode_macro M191]
|
||||
gcode:
|
||||
{% set s = params.S|default(0)|float %}
|
||||
M141 S{s}
|
||||
TEMPERATURE_WAIT SENSOR="temperature_fan chamber" MINIMUM={s}
|
||||
|
||||
|
||||
|
||||
[gcode_macro M600]
|
||||
gcode:
|
||||
#LCDRGB R=0 G=1 B=0 ; Turn LCD green
|
||||
PAUSE ; Pause
|
||||
|
||||
[gcode_macro PAUSE]
|
||||
rename_existing: BASE_PAUSE
|
||||
gcode:
|
||||
# Parameters
|
||||
{% set z = params.Z|default(10)|int %} ; z hop amount
|
||||
|
||||
{% if printer['pause_resume'].is_paused|int == 0 %}
|
||||
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE={z} ; set z hop variable for reference in resume macro
|
||||
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=etemp VALUE={printer['extruder'].target} ; set hotend temp variable for reference in resume macro
|
||||
|
||||
SFS_DISABLE ; disable filament sensor
|
||||
SAVE_GCODE_STATE NAME=PAUSE ; save current print position for resume
|
||||
BASE_PAUSE ; pause print
|
||||
{% if (printer.gcode_move.position.z + z) < printer.toolhead.axis_maximum.z %} ; check that zhop doesn't exceed z max
|
||||
G91 ; relative positioning
|
||||
G1 Z{z} F900 ; raise Z up by z hop amount
|
||||
{% else %}
|
||||
{ action_respond_info("Pause zhop exceeds maximum Z height.") } ; if z max is exceeded, show message and set zhop value for resume to 0
|
||||
SET_GCODE_VARIABLE MACRO=RESUME VARIABLE=zhop VALUE=0
|
||||
{% endif %}
|
||||
G90 ; absolute positioning
|
||||
G1 X{printer.toolhead.axis_maximum.x/2} Y{printer.toolhead.axis_minimum.y+5} F6000 ; park toolhead at front center
|
||||
SAVE_GCODE_STATE NAME=PAUSEPARK ; save parked position in case toolhead is moved during the pause (otherwise the return zhop can error)
|
||||
M104 S0 ; turn off hotend
|
||||
SET_IDLE_TIMEOUT TIMEOUT=43200 ; set timeout to 12 hours
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro RESUME]
|
||||
rename_existing: BASE_RESUME
|
||||
variable_zhop: 0
|
||||
variable_etemp: 0
|
||||
gcode:
|
||||
# Parameters
|
||||
{% set e = params.E|default(2.5)|int %}
|
||||
|
||||
{% if printer['pause_resume'].is_paused|int == 1 %}
|
||||
SFS_ENABLE ; enable filament sensor
|
||||
#RESETRGB ; reset LCD color
|
||||
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ; set timeout back to configured value
|
||||
{% if etemp > 0 %}
|
||||
M109 S{etemp|int} ; wait for hotend to heat back up
|
||||
{% endif %}
|
||||
RESTORE_GCODE_STATE NAME=PAUSEPARK MOVE=1 MOVE_SPEED=100 ; go back to parked position in case toolhead was moved during pause (otherwise the return zhop can error)
|
||||
G91 ; relative positioning
|
||||
M83 ; relative extruder positioning
|
||||
{% if printer[printer.toolhead.extruder].temperature >= printer.configfile.settings.extruder.min_extrude_temp %}
|
||||
G1 Z{zhop * -1} E{e} F900 ; prime nozzle by E, lower Z back down
|
||||
{% else %}
|
||||
G1 Z{zhop * -1} F900 ; lower Z back down without priming (just in case we are testing the macro with cold hotend)
|
||||
{% endif %}
|
||||
RESTORE_GCODE_STATE NAME=PAUSE MOVE=1 MOVE_SPEED=60 ; restore position
|
||||
BASE_RESUME ; resume print
|
||||
{% endif %}
|
||||
|
||||
[gcode_macro CANCEL_PRINT]
|
||||
description: Cancel the actual running print
|
||||
rename_existing: CANCEL_PRINT_BASE
|
||||
gcode:
|
||||
SET_IDLE_TIMEOUT TIMEOUT={printer.configfile.settings.idle_timeout.timeout} ;
|
||||
CLEAR_PAUSE
|
||||
SDCARD_RESET_FILE
|
||||
PRINT_END
|
||||
CANCEL_PRINT_BASE
|
||||
|
||||
|
||||
|
||||
[gcode_macro DUMP_PARAMETERS]
|
||||
gcode:
|
||||
{% for name1 in printer %}
|
||||
{% for name2 in printer[name1] %}
|
||||
{ action_respond_info("printer['%s'].%s = %s" % (name1, name2, printer[name1][name2])) }
|
||||
{% else %}
|
||||
{ action_respond_info("printer['%s'] = %s" % (name1, printer[name1])) }
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
[gcode_macro M109]
|
||||
rename_existing: M99109
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=heating_nozzle VALUE=True
|
||||
STATUS_HEATING
|
||||
{% set s = params.S|float %}
|
||||
|
||||
{% if s != 0 %}
|
||||
M104 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set hotend temp
|
||||
TEMPERATURE_WAIT SENSOR=extruder MINIMUM={s} MAXIMUM={s+1} ; Wait for hotend temp (within 1 degree)
|
||||
{% endif %}
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=heating_nozzle VALUE=False
|
||||
STATUS_OFF
|
||||
|
||||
[gcode_macro M190]
|
||||
rename_existing: M99190
|
||||
gcode:
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=heating_bed VALUE=True
|
||||
STATUS_HEATING
|
||||
{% set s = params.S|float %}
|
||||
|
||||
{% if s != 0 %}
|
||||
M140 {% for p in params %}{'%s%s' % (p, params[p])}{% endfor %} ; Set bed temp
|
||||
TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={s} MAXIMUM={s+1} ; Wait for bed temp (within 1 degree)
|
||||
{% endif %}
|
||||
SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=heating_bed VALUE=False
|
||||
STATUS_OFF
|
||||
|
||||
[gcode_macro DISABLE_XY]
|
||||
gcode:
|
||||
SET_STEPPER_ENABLE STEPPER=stepper_x ENABLE=0
|
||||
SET_STEPPER_ENABLE STEPPER=stepper_y ENABLE=0
|
||||
|
||||
[gcode_macro INIT_BED_TYPE]
|
||||
variable_bed_z_offset: 0
|
||||
variable_bed_types: { 'Textured PEI Plate': 0.00, 'None': 0 }
|
||||
gcode:
|
||||
{% set bed_type = params.BED_TYPE|default("None") %}
|
||||
{% set new_bed_z_offset = bed_types[bed_type] %}
|
||||
{% if bed_z_offset != 0 %}
|
||||
SET_GCODE_OFFSET Z_ADJUST={0-bed_z_offset|float}
|
||||
SET_GCODE_VARIABLE MACRO=INIT_BED_TYPE VARIABLE=bed_z_offset VALUE=0
|
||||
{% endif %}
|
||||
{ action_respond_info("Selected bed type: {}".format(bed_type)) }
|
||||
{ action_respond_info("Used bed z offset: {}".format(bed_z_offset)) }
|
||||
{% if new_bed_z_offset %}
|
||||
{ action_respond_info("Use bed type {} with z offset {}".format(bed_type, new_bed_z_offset)) }
|
||||
SET_GCODE_VARIABLE MACRO=INIT_BED_TYPE VARIABLE=bed_z_offset VALUE={new_bed_z_offset}
|
||||
SET_GCODE_OFFSET Z_ADJUST={new_bed_z_offset}
|
||||
{% endif %}
|
||||
|
||||
|
||||
[gcode_macro LOAD_FILAMENT]
|
||||
variable_load_distance: 72
|
||||
variable_purge_distance: 0
|
||||
gcode:
|
||||
{% set speed = params.SPEED|default(300) %}
|
||||
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
|
||||
SAVE_GCODE_STATE NAME=load_state
|
||||
G91
|
||||
G92 E0
|
||||
G1 E{load_distance} F{max_velocity} # fast-load
|
||||
G1 E{purge_distance} F{speed} # purge
|
||||
RESTORE_GCODE_STATE NAME=load_state
|
||||
|
||||
[gcode_macro UNLOAD_FILAMENT]
|
||||
variable_unload_distance: 76
|
||||
variable_purge_distance: 0
|
||||
gcode:
|
||||
{% set speed = params.SPEED|default(300) %}
|
||||
{% set max_velocity = printer.configfile.settings['extruder'].max_extrude_only_velocity * 60 %}
|
||||
SAVE_GCODE_STATE NAME=unload_state
|
||||
G91
|
||||
G92 E0
|
||||
G1 E{purge_distance} F{speed} # purge
|
||||
G1 E-{unload_distance} F{max_velocity} # fast-unload
|
||||
RESTORE_GCODE_STATE NAME=unload_state
|
||||
|
||||
|
||||
[gcode_macro test_speed_fast]
|
||||
gcode:
|
||||
G28 X0 Y0
|
||||
GET_POSITION
|
||||
G1 X0 Y0 F27000
|
||||
G1 X350 Y350 F27000
|
||||
G1 X0 Y0 F27000
|
||||
G1 X350 Y350 F27000
|
||||
|
||||
G1 X0 Y350 F36000
|
||||
|
||||
G1 X350 Y0 F27000
|
||||
G1 X0 Y350 F27000
|
||||
G1 X350 Y0 F27000
|
||||
G1 X0 Y350 F27000
|
||||
|
||||
G1 X0 Y0 F36000
|
||||
G1 X350 Y0 F36000
|
||||
G1 X350 Y350 F36000
|
||||
G1 X0 Y350 F36000
|
||||
G1 X0 Y0 F36000
|
||||
#DISABLE_XY
|
||||
G28 X0 Y0
|
||||
GET_POSITION
|
||||
|
||||
[gcode_macro TEST_SPEED]
|
||||
# Home, get position, throw around toolhead, home again.
|
||||
# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured.
|
||||
# We only measure to a full step to accomodate for endstop variance.
|
||||
# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10
|
||||
# https://github.com/AndrewEllis93/Print-Tuning-Guide/blob/main/articles/determining_max_speeds_accels.md
|
||||
|
||||
description: Test for max speed and acceleration parameters for the printer. Procedure: Home -> ReadPositionFromMCU -> MovesToolhead@Vel&Accel -> Home -> ReadPositionfromMCU
|
||||
|
||||
gcode:
|
||||
# Speed
|
||||
{% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %}
|
||||
# Iterations
|
||||
{% set iterations = params.ITERATIONS|default(5)|int %}
|
||||
# Acceleration
|
||||
{% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %}
|
||||
# Minimum Cruise Ratio
|
||||
{% set min_cruise_ratio = params.MIN_CRUISE_RATIO|default(0.5)|float %}
|
||||
# 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(20)|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:
|
||||
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
|
||||
G28
|
||||
# QGL if not already QGLd (only if QGL section exists in config)
|
||||
{% if printer.configfile.settings.quad_gantry_level %}
|
||||
{% if printer.quad_gantry_level.applied == False %}
|
||||
QUAD_GANTRY_LEVEL
|
||||
G28 Z
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
# Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24)
|
||||
G90
|
||||
G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60}
|
||||
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
|
||||
G28 X Y
|
||||
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
|
||||
G4 P1000
|
||||
GET_POSITION
|
||||
|
||||
# Go to starting position
|
||||
G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60}
|
||||
|
||||
# Set new limits
|
||||
{% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %}
|
||||
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} MINIMUM_CRUISE_RATIO={min_cruise_ratio}
|
||||
{% else %}
|
||||
SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2}
|
||||
{% endif %}
|
||||
|
||||
{% 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}
|
||||
|
||||
# Large pattern 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 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 pattern box
|
||||
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 %}
|
||||
|
||||
# Restore max speed/accel/accel_to_decel to their configured values
|
||||
{% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %}
|
||||
SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} MINIMUM_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio}
|
||||
{% else %}
|
||||
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}
|
||||
{% endif %}
|
||||
|
||||
# Re-home and get position again for comparison:
|
||||
M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66
|
||||
G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12
|
||||
# Go to XY home positions (in case your homing override leaves it elsewhere)
|
||||
G90
|
||||
G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60}
|
||||
G4 P1000
|
||||
GET_POSITION
|
||||
|
||||
# Restore previous gcode state (absolute/relative, etc)
|
||||
RESTORE_GCODE_STATE NAME=TEST_SPEED
|
||||
|
||||
[gcode_macro test]
|
||||
gcode:
|
||||
{% set iterations = params.ITERATIONS|default(5)|int %}
|
||||
;G32
|
||||
SAVE_GCODE_STATE NAME=TEST
|
||||
G1 Z10
|
||||
;SET_VELOCITY_LIMIT ACCEL=8000
|
||||
SET_VELOCITY_LIMIT ACCEL=10000 SQUARE_CORNER_VELOCITY=12
|
||||
{% for i in range(iterations) %}
|
||||
G1 F18000
|
||||
G1 X300 Y300
|
||||
G1 X150 Y50
|
||||
{% endfor %}
|
||||
SET_VELOCITY_DEFAULT
|
||||
RESTORE_GCODE_STATE NAME=TEST
|
||||
|
||||
|
||||
[gcode_macro _bot_data]
|
||||
variable_lapse_video_size: 0
|
||||
variable_lapse_filename: 'None'
|
||||
variable_lapse_path: 'None'
|
||||
gcode:
|
||||
M118 Setting bot lapse variables
|
||||
Reference in New Issue
Block a user