Skip to content

Instantly share code, notes, and snippets.

@matseee
Last active June 24, 2021 15:45
Show Gist options
  • Save matseee/3c6c385b1354d007056138eb3466db36 to your computer and use it in GitHub Desktop.
Save matseee/3c6c385b1354d007056138eb3466db36 to your computer and use it in GitHub Desktop.
Klipper printer.cfg (trigorilla 0.0.2)
# printer.cfg for matses anycubic i3 mega
[stepper_x]
step_pin: PF0
dir_pin: !PF1
enable_pin: !PD7
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PE5
position_min: -5
position_endstop: -5
position_max: 210
homing_speed: 50.0
[stepper_y]
step_pin: PF6
dir_pin: PF7
enable_pin: !PF2
microsteps: 16
rotation_distance: 40
endstop_pin: ^!PL7
position_endstop: 0
position_max: 210
homing_speed: 50.0
[stepper_z]
step_pin: PL3
dir_pin: PL1
enable_pin: !PK0
microsteps: 16
rotation_distance: 8
endstop_pin: ^!PD3
position_endstop: 0.0
position_min: -2
position_max: 205
homing_speed: 5.0
[stepper_z1]
step_pin: PC1
dir_pin: PC3
enable_pin: !PC7
microsteps: 16
rotation_distance: 8
endstop_pin: ^!PL6
[extruder]
step_pin: PA4
dir_pin: PA6
enable_pin: !PA2
microsteps: 16
rotation_distance: 8.176
nozzle_diameter: 0.400
filament_diameter: 1.750
max_extrude_only_distance: 120.0
pressure_advance: 0.573
heater_pin: PB4
sensor_type: ATC Semitec 104GT-2
sensor_pin: PK5
control: pid
pid_kp: 18.573
pid_ki: 0.784
pid_kd: 110.047
min_temp: 0
max_temp: 300
[firmware_retraction]
retract_length: 5
retract_speed: 40
unretract_extra_length: 0
unretract_speed: 10
[bed_mesh]
speed: 300
horizontal_move_z: 5
mesh_min: 29,2
mesh_max: 210,195
probe_count: 5,5
[bltouch]
sensor_pin: ^PE4
control_pin: PB5
x_offset: 29
y_offset: -15
z_offset: 0.920
[heater_fan extruder_fan]
pin: PL5
[heater_bed]
heater_pin: PH5
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PK6
control: pid
pid_kp: 74.647
pid_ki: 3.110
pid_kd: 447.882
min_temp: 0
max_temp: 110
[fan]
pin: PH6
[mcu]
baud: 250000
serial: /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
[printer]
kinematics: cartesian
max_accel: 3000
#max_accel: 10000
#max_accel_to_decel: 10000
max_velocity: 300
max_z_velocity: 10
max_z_accel: 60
[heater_fan stepstick_fan]
pin: PH4
[virtual_sdcard]
path: ~/gcode_files
[display_status]
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 10
max_temp: 100
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100,100,20 # an example
[pause_resume]
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
##### set defaults #####
{% set x = params.X|default(230) %} #edit to your park position
{% set y = params.Y|default(230) %} #edit to your park position
{% set z = params.Z|default(10)|float %} #edit to your park position
{% set e = params.E|default(1) %} #edit to your retract length
##### calculate save lift position #####
{% set max_z = printer.toolhead.axis_maximum.z|float %}
{% set act_z = printer.toolhead.position.z|float %}
{% set lift_z = z|abs %}
{% if act_z < (max_z - lift_z) %}
{% set z_safe = lift_z %}
{% else %}
{% set z_safe = max_z - act_z %}
{% endif %}
##### end of definitions #####
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{e} F2100
G1 Z{z_safe}
G90
G1 X{x} Y{y} F6000
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
##### set defaults #####
{% set e = params.E|default(1) %} #edit to your retract length
G91
G1 E{e} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
# BLTouch Auto-Bed-Mesh-Leveling
[gcode_macro G29]
gcode:
G28 # Home the axis
M190 S80 # Heat up the bed
BED_MESH_CALIBRATE # Do the auto calibration
SAVE_CONFIG # Save profile in printer.cfg
M190 S0 # Cool down the bed
# Start macro before every print
[gcode_macro START_PRINT]
default_parameter_BED_TEMP: 85
default_parameter_EXTRUDER_TEMP: 235
gcode:
M190 S{BED_TEMP} # Set and wait for bed to reach temperature
M104 S{EXTRUDER_TEMP} # Set extruder temperature
G28 # Home
BED_MESH_PROFILE LOAD=default # Load bed mesh
G92 E0 # Reset extruder
G1 Z10.0 F3000 # Move Z up
M109 S{EXTRUDER_TEMP} # Wait for Extruder temperature
PRIME # Print prime line
# Print prime line
[gcode_macro PRIME]
gcode:
G1 X20 Y0.0 Z0.3 F5000.0 # Move to start for purge line
G1 X175 Y0.0 Z0.3 F800.0 E15 # Draw 1st line
G1 X175 Y0.5 Z0.3 F5000.0 # Move to side a little
G1 X20 Y0.5 Z0.3 F800.0 E30 # Draw 2nd line
G1 X20 Y5 Z0.3 F5000.0 # Move to side a little
G92 E0 # Reset extruder
# End macro after every print
[gcode_macro END_PRINT]
gcode:
G91
# Retract a bit
G1 E-2 F2700
G1 E-2 Z0.2 F2400
G1 X5 Y5 F3000
# Turn off bed, extruder, and fan
M140 S0
M104 S0
M106 S0
G1 Z10 F3000 # Raise nozzle by 10mm
G90
G1 X0 Y210 # Deliver print
M84 X Y E # Disable steppers
BED_MESH_CLEAR # Clear bed mesh
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.032500, -0.047500, -0.067500, -0.095000, -0.087500
#*# 0.012500, -0.052500, -0.080000, -0.110000, -0.117500
#*# -0.057500, -0.095000, -0.105000, -0.132500, -0.102500
#*# -0.080000, -0.127500, -0.127500, -0.135000, -0.097500
#*# 0.007500, -0.072500, -0.097500, -0.115000, -0.070000
#*# tension = 0.2
#*# min_x = 29.0
#*# algo = lagrange
#*# y_count = 5
#*# mesh_y_pps = 2
#*# min_y = 2.0
#*# x_count = 5
#*# max_y = 195.0
#*# mesh_x_pps = 2
#*# max_x = 210.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment