Skip to content

Instantly share code, notes, and snippets.

@kn100
Created February 11, 2025 04:15
Show Gist options
  • Save kn100/92b26b96cb1d715a5a319026cd99b047 to your computer and use it in GitHub Desktop.
Save kn100/92b26b96cb1d715a5a319026cd99b047 to your computer and use it in GitHub Desktop.
my printer.cfg
#To use this config, during "make menuconfig" select the
# STM32F103 with a "28KiB bootloader" and serial (on USART1 PA10/PA9)
# communication.
# If you prefer a direct serial connection, in "make menuconfig"
# select "Enable extra low-level configuration options" and select
# serial (on USART3 PB11/PB10), which is broken out on the 10 pin IDC
# cable used for the LCD module as follows:
# 3: Tx, 4: Rx, 9: GND, 10: VCC
# See docs/Config_Reference.md for a description of parameters.
# Acceleration tuning (with USB)
# [include adxl.cfg]
# Stuff stolen from CVICK.
[include mods/_base_functions_christian_vick.cfg]
[include mods/printer_sovol_sv07_fans_hotend_christian_vick.cfg]
[include mods/printer_sovol_sv07_fans_cpu_christian_vick.cfg]
[temperature_sensor Makerbase_MKS_Pi]
sensor_type: temperature_host
[mcu]
serial:/dev/serial/by-id/usb-1a86_USB_Serial-if00-port0
restart_method: command
[printer]
kinematics: cartesian
max_velocity: 500
max_accel: 8000
max_z_velocity: 15
max_z_accel: 100
square_corner_velocity:3.0
[virtual_sdcard]
path:/home/mks/printer_data/gcodes
# Random garbage
[exclude_object]
[pause_resume]
[display_status]
[idle_timeout]
gcode:
RESPOND TYPE=echo MSG="No operations in 10min!"
# A list of G-Code commands to execute on an idle timeout. See
# docs/Command_Templates.md for G-Code format. The default is to run
# "TURN_OFF_HEATERS" and "M84".
timeout: 600
[mcu rpi]
serial: /tmp/klipper_host_mcu
[save_variables]
filename: ~/printer_data/config/saved_variables.cfg
[verify_heater extruder]
max_error: 60
check_gain_time:20
hysteresis: 5
heating_gain: 2
[verify_heater heater_bed]
max_error: 180
check_gain_time:120
hysteresis: 5
heating_gain: 2
#############################################################################################################
#GCODE_MACRO
#############################################################################################################
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
RESPOND TYPE=echo MSG="Cancel Print Success!"
G91 ;Relative positionning
G1 E-2 F500 ;Retract a bit
G1 E-2 Z0.2 F200 ;Retract and raise Z
G1 Z1 ;Raise Z more
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
G90
G1 X10 Y210 F6000
M84 X Y E ;Disable all steppers but Z
[gcode_macro START_PRINT]
gcode:
{% set BED_TEMP = params.BED_TEMP|default(61)|float %}
{% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(203)|float %}
# Start everything heating up (Bed to full temp, Extruder to warm, but not hot enough to ooze)
M104 S130
M140 S{BED_TEMP}
# Go home, and move nozzle somewhere it's not likely to ooze anywhere useful - but close enough to allow inductive probe to heat soak a bit
G28
G1 X0.1 Y220 Z1 F5000.0 ; move to back left of bed and raise nozzle so bed can be cleaned/inspected
# Prepare the motion system for leveling
M84 E ; Disable E Motor for probe accuracy on direct drive systems
G90 ;Absolute positioning
G92 E0 ; Reset Extruder distance to 0
SET_GCODE_OFFSET Z=0.0
# Wait for the bed to reach temperature
M190 S{BED_TEMP} ; Set Bed to temperature and wait for it to reach it
# Now that bed is homed and warmed up, do z tilt adjust
G28 ; home all axes
Z_Tilt_Adjust
BED_MESH_CALIBRATE ADAPTIVE=1
# Now that we have a mesh and z tilt is good, we move nozzle back to safe no ooze position, and wait for it to get to temp
G1 X0.1 Y220 Z50 F5000.0 ; move to back left of bed and raise nozzle so bed can be cleaned/inspected
M109 S{EXTRUDER_TEMP}
# Nozzle and bed at temp, time to purge!
G1 Z5 F3000
G1 Z0.15 F300 ; Bounce nozzle near bed in order to potentially snap off any oozing that may have occurred.
G1 Z1.0 F3000 ; move z up little to prevent scratching of surface
G1 X0.1 Y20 Z0.3 F5000.0 ; move to start-line position
G1 X0.1 Y100.0 Z0.3 F500.0 E15 ; draw 1st line
G1 X0.4 Y100.0 Z0.3 F5000.0 ; move to side a little
G1 X0.4 Y20 Z0.3 F500.0 E30 ; draw 2nd line
G92 E0 ; reset extruder
G1 Z1.0 F3000 ; move z up little to prevent scratching of surface
[gcode_macro PAUSE]
description: Pause the actual running print
rename_existing: PAUSE_BASE
gcode:
RESPOND TYPE=echo MSG="Pause Print!"
##### set defaults #####
{% set x = params.X|default(10) %} #edit to your park position
{% set y = params.Y|default(220) %} #edit to your park position
{% set z = params.Z|default(50)|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 #####
PAUSE_BASE
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E-{e} F500
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
{% if "xyz" in printer.toolhead.homed_axes %}
G1 Z{z_safe}
G90
G1 X{x} Y{y} F6000
{% else %}
{action_respond_info("Printer not homed")}
{% endif %}
[gcode_macro RESUME]
description: Resume the actual running print
rename_existing: RESUME_BASE
gcode:
RESPOND TYPE=echo MSG="RESUME Print!"
##### set defaults #####
{% if printer["filament_switch_sensor my_sensor"].filament_detected == True %} # detect if occur filament runout ,True : filament exists.  False:filament runout
RESPOND TYPE=echo MSG="RESUME Print!"
{% set e = params.E|default(1) %} #edit to your retract length
#### get VELOCITY parameter if specified ####
{% if 'VELOCITY' in params|upper %}
{% set get_params = ('VELOCITY=' + params.VELOCITY) %}
{%else %}
{% set get_params = "" %}
{% endif %}
##### end of definitions #####
G91
{% if printer.extruder.can_extrude|lower == 'true' %}
G1 E{e} F400
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
{% else %}
RESPOND TYPE=echo MSG="Please Insert filament in Sensor!"
{% endif %}
[gcode_macro END_PRINT]
gcode:
G91 ;Relative positionning
G1 E-2 F500 ;Retract a bit
G1 E-2 Z0.2 F200 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z1 ;Raise Z more
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
G90 ;Absolute positionning
G1 X10 Y210 ;Present print
M84 X Y E ;Disable all steppers but Z
RESPOND TYPE=echo MSG="Finish Print!"
[gcode_macro LOAD_FILAMENT]
gcode:
G91
G1 E30 F300
G1 E10 F150
G90
[gcode_macro UNLOAD_FILAMENT]
gcode:
G91
G1 E-30 F300
G90
[gcode_macro LED_ON]
gcode:
SET_PIN PIN=my_led VALUE=1
[gcode_macro LED_OFF]
gcode:
SET_PIN PIN=my_led VALUE=0
[gcode_macro M205]
gcode:
M105
######################################################################
# Filament Change
######################################################################
# M600: Filament Change. This macro will pause the printer, move the
# tool to the change position, and retract the filament 50mm. Adjust
# the retraction settings for your own extruder. After filament has
# been changed, the print can be resumed from its previous position
# with the "RESUME" gcode.
[pause_resume]
[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-50 F1000
RESTORE_GCODE_STATE NAME=M600_state
#############################################################################################################
#stepper,TMC2209
#############################################################################################################
[stepper_x]
step_pin: PD15
dir_pin: !PD14
enable_pin: !PC7
microsteps: 16
rotation_distance: 40
endstop_pin: tmc2209_stepper_x: virtual_endstop
homing_retract_dist: 0
position_endstop: -16
position_min: -16
position_max: 225
homing_speed: 80
step_pulse_duration:0.000004
[tmc2209 stepper_x]
uart_pin:PE3
run_current:1.2
uart_address:3
# interpolate: True
driver_sgthrs: 115
# stealthchop_threshold:0
# stealthchop_threshold: 999999
diag_pin: ^PD10
[stepper_y]
step_pin: PB7
dir_pin: PB6
enable_pin: !PB9
microsteps: 16
rotation_distance: 40
endstop_pin: tmc2209_stepper_y: virtual_endstop
homing_retract_dist: 0
position_endstop: -2
position_min: -2
position_max: 225
homing_speed: 60
step_pulse_duration:0.000004
[tmc2209 stepper_y]
uart_pin:PE4
run_current:1.2
uart_address:3
# interpolate: True
driver_sgthrs: 105
# stealthchop_threshold:0
# stealthchop_threshold: 999999
diag_pin: ^PE0
[stepper_z]
step_pin: PB3
dir_pin: !PD7
enable_pin: !PB5
microsteps: 16
rotation_distance: 8
endstop_pin:probe:z_virtual_endstop
#position_endstop: 0.0
position_max: 253
position_min: -4
homing_speed:10
[stepper_z1]
step_pin: PA7
dir_pin: !PA6
enable_pin: !PC5
microsteps: 16
rotation_distance: 8
endstop_pin:probe:z_virtual_endstop
#position_endstop: 0.0
[extruder]
max_extrude_only_distance: 100.0
step_pin: PD1
dir_pin: !PD0
enable_pin: !PD4
microsteps: 16
rotation_distance: 4.6359
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA4
#control: pid
pressure_advance:0.02
pressure_advance_smooth_time:0.035
max_extrude_cross_section:500
instantaneous_corner_velocity:10
max_extrude_only_distance: 100.0
max_extrude_only_velocity:2000
max_extrude_only_accel:10000
#pid_Kp=24.522
#pid_Ki=1.397
#pid_Kd=107.590
min_temp: 0
max_temp: 305
min_extrude_temp: 150
[tmc2209 extruder]
uart_pin: PE7
run_current: 0.6
uart_address:3
#hold_current: 0.5
interpolate: True
[heater_bed]
heater_pin: PA2
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PA3
#control: pid
# tuned for stock hardware with 50 degree Celsius target
#pid_Kp: 54.027
#pid_Ki: 0.770
#pid_Kd: 948.182
min_temp: 0
max_temp: 105
[probe]
pin:PD13
x_offset:27
y_offset:-20
samples: 3
samples_result: median
sample_retract_dist: 5.0
samples_tolerance: 0.01
samples_tolerance_retries: 3
[filament_switch_sensor my_sensor]
#pause_on_runout: True
# runout_gcode:
# RESPOND TYPE=error MSG="Filament Runout! Please change filament!"
#event_delay: 3.0
#pause_delay: 0.5
switch_pin:PD11
[safe_z_home]
home_xy_position: 83,130
speed: 100
z_hop: 5 # Move up 5mm
z_hop_speed: 10
#################################################
#Z stepper tilt adjustment
#################################################
[z_tilt]
z_positions: -16, 130
180, 130
points: -16, 130
180, 130
speed: 200
horizontal_move_z: 5
retries: 20
retry_tolerance: .005
#################################################
#bed mesh calibrate
#################################################
[bed_mesh]
speed:200
horizontal_move_z:5
mesh_min:11,12
mesh_max:210,205
probe_count:5,5
algorithm: bicubic
bicubic_tension: 0.3
fade_start: 0.2
fade_end: 5.0
mesh_pps:4,4
move_check_distance: 3
#split_delta_z: .025
#################################################
#adjust bed screws tilt
#################################################
[screws_tilt_adjust]
screw1: -1, 45
screw1_name: front left screw
screw2: 168, 45
screw2_name: front right screw
screw3: 168, 215
screw3_name: rear right screw
screw4: -1, 215
screw4_name: rear left screw
horizontal_move_z: 5.
speed: 200.
screw_thread: CW-M4
[heater_fan hotend_fan]
pin: PE11
[multi_pin fan_pins]
pins: PE9,PE13
[fan]
pin:multi_pin:fan_pins
[output_pin my_led]
pin:PC4
pwm: 1
value:1
cycle_time: 0.010
[controller_fan Fan_Board]
pin:PD3
fan_speed: 1.0
idle_timeout: 120
heater: heater_bed, extruder
stepper: stepper_x, stepper_y, stepper_z, stepper_z1
[input_shaper]
damping_ratio_x: 0.1
damping_ratio_y: 0.1
#shaper_type_x = zv
#shaper_freq_x = 53.4
#shaper_type_y = zv
#shaper_freq_y = 43.2
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [probe]
#*# z_offset = 1.820
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 25.074
#*# pid_ki = 2.039
#*# pid_kd = 77.102
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 65.133
#*# pid_ki = 0.936
#*# pid_kd = 1133.316
#*#
#*# [input_shaper]
#*# shaper_type_y = mzv
#*# shaper_freq_y = 39.8
#*# shaper_type_x = mzv
#*# shaper_freq_x = 63.6
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# -0.022500, -0.012500, 0.010000, 0.012500, 0.040000
#*# 0.010000, -0.017500, -0.002500, -0.000000, 0.022500
#*# 0.005000, -0.007500, 0.037500, 0.015000, 0.025000
#*# 0.005000, -0.030000, -0.017500, -0.002500, 0.040000
#*# 0.012500, -0.020000, -0.012500, -0.007500, 0.025000
#*# x_count = 5
#*# y_count = 5
#*# mesh_x_pps = 4
#*# mesh_y_pps = 4
#*# algo = bicubic
#*# tension = 0.3
#*# min_x = 11.0
#*# max_x = 210.0
#*# min_y = 12.0
#*# max_y = 205.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment