Created
January 25, 2022 15:56
-
-
Save dnahas/be751c9b9f2dc552a6219b6b8e9ca286 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Started from https://pastebin.com/TKPgf37r | |
# used info from https://github.com/Klipper3d/klipper/blob/master/config/printer-creality-ender3-v2-2020.cfg | |
# To use this config, the firmware should be compiled for the STM32F446 with a "32KiB bootloader" | |
# Enable "extra low-level configuration options" and select the "12MHz crystal" as clock reference | |
############################################################# | |
# Ender 3v2 w/ BigTreeTech OctoPus V1.1 and TMC2209s, Dual Z, BL touch. (no sensorless) | |
############################################################# | |
[mcu rpi] | |
serial: /tmp/klipper_host_mcu | |
[adxl345] | |
cs_pin: rpi:None | |
[resonance_tester] | |
accel_chip: adxl345 | |
probe_points: | |
112, 112, 70 # an example | |
112, 10, 70 # an example | |
112, 205, 70 # an example | |
[stepper_x] | |
step_pin: PF13 | |
dir_pin: !PF12 | |
enable_pin: !PF14 | |
microsteps: 16 | |
rotation_distance: 40 | |
endstop_pin: ^PG6 | |
position_endstop: 0 | |
position_max: 229 | |
homing_speed: 50 | |
[tmc2209 stepper_x] | |
uart_pin: PC4 | |
run_current: 0.600 | |
hold_current: 0.500 | |
#stealthchop_threshold: 500 | |
stealthchop_threshold: 999999 | |
[stepper_y] | |
step_pin: PG0 | |
dir_pin: !PG1 | |
enable_pin: !PF15 | |
microsteps: 16 | |
rotation_distance: 40 | |
endstop_pin: PG9 | |
position_endstop: 0 | |
position_max: 229 | |
homing_speed: 50 | |
[tmc2209 stepper_y] | |
uart_pin: PD11 | |
run_current: 0.600 | |
hold_current: 0.500 | |
#stealthchop_threshold: 500 | |
stealthchop_threshold: 999999 | |
[stepper_z] | |
step_pin: PF11 | |
dir_pin: PG3 | |
enable_pin: !PG5 | |
microsteps: 16 | |
rotation_distance: 8 | |
endstop_pin: probe:z_virtual_endstop | |
position_max: 245 | |
position_min: -2 | |
homing_speed: 10 | |
second_homing_speed: 1 | |
[tmc2209 stepper_z] | |
uart_pin: PC6 | |
run_current: 0.650 | |
hold_current: 0.450 | |
#stealthchop_threshold: 500 | |
stealthchop_threshold: 999999 | |
[stepper_z1] | |
step_pin: PG4 | |
dir_pin: PC1 | |
enable_pin: !PA0 | |
microsteps: 16 | |
rotation_distance: 8 | |
[tmc2209 stepper_z1] | |
uart_pin: PC7 | |
run_current: 0.650 | |
hold_current: 0.450 | |
#stealthchop_threshold: 500 | |
stealthchop_threshold: 999999 | |
[extruder] | |
step_pin: PF9 | |
dir_pin: !PF10 | |
enable_pin: !PG2 | |
heater_pin: PA2 # HE0 | |
sensor_pin: PF4 | |
microsteps: 16 | |
pressure_advance = 0.2592 | |
rotation_distance: 33.5 | |
nozzle_diameter: 0.400 | |
filament_diameter: 1.750 | |
sensor_type: EPCOS 100K B57560G104F | |
control: pid | |
pid_Kp: 21.527 | |
pid_Ki: 1.063 | |
pid_Kd: 108.982 | |
min_temp: 0 | |
max_temp: 250 | |
[tmc2209 extruder] | |
uart_pin: PF2 | |
run_current: 0.650 | |
hold_current: 0.500 | |
#stealthchop_threshold: 250 | |
stealthchop_threshold: 999999 | |
[heater_bed] | |
heater_pin: PA1 | |
sensor_pin: PF3 | |
sensor_type: EPCOS 100K B57560G104F | |
control: pid | |
pid_Kp: 54.027 | |
pid_Ki: 0.770 | |
pid_Kd: 948.182 | |
min_temp: 0 | |
max_temp: 130 | |
[printer] | |
kinematics: cartesian | |
max_velocity: 400 | |
max_accel: 3000 | |
max_z_velocity: 8 | |
max_z_accel: 100 | |
[temperature_sensor mcu_temp] | |
sensor_type: temperature_mcu | |
[temperature_sensor raspberry_pi] | |
sensor_type: temperature_host | |
#################################################################################### BEGIN FANS | |
[fan] #print cooling | |
pin: PA8 # FAN0 | |
[heater_fan nozzle_fan] | |
pin: PE5 # FAN1 | |
max_power: 1.0 | |
kick_start_time: 0.100 | |
heater: extruder | |
heater_temp: 100.0 | |
fan_speed: 1.0 | |
[controller_fan case_fan] | |
pin: PD12 # FAN2 | |
max_power: 1 | |
off_below: 1 | |
shutdown_speed: 0 # Power off when shutdown | |
idle_timeout: 1 # Fast timeout unless steppers or a heater is live | |
heater: extruder, heater_bed | |
stepper: stepper_x, stepper_y, stepper_z, stepper_z1 | |
#[heater_fan fan3] | |
#pin: PD13 # FAN3 | |
#[heater_fan fan4] | |
#pin: PD14 # FAN4 | |
#[heater_fan fan5] | |
#pin: PD15 # FAN5 | |
#################################################################################### END FANS | |
[mcu] | |
#ls /dev/serial/by-id/* | |
serial: /dev/serial/by-id/usb-Klipper_stm32f446xx_190044000E51383438343939-if00 | |
[input_shaper] | |
shaper_freq_x: 65.0 | |
shaper_type_x: mzv | |
shaper_freq_y: 31.8 | |
shaper_type_y: mzv | |
#Fitted shaper 'zv' frequency = 102.0 Hz (vibrations = 28.8%, smoothing ~= 0.021) | |
#To avoid too much smoothing with 'zv', suggested max_accel <= 40500 mm/sec^2 | |
#Fitted shaper 'mzv' frequency = 65.0 Hz (vibrations = 11.5%, smoothing ~= 0.049) | |
#To avoid too much smoothing with 'mzv', suggested max_accel <= 12400 mm/sec^2 | |
#Fitted shaper 'ei' frequency = 91.2 Hz (vibrations = 11.0%, smoothing ~= 0.040) | |
#To avoid too much smoothing with 'ei', suggested max_accel <= 15500 mm/sec^2 | |
#Fitted shaper '2hump_ei' frequency = 83.4 Hz (vibrations = 6.1%, smoothing ~= 0.078) | |
#To avoid too much smoothing with '2hump_ei', suggested max_accel <= 7700 mm/sec^2 | |
#Fitted shaper '3hump_ei' frequency = 76.4 Hz (vibrations = 3.1%, smoothing ~= 0.140) | |
#To avoid too much smoothing with '3hump_ei', suggested max_accel <= 4300 mm/sec^2 | |
#Recommended shaper is ei @ 91.2 Hz | |
#Fitted shaper 'zv' frequency = 32.2 Hz (vibrations = 14.7%, smoothing ~= 0.148) | |
#To avoid too much smoothing with 'zv', suggested max_accel <= 3800 mm/sec^2 | |
#Fitted shaper 'mzv' frequency = 31.8 Hz (vibrations = 3.6%, smoothing ~= 0.201) | |
#To avoid too much smoothing with 'mzv', suggested max_accel <= 3000 mm/sec^2 | |
#Fitted shaper 'ei' frequency = 39.0 Hz (vibrations = 3.9%, smoothing ~= 0.212) | |
#To avoid too much smoothing with 'ei', suggested max_accel <= 2800 mm/sec^2 | |
#Fitted shaper '2hump_ei' frequency = 39.4 Hz (vibrations = 1.3%, smoothing ~= 0.348) | |
#To avoid too much smoothing with '2hump_ei', suggested max_accel <= 1600 mm/sec^2 | |
#Fitted shaper '3hump_ei' frequency = 48.6 Hz (vibrations = 1.3%, smoothing ~= 0.347) | |
#To avoid too much smoothing with '3hump_ei', suggested max_accel <= 1600 mm/sec^2 | |
#Recommended shaper is mzv @ 31.8 Hz | |
#shaper_freq_x: 103.8 | |
#shaper_type_x: zv | |
#shaper_freq_x: 64.6 | |
#shaper_type_x: mzv | |
#shaper_freq_x: 91.8 | |
#shaper_type_x: ei | |
#shaper_freq_x: 83.2 | |
#shaper_type_x: 2hum_ei | |
#shaper_freq_x: 77.2 | |
#shaper_type_x: 3hump_ei | |
#shaper_freq_y: 32.6 | |
#shaper_type_y: zv | |
#shaper_freq_y: 29.4 | |
#shaper_type_y: mzv | |
#shaper_freq_y: 36.4 | |
#shaper_type_y: ei | |
#shaper_freq_y: 39.0 | |
#shaper_type_y: 2hum_ei | |
#shaper_freq_y: 48.0 | |
#shaper_type_y: 3hump_ei | |
[virtual_sdcard] | |
path: ~/gcode_files | |
[display_status] | |
[pause_resume] | |
############################################################################ Bed and Adjustments | |
[bltouch] | |
sensor_pin: ^PB7 | |
control_pin: PB6 | |
x_offset: -45 | |
y_offset: -10 | |
z_offset = 2.710 | |
speed: 4 | |
samples: 3 | |
samples_result: median #default average | |
samples_tolerance: 0.015 | |
samples_tolerance_retries: 8 | |
stow_on_each_sample: False | |
sample_retract_dist: 2 #default 2 (mm) | |
[safe_z_home] | |
home_xy_position: 110, 110 | |
speed: 200 | |
z_hop: 10 | |
z_hop_speed: 5 | |
[bed_mesh] | |
speed: 300 | |
horizontal_move_z: 5 | |
mesh_min: 0,5 | |
mesh_max: 180, 210 | |
probe_count: 9,9 | |
algorithm: bicubic | |
fade_start: 1 | |
fade_end: 10 | |
fade_target: 0 | |
move_check_distance: 10 | |
split_delta_z: .02 | |
[z_tilt] | |
z_positions: | |
-30,110 #stepper_z | |
265,110 #stepper_z1 | |
points: | |
#75,15 #FL | |
#75,225 #RL | |
225,15 #FR | |
75,112.5 #ML | |
225,225 #RR | |
speed: 200 | |
horizontal_move_z: 5.0 | |
retries: 15 | |
retry_tolerance: 0.00999 | |
#retry_tolerance: 0.0055 | |
[screws_tilt_adjust] | |
screw1: 75,15 | |
screw1_name: FRONT LEFT | |
screw2: 75,225 | |
screw2_name: REAR LEFT | |
screw3: 225,15 | |
screw3_name: FRONT RIGHT | |
screw4: 225,225 | |
screw4_name: REAR RIGHT | |
#screw1: 50,15 | |
#screw1_name: Front left | |
#screw2: 50,215 | |
#screw2_name: Rear left screw | |
#screw3: 215,15 | |
#screw3_name: Front right screw | |
#screw4: 215,215 | |
#screw4_name: Rear right screw | |
horizontal_move_z: 10 | |
speed: 200 | |
screw_thread: CW-M3 | |
####################################################################################### Macros | |
#PAUSE MACRO | |
[gcode_macro PAUSE] | |
description: Pause the actual running print | |
rename_existing: PAUSE_BASE | |
variable_extrude: 1.0 # change this if you need more or less extrusion | |
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 %} | |
#RESUME MACRO | |
[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} | |
#CANCEL_PRINT MACRO | |
[gcode_macro CANCEL_PRINT] | |
description: Cancel the actual running print | |
rename_existing: CANCEL_PRINT_BASE | |
gcode: | |
TURN_OFF_HEATERS | |
CANCEL_PRINT_BASE | |
#Get Printer built volume dimensions | |
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %} | |
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %} | |
#Fix-up extruder | |
G91 | |
G1 E-2 F2700 | |
G1 E-1.5 Z0.2 F2400 | |
G1 X5 Y5 F6000 | |
G1 Z10 | |
G90 | |
#Present print | |
G1 Z{printer.toolhead.position.z + 10} F600 | |
G1 X{X_MAX / 2} Y{Y_MAX} F6000 | |
M106 S0 | |
M104 S0 | |
M140 S0 | |
#Disable Steppers | |
M84 X Y E | |
#G29 BL Macro | |
[gcode_macro G29] | |
gcode: | |
G28 | |
Z_TILT_ADJUST | |
BED_MESH_CALIBRATE | |
G0 X0 Y0 Z10 F6000 | |
BED_MESH_PROFILE save=default | |
SAVE_CONFIG | |
[gcode_macro START_PRINT] | |
gcode: | |
# Start bed heating | |
; Start Heating Hotend/Bed to Layer 0 Temp | |
#Get Bed and Extruder temperature from Slicer GCode | |
{% set BED_TEMP = params.BED_TEMP %} | |
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP %} | |
#Preheat nozzle and bed | |
M104 S{EXTRUDER_TEMP} | |
M140 S{BED_TEMP} | |
# Use absolute coordinates | |
G90 | |
# Reset the G-Code Z offset (adjust Z offset if needed) | |
#SET_GCODE_OFFSET Z=0.0 | |
# Home the printer | |
G28 | |
Z_TILT_ADJUST | |
#WAIT FOR FINAL HEAT | |
M109 S{EXTRUDER_TEMP} | |
M190 S{BED_TEMP} | |
# Move the nozzle near the bed | |
G1 Z5 F3000 | |
# Move the nozzle very close to the bed | |
G1 Z0.15 F300 | |
# Wait for bed to reach temperature | |
#M190 S{BED_TEMP} | |
# Set and wait for nozzle to reach temperature | |
#M109 S{EXTRUDER_TEMP} | |
; Print a high-extrusion line to prime the hotend. | |
G1 X2 Y40 Z2 F3000 | |
G1 Z0.28 F240 | |
G92 E0 | |
G1 Y200 E15 F1500 ; intro line 1 | |
G1 X2.3 F5000 | |
G1 Y40 E30 F1500 ; intro line 2 | |
# Perform a fast move + retract + prime to stop stringing between the | |
# end of the primer line and the start of the print. | |
G92 E0 | |
G1 Y20 E-0.1 F5000 | |
G1 E0.1 F5000 | |
[gcode_macro END_PRINT] | |
gcode: | |
#Get Printer built volume dimensions | |
{% set X_MAX = printer.toolhead.axis_maximum.x|default(100)|float %} | |
{% set Y_MAX = printer.toolhead.axis_maximum.y|default(100)|float %} | |
#Fix-up extruder | |
G91 | |
G1 E-2 F2700 | |
G1 E-1.5 Z0.2 F2400 | |
G1 X5 Y5 F6000 | |
G1 Z10 | |
G90 | |
#Present print | |
G1 Z{printer.toolhead.position.z + 10} F600 | |
G1 X{X_MAX / 2} Y{Y_MAX -5 } F6000 | |
M106 S0 | |
M104 S0 | |
M140 S0 | |
#Disable Steppers | |
M84 X Y E | |
[gcode_macro MECHANICAL_GANTRY_CALIBRATION] | |
gcode: | |
{% set my_current = params.CURRENT|default(0.12)|float %} ; adjust crash current as required without fighting config. | |
{% set oldcurrent = printer.configfile.settings["tmc2209 stepper_z"].run_current %} ; TODO: Find runtime current settings | |
{% set oldhold = printer.configfile.settings["tmc2209 stepper_z"].hold_current %} | |
{% set x_max = printer.toolhead.axis_maximum.x %} | |
{% set y_max = printer.toolhead.axis_maximum.y %} | |
{% set z_max = printer.toolhead.axis_maximum.z %} | |
G28 ; todo query for homed | |
G90 ; absolute | |
G0 X{x_max / 2} Y{y_max / 2} F8000 ; TODO grab feedrate from config | |
G0 Z{z_max} F720 ; go to the Z-max at speed 12*60 | |
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={my_current} | |
G4 P200 ; Probably not necessary, it is here just for sure | |
FORCE_MOVE STEPPER=stepper_z DISTANCE=10 VELOCITY=6 | |
G4 P200 ; | |
FORCE_MOVE STEPPER=stepper_z DISTANCE=-4 VELOCITY=6 | |
G4 P200 ; same as the first one | |
SET_TMC_CURRENT STEPPER=stepper_z CURRENT={oldcurrent} HOLDCURRENT={oldhold} | |
G4 P200 ; same as the first one | |
G28 Z | |
[gcode_macro G34] | |
gcode: | |
MECHANICAL_GANTRY_CALIBRATION | |
[force_move] | |
enable_force_move: true ; enable FORCE_MOVE and SET_KINEMATIC_POSITION | |
####################################################################################### Macros | |
#*# <---------------------- SAVE_CONFIG ----------------------> | |
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. | |
#*# | |
#*# [bed_mesh default] | |
#*# version = 1 | |
#*# points = | |
#*# 0.135126, 0.072626, 0.060126, 0.072626, 0.097626, 0.082626, 0.037626, -0.014874, 0.002626 | |
#*# 0.110126, 0.065126, 0.067626, 0.102626, 0.130126, 0.132626, 0.110126, 0.065126, 0.090126 | |
#*# 0.080126, 0.055126, 0.070126, 0.102626, 0.155126, 0.170126, 0.150126, 0.120126, 0.165126 | |
#*# 0.047626, 0.015126, 0.030126, 0.077626, 0.127626, 0.142626, 0.135126, 0.112626, 0.150126 | |
#*# 0.027626, 0.002626, 0.030126, 0.072626, 0.122626, 0.140126, 0.127626, 0.102626, 0.142626 | |
#*# 0.047626, 0.030126, 0.047626, 0.090126, 0.130126, 0.140126, 0.130126, 0.097626, 0.120126 | |
#*# 0.047626, 0.022626, 0.037626, 0.085126, 0.125126, 0.135126, 0.120126, 0.090126, 0.117626 | |
#*# 0.037626, 0.002626, 0.012626, 0.057626, 0.095126, 0.105126, 0.090126, 0.052626, 0.075126 | |
#*# 0.152626, 0.095126, 0.080126, 0.097626, 0.110126, 0.100126, 0.057626, 0.005126, 0.012626 | |
#*# tension = 0.2 | |
#*# min_x = 0.0 | |
#*# algo = bicubic | |
#*# y_count = 9 | |
#*# mesh_y_pps = 2 | |
#*# min_y = 5.0 | |
#*# x_count = 9 | |
#*# max_y = 209.96 | |
#*# mesh_x_pps = 2 | |
#*# max_x = 180.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment