677 lines
22 KiB
INI
677 lines
22 KiB
INI
|
#[include kiauh_macros.cfg]
|
||
|
#
|
||
|
# Klipper configuration file for Anycubic i3 MEGA S
|
||
|
#
|
||
|
# This config file contains settings of all printer pins (steppers, sensors) for Anycubic i3 mega S in the factory configuration
|
||
|
# Klipper firmware should be compiled for the atmega2560
|
||
|
#
|
||
|
# Config file includes
|
||
|
# - Original or 2208(2209) rotated by cabel drivers
|
||
|
# - Mesh bed leveling: BLtouch (3DTouch sensor from Triangelab)
|
||
|
# - Manual meshed bed leveling (commented out)
|
||
|
# - 'virtual_sdcard' for fast printing without gaps
|
||
|
# - Beeper through M300 gcode
|
||
|
# - Pause/Resume through M600 for filament change
|
||
|
#
|
||
|
# Home position is determined by 3DTouch. Z limit switches are not used.
|
||
|
#
|
||
|
# The latest version of the config reference is also available online at:
|
||
|
# https://www.klipper3d.org/Config_Reference.html
|
||
|
|
||
|
[mcu]
|
||
|
serial =/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
|
||
|
|
||
|
[printer]
|
||
|
kinematics = cartesian
|
||
|
max_velocity = 400
|
||
|
max_accel = 10000
|
||
|
max_accel_to_decel = 2500
|
||
|
max_z_velocity = 7
|
||
|
max_z_accel = 190
|
||
|
square_corner_velocity = 5
|
||
|
|
||
|
[z_tilt]
|
||
|
z_positions: -20,15
|
||
|
80,15
|
||
|
points: 1,120
|
||
|
170,120
|
||
|
speed: 500
|
||
|
horizontal_move_z: 10
|
||
|
retries: 10
|
||
|
retry_tolerance: 0.025
|
||
|
|
||
|
[bed_screws]
|
||
|
screw1: 2, 42
|
||
|
screw2: 172, 42
|
||
|
screw3: 2, 204
|
||
|
screw4: 172, 204
|
||
|
|
||
|
#[mcu rpi]
|
||
|
#serial: /tmp/klipper_host_mcu
|
||
|
|
||
|
#[adxl345]
|
||
|
#cs_pin: rpi:None
|
||
|
|
||
|
#[resonance_tester]
|
||
|
#accel_chip: adxl345
|
||
|
#probe_points:
|
||
|
# 100, 100, 20 # an example
|
||
|
|
||
|
|
||
|
[stepper_x]
|
||
|
step_pin = PF0
|
||
|
dir_pin = !PF1
|
||
|
enable_pin = !PD7
|
||
|
rotation_distance = 40
|
||
|
endstop_pin = ^!PE5
|
||
|
position_min = -5
|
||
|
position_endstop = -5
|
||
|
position_max = 210
|
||
|
homing_speed = 30
|
||
|
homing_retract_dist = 5
|
||
|
second_homing_speed = 10
|
||
|
microsteps = 16
|
||
|
|
||
|
|
||
|
[stepper_y]
|
||
|
step_pin = PF6
|
||
|
dir_pin = PF7
|
||
|
enable_pin = !PF2
|
||
|
rotation_distance = 40
|
||
|
endstop_pin = ^!PL7
|
||
|
position_endstop = 0
|
||
|
position_max = 210
|
||
|
homing_speed = 50
|
||
|
homing_retract_dist = 5
|
||
|
second_homing_speed = 10
|
||
|
microsteps = 16
|
||
|
|
||
|
[stepper_z]
|
||
|
step_pin = PC1
|
||
|
dir_pin = PL1
|
||
|
enable_pin = !PK0
|
||
|
rotation_distance = 8
|
||
|
position_min: -5
|
||
|
microsteps = 16
|
||
|
|
||
|
|
||
|
## for 3dtouch. comment for mannual mesh bed leveling
|
||
|
endstop_pin = probe:z_virtual_endstop
|
||
|
## uncomment below for manual mesh bed leveling and to enable Z limit switches
|
||
|
#endstop_pin = ^!ar18
|
||
|
#position_endstop = 0.0
|
||
|
|
||
|
position_max = 205
|
||
|
homing_speed = 50
|
||
|
homing_retract_dist = 5
|
||
|
second_homing_speed = 3
|
||
|
|
||
|
|
||
|
[stepper_z1]
|
||
|
step_pin = PL3
|
||
|
dir_pin = PC3
|
||
|
|
||
|
## uncomment below for manual mesh bed leveling and to enable Z limit switches
|
||
|
#endstop_pin = ^!ar43
|
||
|
|
||
|
enable_pin = !PC7
|
||
|
rotation_distance = 8
|
||
|
microsteps = 16
|
||
|
|
||
|
[extruder]
|
||
|
step_pin = PA4
|
||
|
dir_pin = !PA6
|
||
|
enable_pin = !PA2
|
||
|
control = pid
|
||
|
|
||
|
## original extruder stepper motor
|
||
|
#rotation_distance = 8.16
|
||
|
## NEMA17 23mm stepper motor
|
||
|
rotation_distance = 7.552
|
||
|
|
||
|
nozzle_diameter = 0.400
|
||
|
filament_diameter = 1.750
|
||
|
heater_pin = PB4
|
||
|
sensor_type = ATC Semitec 104GT-2
|
||
|
sensor_pin = PK5
|
||
|
min_temp = 0
|
||
|
max_temp = 285
|
||
|
max_extrude_only_distance = 150.0
|
||
|
smooth_time = 1
|
||
|
min_extrude_temp = 180
|
||
|
pressure_advance = 0.0526
|
||
|
max_extrude_cross_section = 150
|
||
|
pid_Kp: 15.717
|
||
|
pid_Ki: 0.569
|
||
|
pid_Kd: 108.451
|
||
|
min_temp: 0
|
||
|
max_temp: 300
|
||
|
microsteps = 16
|
||
|
|
||
|
|
||
|
[heater_fan extruder_fan]
|
||
|
pin = PL5
|
||
|
|
||
|
[heater_bed]
|
||
|
heater_pin: PH5
|
||
|
sensor_type: EPCOS 100K B57560G104F
|
||
|
sensor_pin: PK6
|
||
|
control: pid
|
||
|
pid_Kp: 61.970
|
||
|
pid_Ki: 4.860
|
||
|
pid_Kd: 197.528
|
||
|
min_temp: 0
|
||
|
max_temp: 150
|
||
|
|
||
|
[fan]
|
||
|
pin = PH6
|
||
|
|
||
|
[output_pin BEEPER_pin]
|
||
|
pin: PC6
|
||
|
pwm: True
|
||
|
value: 0
|
||
|
shutdown_value: 0
|
||
|
cycle_time: 0.001
|
||
|
scale: 1000
|
||
|
|
||
|
## do your own measurement
|
||
|
## https://www.klipper3d.org/Resonance_Compensation.html
|
||
|
[input_shaper]
|
||
|
shaper_type_x = 3hump_ei
|
||
|
shaper_freq_x = 73.0
|
||
|
shaper_type_y = 3hump_ei
|
||
|
shaper_freq_y = 60.0
|
||
|
|
||
|
[heater_fan stepstick_fan]
|
||
|
pin = PH4
|
||
|
|
||
|
[bltouch]
|
||
|
sensor_pin = ^PE4
|
||
|
control_pin = PB5
|
||
|
|
||
|
## do your own measurement
|
||
|
x_offset = 20
|
||
|
y_offset = -14
|
||
|
z_offset = 0.525
|
||
|
|
||
|
[safe_z_home]
|
||
|
home_xy_position = 100,100
|
||
|
speed = 300
|
||
|
z_hop = 5
|
||
|
z_hop_speed = 10
|
||
|
|
||
|
|
||
|
## bltouch mesh bed leveling
|
||
|
[bed_mesh]
|
||
|
speed = 1000
|
||
|
horizontal_move_z = 4
|
||
|
mesh_min = 23,28
|
||
|
mesh_max = 190,190
|
||
|
probe_count = 5,5
|
||
|
fade_start = 1.0
|
||
|
fade_end = 10.0
|
||
|
algorithm = bicubic
|
||
|
|
||
|
|
||
|
## manual mesh bed leveling
|
||
|
#[bed_mesh]
|
||
|
#speed = 50
|
||
|
#horizontal_move_z = 5
|
||
|
#mesh_min = 30,30
|
||
|
#mesh_max = 180,180
|
||
|
#probe_count = 5,5
|
||
|
#fade_start = 1.0
|
||
|
#fade_end = 10.0
|
||
|
|
||
|
|
||
|
# enable moving befor homing
|
||
|
## put in terminal:
|
||
|
## SET_KINEMATIC_POSITION X=100 Y=100 Z=100
|
||
|
## then move as usual
|
||
|
[force_move]
|
||
|
enable_force_move: True
|
||
|
|
||
|
[virtual_sdcard]
|
||
|
path: ~/gcode_files
|
||
|
|
||
|
|
||
|
[output_pin BEEPER_pin]
|
||
|
pin: PC6
|
||
|
pwm: True
|
||
|
value: 0
|
||
|
shutdown_value: 0
|
||
|
cycle_time: 0.001
|
||
|
scale: 1000
|
||
|
|
||
|
[display_status]
|
||
|
|
||
|
# change filament
|
||
|
[pause_resume]
|
||
|
|
||
|
#*# <---------------------- SAVE_CONFIG ---------------------->
|
||
|
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
|
||
|
#*#
|
||
|
#*# [bltouch]
|
||
|
#*# z_offset = 1.320
|
||
|
|
||
|
[virtual_sdcard]
|
||
|
path: /home/pi/gcode_files
|
||
|
|
||
|
[pause_resume]
|
||
|
|
||
|
[display_status]
|
||
|
|
||
|
[gcode_macro CANCEL_PRINT]
|
||
|
description: Cancel the actual running print
|
||
|
rename_existing: CANCEL_PRINT_BASE
|
||
|
gcode:
|
||
|
TURN_OFF_HEATERS
|
||
|
CANCEL_PRINT_BASE
|
||
|
|
||
|
[gcode_macro M600]
|
||
|
gcode:
|
||
|
{% set X = params.X|default(50)|float %}
|
||
|
{% set Y = params.Y|default(0)|float %}
|
||
|
{% set Z = params.Z|default(10)|float %}
|
||
|
SAVE_GCODE_STATE NAME=M600_state
|
||
|
PAUSE
|
||
|
G91
|
||
|
G1 E-.8 F2700
|
||
|
G1 Z{Z}
|
||
|
G90
|
||
|
G1 X{X} Y{Y} F3000
|
||
|
G91
|
||
|
G1 E-150 F1000
|
||
|
M300 S299 P200
|
||
|
M300 S299 P200
|
||
|
M300 S299 P200
|
||
|
M300 S299 P200
|
||
|
M300 S299 P200
|
||
|
RESTORE_GCODE_STATE NAME=M600_state
|
||
|
|
||
|
[gcode_macro PRINT_END]
|
||
|
gcode: |
|
||
|
M104 S0 ; turn off temperature
|
||
|
M140 S0 ; turn off heatbed
|
||
|
M107 ; turn off fan
|
||
|
g91
|
||
|
G1 Z1
|
||
|
g90
|
||
|
G1 X0 Y180 F3000 ; home X axis
|
||
|
M84 ; disable motor
|
||
|
BED_MESH_CLEAR
|
||
|
|
||
|
[gcode_macro CANCEL_PRINT]
|
||
|
description: Cancel the actual running print
|
||
|
rename_existing: CANCEL_PRINT_BASE
|
||
|
gcode:
|
||
|
TURN_OFF_HEATERS
|
||
|
CANCEL_PRINT_BASE
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
[gcode_macro M300]
|
||
|
gcode:
|
||
|
# Use a default 1kHz tone if S is omitted.
|
||
|
{% set S = params.S|default(1000)|int %}
|
||
|
# Use a 10ms duration is P is omitted.
|
||
|
{% set P = params.P|default(100)|int %}
|
||
|
SET_PIN PIN=BEEPER_pin VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 }
|
||
|
G4 P{P}
|
||
|
SET_PIN PIN=BEEPER_pin VALUE=0
|
||
|
|
||
|
|
||
|
[gcode_macro PAUSE]
|
||
|
description: Pause the actual running print
|
||
|
rename_existing: PAUSE_BASE
|
||
|
# change this if you need more or less extrusion
|
||
|
variable_extrude: 1.0
|
||
|
gcode:
|
||
|
##### read E from pause macro #####
|
||
|
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
|
||
|
##### set park positon for x and y #####
|
||
|
# default is your max posion from your printer.cfg
|
||
|
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
|
||
|
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
|
||
|
##### calculate save lift position #####
|
||
|
{% set max_z = printer.toolhead.axis_maximum.z|float %}
|
||
|
{% set act_z = printer.toolhead.position.z|float %}
|
||
|
{% if act_z < (max_z - 2.0) %}
|
||
|
{% set z_safe = 2.0 %}
|
||
|
{% else %}
|
||
|
{% set z_safe = max_z - act_z %}
|
||
|
{% endif %}
|
||
|
##### end of definitions #####
|
||
|
PAUSE_BASE
|
||
|
G91
|
||
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
||
|
G1 E-{E} F2100
|
||
|
{% else %}
|
||
|
{action_respond_info("Extruder not hot enough")}
|
||
|
{% endif %}
|
||
|
{% if "xyz" in printer.toolhead.homed_axes %}
|
||
|
G1 Z{z_safe} F900
|
||
|
G90
|
||
|
G1 X{x_park} Y{y_park} F6000
|
||
|
{% else %}
|
||
|
{action_respond_info("Printer not homed")}
|
||
|
{% endif %}
|
||
|
|
||
|
[gcode_macro RESUME]
|
||
|
description: Resume the actual running print
|
||
|
rename_existing: RESUME_BASE
|
||
|
gcode:
|
||
|
##### read E from pause macro #####
|
||
|
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
|
||
|
#### get VELOCITY parameter if specified ####
|
||
|
{% if 'VELOCITY' in params|upper %}
|
||
|
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
|
||
|
{%else %}
|
||
|
{% set get_params = "" %}
|
||
|
{% endif %}
|
||
|
##### end of definitions #####
|
||
|
{% if printer.extruder.can_extrude|lower == 'true' %}
|
||
|
G91
|
||
|
G1 E{E} F2100
|
||
|
{% else %}
|
||
|
{action_respond_info("Extruder not hot enough")}
|
||
|
{% endif %}
|
||
|
RESUME_BASE {get_params}
|
||
|
|
||
|
[gcode_macro PRINT_END]
|
||
|
gcode: |
|
||
|
M104 S0 ; turn off temperature
|
||
|
M140 S0 ; turn off heatbed
|
||
|
M107 ; turn off fan
|
||
|
g91
|
||
|
G1 Z1
|
||
|
g90
|
||
|
G1 X0 Y180 F3000 ; home X axis
|
||
|
M84 ; disable motor
|
||
|
BED_MESH_CLEAR
|
||
|
|
||
|
[gcode_macro UNLOAD_FILAMENT]
|
||
|
gcode:
|
||
|
{% if (not(printer.idle_timeout.state == "Printing") or printer.pause_resume.is_paused) %}
|
||
|
SAVE_GCODE_STATE NAME=UNLOAD_state
|
||
|
|
||
|
M83 ; set extruder to relative
|
||
|
G1 E5 F450 ; quick purge
|
||
|
G1 E-4 F1800 ; fast retract
|
||
|
G1 E-16 F1200 ; retract
|
||
|
SLEEP MS=1000 ; wait for filament to cool
|
||
|
G1 E-10 F300 ; slow retract purge
|
||
|
G1 E-50 F2000 ; load (multiple times to avoid length limit)
|
||
|
G1 E-50 F2000
|
||
|
G1 E-50 F2000
|
||
|
G1 E-50 F2000
|
||
|
G1 E-50 F2000
|
||
|
G1 E-50 F2000
|
||
|
G1 E-50 F2000
|
||
|
G1 E-50 F2000
|
||
|
M117 Filament unloaded
|
||
|
|
||
|
UPDATE_DELAYED_GCODE ID=SCHEDULE_CLEAR_SCREEN DURATION=5
|
||
|
RESTORE_GCODE_STATE NAME=UNLOAD_state
|
||
|
{% else %}
|
||
|
{ action_respond_info("Filament unloading disabled while printing!") }
|
||
|
{% endif %}
|
||
|
|
||
|
[gcode_macro BED_MESH_CALIBRATE]
|
||
|
rename_existing: BED_MESH_CALIBRATE_BASE
|
||
|
; 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 : 1
|
||
|
; minimum probe count
|
||
|
variable_min_probe_count : 3
|
||
|
; scale up the probe count, should be 1.0 ~ < variable_max_probe_count/variable_min_probe_count
|
||
|
variable_probe_count_scale_factor : 1.0
|
||
|
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]|int %}
|
||
|
{% set meshPointY = bedMeshConfig.probe_count.split(",")[1]|int %}
|
||
|
|
||
|
{% set meshMaxPointX = meshPointX %}
|
||
|
{% set meshMaxPointY = meshPointY %}
|
||
|
|
||
|
|
||
|
{% 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) * probe_count_scale_factor)|round(0)|int %}
|
||
|
{% if meshPointX < min_probe_count %}
|
||
|
{% set meshPointX = min_probe_count %}
|
||
|
{% endif %}
|
||
|
{% if meshPointX > meshMaxPointX %}
|
||
|
{% set meshPointX = meshMaxPointX %}
|
||
|
{% endif %}
|
||
|
|
||
|
{% set meshPointY = (meshPointY * (area_max_y -area_min_y ) / (safe_max_y - safe_min_y) * probe_count_scale_factor )|round(0)|int %}
|
||
|
{% if meshPointY < min_probe_count %}
|
||
|
{% set meshPointY = min_probe_count %}
|
||
|
{% endif %}
|
||
|
{% if meshPointY > meshMaxPointY %}
|
||
|
{% set meshPointY = meshMaxPointY %}
|
||
|
{% endif %}
|
||
|
|
||
|
BED_MESH_CALIBRATE_BASE 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_BASE
|
||
|
{% endif %}
|
||
|
{% else %}
|
||
|
BED_MESH_CALIBRATE_BASE
|
||
|
{% endif %}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
[gcode_macro PA_CALIBRATE]
|
||
|
gcode:
|
||
|
######################################################################################
|
||
|
#### DEFINE USER PARAMETERS ###
|
||
|
######################################################################################
|
||
|
###############################[ set printer parameters ]#############################
|
||
|
{% set nozzle_diameter = printer.configfile.config.extruder.nozzle_diameter | float %}
|
||
|
{% set bed_size_x = 218 | float %}
|
||
|
{% set bed_size_y = 181 | float %}
|
||
|
{% set retract = 0.4 | float %}
|
||
|
{% set retract_speed = 40 * 60 | float %}
|
||
|
######################[ set parameters for extrusion calculation ]####################
|
||
|
{% set filament_diameter = params.FD | default(1.75) | float %}
|
||
|
{% set layer_height = params.LH | default(0.2) | float %}
|
||
|
{% set nozzle_line_ratio = params.EW | default(1.2) | float %}
|
||
|
{% set extrusion_multiplier = params.EM | default(1.0) | float %}
|
||
|
################################[ set temperatures ]##################################
|
||
|
{% set bed_temp = params.TBED | default(60) %}
|
||
|
{% set extruder_temp = params.TEX | default(185) %}
|
||
|
###############################[ set test parameters ]################################
|
||
|
{% set slow_speed = params.SLOW_SPEED | default(25) | float %}
|
||
|
{% set slow_length = params.SLOW_LENGTH | default(20) | float %}
|
||
|
{% set fast_speed = params.FAST_SPEED | default(80) | float %}
|
||
|
{% set fast_length = params.FAST_LENGTH | default(40) | float %}
|
||
|
{% set travel_speed = params.TRAVEL_SPEED | default(180) | float %}
|
||
|
{% set pa_start = params.PA_START | default(0.0) | float %}
|
||
|
{% set pa_end = params.PA_END | default(0.25) | float %}
|
||
|
{% set pa_step = params.PA_STEP | default(0.01) | float %}
|
||
|
{% set line_spacing = params.SPACING | default(5) | float %}
|
||
|
######################################################################################
|
||
|
#### !!! DO NOT EDIT BELOW !!! ###
|
||
|
######################################################################################
|
||
|
{% set spacing = line_spacing %}
|
||
|
{% set fd = filament_diameter %}
|
||
|
{% set nd = nozzle_diameter %}
|
||
|
{% set ew = nozzle_diameter * nozzle_line_ratio %}
|
||
|
{% set em = extrusion_multiplier %}
|
||
|
{% set lh = layer_height %}
|
||
|
{% set pa = pa_start %}
|
||
|
##################################[ calculations ]####################################
|
||
|
{% set slow_speed = slow_speed * 60 | float %}
|
||
|
{% set fast_speed = fast_speed * 60 | float %}
|
||
|
{% set travel_speed = travel_speed * 60 | float %}
|
||
|
{% set lines = (((pa_end - pa_start) / pa_step) + 1) | round(0, 'ceil') | int %}
|
||
|
{% set p_width = ((2 * slow_length + fast_length)) %}
|
||
|
{% set p_height = (lines * (spacing + (nd * ew))) %}
|
||
|
{% set p_width_total = p_width + 20 %}
|
||
|
{% set p_height_total = p_height + 40 %}
|
||
|
{% set start_x_pos = (bed_size_x - p_width) / 2 %}
|
||
|
{% set end_x_pos = (bed_size_x + p_width) / 2 %}
|
||
|
{% set start_y_pos = (bed_size_y - p_height) / 2 %}
|
||
|
{% set end_y_pos = (bed_size_y + p_height) / 2 %}
|
||
|
{% set x_pos = start_x_pos %}
|
||
|
{% set y_pos = start_y_pos %}
|
||
|
########################[ check if test patter fits on bed ]##########################
|
||
|
{% if p_height_total > bed_size_y or p_width_total > bed_size_x %}
|
||
|
{% set exceeds_bed_area = true %}
|
||
|
{% else %}
|
||
|
{% set exceeds_bed_area = false %}
|
||
|
{% endif %}
|
||
|
######################################################################################
|
||
|
### Using Slic3r flow math to calculate extrusion amounts: ###
|
||
|
######################################################################################
|
||
|
### V_in = (pi * fd ** 2) / 4 * E ###
|
||
|
### V_out = A * L * em ###
|
||
|
### V_in = V_out ###
|
||
|
### A = (ew - lh) * lh + pi * (lh / 2) ** 2 ###
|
||
|
### E = ((A * L * 4) / (pi * fd ** 2)) * em ###
|
||
|
######################################################################################
|
||
|
{% set pi = 3.141592654 | float %}
|
||
|
{% set A = (ew - lh) * lh + pi * (lh / 2) ** 2 | float %}
|
||
|
{% set E_prime = (((A * p_height * 4) / (pi * fd ** 2)) * 1.6) | round(6, 'ceil') %}
|
||
|
{% set E_slow = (((A * slow_length * 4) / (pi * fd ** 2)) * em) | round(6, 'ceil') %}
|
||
|
{% set E_fast = (((A * fast_length * 4) / (pi * fd ** 2)) * em) | round(6, 'ceil') %}
|
||
|
{% set E_mark = (((A * 20 * 4) / (pi * fd ** 2)) * em) | round(6, 'ceil') %}
|
||
|
######################################################################################
|
||
|
### START CALIBRATION ###
|
||
|
M190 S{ bed_temp }
|
||
|
M109 S{ extruder_temp }
|
||
|
G28
|
||
|
### PRIME NOZZLE ###
|
||
|
M83 ; set relative extrusion mode
|
||
|
G1 X{ x_pos - 10 } Y{ y_pos } F{ travel_speed } ; move to prime line start
|
||
|
G1 Z{ layer_height } ; move Z down
|
||
|
G1 Y{ y_pos + p_height } E{ E_prime } F { slow_speed } ; print first prime line
|
||
|
G1 X{ x_pos - 5 } F{ travel_speed } ; move to second prime line start
|
||
|
G1 Y{ y_pos } E{ E_prime } F { slow_speed } ; print second prime line
|
||
|
G92 E0
|
||
|
### START TEST PATTERN ###
|
||
|
SET_PRESSURE_ADVANCE EXTRUDER=extruder ADVANCE={ pa }
|
||
|
{% for i in range(lines) %}
|
||
|
{% if not loop.first %}
|
||
|
{% set y_pos = y_pos + (i * (spacing + ew)) %}
|
||
|
{% set pa = pa + (i * pa_step) %}
|
||
|
SET_PRESSURE_ADVANCE EXTRUDER=extruder ADVANCE={ pa }
|
||
|
{% endif %}
|
||
|
M117 PA={ pa }
|
||
|
### move to line starting postion
|
||
|
G1 X{ x_pos } Y{ y_pos } F{ travel_speed }
|
||
|
G1 E{ retract } F{ retract_speed } ; un-retract
|
||
|
### print first slow part
|
||
|
{% set x_pos = x_pos + slow_length %}
|
||
|
G1 X{ x_pos } Y{ y_pos } E{ E_slow } F{ slow_speed }
|
||
|
### print fast part
|
||
|
{% set x_pos = x_pos + fast_length %}
|
||
|
G1 X{ x_pos } Y{ y_pos } E{ E_fast } F{ fast_speed }
|
||
|
### print second slow part
|
||
|
{% set x_pos = x_pos + slow_length %}
|
||
|
G1 X{ x_pos } Y{ y_pos } E{ E_slow } F{ slow_speed }
|
||
|
G1 E-{ retract } F{ retract_speed } ; retract
|
||
|
### reset x position
|
||
|
{% set x_pos = start_x_pos %}
|
||
|
{% endfor %}
|
||
|
### PRINT MARKER ###
|
||
|
G1 E-{ retract } F{ retract_speed } ; retract
|
||
|
G1 X{ x_pos + slow_length } Y{ end_y_pos + 5 } F{ travel_speed } ; move to position marker 1
|
||
|
G1 E{ retract } F{ retract_speed } ; un-retract
|
||
|
G1 Y{ end_y_pos + 5 + 20 } E{ E_mark } F{ slow_speed } ; print marker 1
|
||
|
G1 E-{ retract } F{ retract_speed } ; retract
|
||
|
G1 X{ x_pos + slow_length + fast_length } Y{ end_y_pos + 5 } F{ travel_speed } ; move to position marker 2
|
||
|
G1 E{ retract } F{ retract_speed } ; un-retract
|
||
|
G1 Y{ end_y_pos + 5 + 20 } E{ E_mark } F{ slow_speed } ; print marker 2
|
||
|
G1 E-{ retract } F{ retract_speed } ; retract
|
||
|
### END CALIBRATION ###
|
||
|
TURN_OFF_HEATERS
|
||
|
G1 Z5
|
||
|
G1 X10 Y{ bed_size_y - 5 } F{ travel_speed } ;//TODO: maybe move to "max toolhead position - 5"
|
||
|
M84
|
||
|
|
||
|
[gcode_macro LOAD_FILAMENT]
|
||
|
gcode: |
|
||
|
{% if (not(printer.idle_timeout.state == "Printing") or printer.pause_resume.is_paused) %}
|
||
|
SAVE_GCODE_STATE NAME=LOAD_state
|
||
|
M117 Loading filament..
|
||
|
M83 ; set extruder to relative
|
||
|
G1 E50 F300 ; load (multiple times to avoid length limit)
|
||
|
G1 E50 F2000
|
||
|
G1 E50 F2000
|
||
|
G1 E50 F2000
|
||
|
G1 E50 F2000
|
||
|
G1 E50 F2000
|
||
|
G1 E50 F1000
|
||
|
G1 E50 F300
|
||
|
G1 E10 F300
|
||
|
G1 E-1 F300 ; short retract
|
||
|
M117 Filament loaded
|
||
|
UPDATE_DELAYED_GCODE ID=SCHEDULE_CLEAR_SCREEN DURATION=5
|
||
|
RESTORE_GCODE_STATE NAME=LOAD_state
|
||
|
{% else %}
|
||
|
{ action_respond_info("Filament loading disabled while printing!") }
|
||
|
{% endif %}
|
||
|
|
||
|
#*# <---------------------- SAVE_CONFIG ---------------------->
|
||
|
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
|
||
|
#*#
|
||
|
#*# [bed_mesh default]
|
||
|
#*# version = 1
|
||
|
#*# points =
|
||
|
#*# 0.320000, 0.142500, -0.041250
|
||
|
#*# 0.322500, 0.152500, -0.040000
|
||
|
#*# 0.340000, 0.161250, -0.027500
|
||
|
#*# tension = 0.2
|
||
|
#*# min_x = 87.04
|
||
|
#*# algo = lagrange
|
||
|
#*# y_count = 3
|
||
|
#*# mesh_y_pps = 2
|
||
|
#*# min_y = 87.04
|
||
|
#*# x_count = 3
|
||
|
#*# max_y = 122.95
|
||
|
#*# mesh_x_pps = 2
|
||
|
#*# max_x = 122.95
|