Skip to content

Instantly share code, notes, and snippets.

@kensleDev
Created May 1, 2023 09:28
Show Gist options
  • Save kensleDev/0ebcc6728d0dc510b5d974c755e0e76a to your computer and use it in GitHub Desktop.
Save kensleDev/0ebcc6728d0dc510b5d974c755e0e76a to your computer and use it in GitHub Desktop.
Printers Config
[gcode_macro G29]
gcode:
G28
BED_MESH_CALIBRATE
G0 X0 Y0 Z10 F6000
BED_MESH_PROFILE save=default
[gcode_macro WIPE_NOZZLE]
gcode:
G1 X250 ; Wipe the nozzle
G1 X240 ; Wipe the nozzle
G1 X250 ; Wipe the nozzle
G1 X240 ; Wipe the nozzle
G1 X250 ; Wipe the nozzle
G1 X240 ; Wipe the nozzle
[gcode_macro START_PRINT]
gcode:
{% set BED = params.BED|int %}
{% set EXTRUDER = params.EXTRUDER|int %}
M117 Setting Inital Temps
M140 S{BED}
# M104 S215.0{BED}
# M104 S215.0{EXTRUDER}
# M140 S{extruder_temp_standby}
G90 # Use absolute coordinates
# SET_GCODE_OFFSET Z=0.0 # Reset the G-Code Z offset (adjust Z offset if needed)
G28 # Home the printer
BED_MESH_PROFILE LOAD="default"
G92 E0 # Reset Extruder
G1 Z2.0 F3000 # Move Z Axis up
M106 S50 ; Fan on approx. 20% to protect cooling ducts
# M190 S{BED} ; Wait for bed to reach temperature
M109 S{EXTRUDER} ; Wait for extruder to reach temperature
# M117 Wiping the nozzle
WIPE_NOZZLE
M117 Purge line
G1 X2.1 Y20 Z0.28 F5000.0 # Move to start position
G1 X2.1 Y200.0 Z0.28 F1500.0 E15 # Draw the first line
G1 X2.4 Y200.0 Z0.28 F5000.0 # Move to side a little
G1 X2.4 Y20 Z0.28 F1500.0 E30 # Draw the second line
G92 E0 # Reset Extruder
G1 Z2.0 F3000 # Move Z Axis up
WIPE_NOZZLE
M117 Lets Print!
[gcode_macro END_PRINT]
gcode:
# Turn off bed, extruder, and fan
M140 S0
M104 S0
M106 S0
# Move nozzle away from print while retracting
G91
# Raise nozzle
{% if printer.toolhead.position.z < 50 %}
G1 Z50 E-3 F3000
{% elif printer.toolhead.position.z < 265 %}
G1 Z3 E-3 F3000
{% else %}
G1 E-3 F3000
{% endif %}
G1 X2 Y2 F3000
# Set Absolute positioning
G90
G1 X200 Y227
G91
#G1 Z-3 F3000 # weg als dit werkt
G90
#Disable steppers
M84
[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 - 15.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 #####
WIPE_NOZZLE
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' %}
WIPE_NOZZLE
G91
G1 E{E} F2100
{% else %}
{action_respond_info("Extruder not hot enough")}
{% endif %}
RESUME_BASE {get_params}
[gcode_macro CANCEL_PRINT]
description: Cancel the actual running print
rename_existing: CANCEL_PRINT_BASE
gcode:
PAUSE
TURN_OFF_HEATERS
CANCEL_PRINT_BASE
CLEAR_PAUSE
[gcode_macro M600]
description: Starts process of Filament Change
gcode:
{% if printer.extruder.temperature < 180 %}
{action_respond_info("Extruder temperature too low")}
{% else %}
AFC_PAUSE
_DISABLE_FS
UNLOAD_FILAMENT
{% endif %}
[gcode_macro AFC_PAUSE]
description: Pauses Print
gcode:
PAUSE
SET_IDLE_TIMEOUT TIMEOUT={ 30 * 60 }
[gcode_macro AFC_RESUME]
description: Resume print after Filament Change
gcode:
##### read E from pause macro #####
{% set E = printer["gcode_macro PAUSE"].extrude|float %}
SET_IDLE_TIMEOUT TIMEOUT={ 10 * 60 }
G1 E-{ E }
# Reset extruder position
G92 E0
LOAD_FILAMENT
RESUME
[gcode_macro UNLOAD_FILAMENT]
description: Unloads Filament from extruder
gcode:
{% if printer.extruder.temperature < 180 %}
{action_respond_info("Extruder temperature too low")}
{% else %}
SAVE_GCODE_STATE NAME=UNLOAD_state
{% set z_lift = params.z_lift|default(50)|int %}
{% set axis_max = printer.toolhead.axis_maximum %}
{% set pos = printer.toolhead.position %}
{% set z_diff = axis_max.z - pos.z %}
{% set z_safe_lift = [ z_lift, z_diff ] | min%}
G91 # relative positioning
G0 Z{ z_safe_lift }
# Reset extruder position
G92 E0
G1 E5.0 F300 # extrude a little
G1 E-50 F{ 10 * 60 } # perform the unload
G1 E-50 F{ 5 * 60 } # finish the unload
RESTORE_GCODE_STATE NAME=UNLOAD_state
{% endif %}
[gcode_macro LOAD_FILAMENT]
description: Loads filament into the extruder
gcode:
{% if printer.extruder.temperature < 180 %}
{action_respond_info("Extruder temperature too low")}
{% else %}
SAVE_GCODE_STATE NAME=LOAD_state
G91 # Relative coords
G1 E50 F{ 5 * 60 } # extrude
G4 P{ 0.9 * 1000 } # dwell (ms)
G1 E25.0 F{ 5 * 60 } # extrude a little more
_ENABLE_FS
RESTORE_GCODE_STATE NAME=LOAD_state
{% endif %}
[gcode_macro _DISABLE_FS]
description: placeholder, disables filament sensor that might trigger an M600 in the middle of a load/unload/M600...
gcode:
SET_FILAMENT_SENSOR SENSOR=RunoutSensor ENABLE=0
[gcode_macro _ENABLE_FS]
description: placeholder, enables filament sensor
gcode:
SET_FILAMENT_SENSOR SENSOR=RunoutSensor ENABLE=1
[gcode_macro PURGE]
description: Extrudes filament, used to clean out previous filament
gcode:
{% if printer.extruder.temperature < 180 %}
{action_respond_info("Extruder temperature too low")}
{% else %}
SAVE_GCODE_STATE NAME=PURGE_state
G91 # relative coords
G1 E45.0 F{ 5 * 60 } # purge
RESTORE_GCODE_STATE NAME=PURGE_state
{% endif %}
# [gcode_macro HEAT]
# description: Heats up the extruder to get ready for Filament Change
# gcode:
# SET_HEATER_TEMPERATURE HEATER=extruder TARGET=200
# HOME_CHECK
# G1 Z10 F3000
# [gcode_macro COOL]
# description: Turns off all heaters
# gcode:
# TURN_OFF_HEATERS
# [gcode_macro BED_TRAMMING_1]
# description: Heats bed and starts process to level the bed with the screws
# gcode:
# M140 S60
# HOME_CHECK
# M190 S60
# SCREWS_TILT_CALCULATE
# [gcode_macro BED_TRAMMING_2]
# description: Continues the bed screw leveling process
# gcode:
# SCREWS_TILT_CALCULATE
[gcode_macro BED_MESH]
description: Heats bed, makes a mesh and saves it
gcode:
M140 S60
HOME_CHECK
M190 S60
BED_MESH_CLEAR
BED_MESH_CALIBRATE
TURN_OFF_HEATERS
SAVE_CONFIG
[gcode_macro DISABLE_STEPPERS]
description: Disables the printers stepper motors
gcode:
M84 X Y E
[gcode_macro PID_EXTRUDER]
description: PID Tune for the Extruder
gcode:
PID_CALIBRATE HEATER=extruder TARGET=200
TURN_OFF_HEATERS
SAVE_CONFIG
[gcode_macro PID_BED]
description: PID Tune for the Bed
gcode:
PID_CALIBRATE HEATER=heater_bed TARGET=60
TURN_OFF_HEATERS
SAVE_CONFIG
[gcode_macro NOZZLE_MID]
description: Moves nozzle to the center of the bed
gcode:
HOME_CHECK
G1 X110 Y110 Z10 F6000
[gcode_macro home_check]
description: Checks if the printer is homed, it not it homes the printer
gcode:
{% if printer.toolhead.homed_axes != "xyz" %}
G28
{% endif %}
[gcode_macro SHOW_PRINT]
description: Moves the extruder out of the way and bed forward
gcode:
HOME_CHECK
{% set z_lift = params.z_lift|default(50)|int %}
{% set axis_max = printer.toolhead.axis_maximum %}
{% set pos = printer.toolhead.position %}
{% set z_diff = axis_max.z - pos.z %}
{% set z_safe_lift = [ z_lift, z_diff ] | min%}
G1 Z{ z_safe_lift }
G1 X10 Y220 F4000
[gcode_macro ZOffset_Setup]
description: Starts Z-Offset Calibration, under 30 degrees Celsius
gcode:
{% if printer.heater_bed.temperature > 35 %}
{action_respond_info("Bed temperature too high")}
{% elif printer.extruder.temperature > 35 %}
{action_respond_info("Extruder temperature too High")}
{% else %}
G28
PROBE_CALIBRATE
{% endif %}
# [gcode_macro Z_Down_01]
# description: Moves Z down by 0.1
# gcode:
# TESTZ Z=-.1
# [gcode_macro Z_Up_01]
# description: Moves Z up by 0.1
# gcode:
# TESTZ Z=+.1
# [gcode_macro Z_Low_Half]
# description: Sets Z between current value and previous lower value
# gcode:
# TESTZ Z=-
# [gcode_macro Z_High_Half]
# description: Sets Z between current value and previous higher value
# gcode:
# TESTZ Z=+
[gcode_macro Accept_Save]
description: Accepts the Z-Offset and saves the config
gcode:
ACCEPT
SAVE_CONFIG
[gcode_macro Abort_Setup]
description: Aborts the Z-Offset calibration
gcode:
ABORT
[screws_tilt_adjust]
horizontal_move_z: 5
screw1: 50,220
screw1_name: Back left
screw2: 228,220
screw2_name: Back Right
screw3: 50,74
screw3_name: Front Left
screw4: 228,74
screw4_name: Front Right
##################Creality Ender 3 S1 Pro Klipper Config - 3DPrintBeginner###############
######Full guide: https://3dprintbeginner.com/how-to-install-klipper-on-ender-3-s1/######
[include macros.cfg]
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: !PA5
position_endstop: -5
position_min: -5
position_max: 252
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: !PA6
position_endstop: -5
position_min: -5
position_max: 232
homing_speed: 50
[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_max: 270
position_min: -5
[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 7.6190
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
control: pid
pid_Kp: 21.761
pid_Ki: 1.261
pid_Kd: 93.844
min_temp: 0
max_temp: 250
pressure_advance = 0.07
max_extrude_cross_section: 50.0
[filament_switch_sensor RunoutSensor]
pause_on_runout: False
runout_gcode: PAUSE
insert_gcode: RESUME
switch_pin: !PC15
[heater_bed]
heater_pin: PA7
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
control: pid
pid_Kp: 68.385
pid_Ki: 1.093
pid_Kd: 1069.370
min_temp: 0
max_temp: 130
[heater_fan hotend_fan]
pin: PC0
heater: extruder
heater_temp: 50.0
[fan]
pin: PA0
[mcu]
serial: /dev/serial/by-path/platform-3f980000.usb-usb-0:1.1.3.1:1.0-port0
restart_method: command
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # an example
[input_shaper]
shaper_freq_x: 58.0
shaper_type_x: ei
shaper_freq_y: 49.6
shaper_type_y: ei
[printer]
kinematics: cartesian
max_velocity: 500
max_accel: 4600
max_accel_to_decel: 3000
max_z_velocity: 5
square_corner_velocity: 5.0
max_z_accel: 100
[bltouch]
sensor_pin: ^PC14
control_pin: PC13
x_offset: -32
y_offset: -41
#z_offset: 2.900
speed:10
samples:1
samples_result:average
probe_with_touch_mode: true
stow_on_each_sample: false
[safe_z_home]
home_xy_position: 147,154
speed: 100
z_hop: 10
z_hop_speed: 5
[bed_mesh]
speed: 100
mesh_min: 7, 7
mesh_max: 220, 185
algorithm: bicubic
probe_count: 3,3
fade_start: 1
fade_end: 3
fade_target: 0
mesh_pps: 2,2
algorithm: bicubic
bicubic_tension: 0.2
# [temperature_sensor Raspberry_Pi]
# sensor_type: temperature_host
# min_temp: 0
# max_temp: 100
[virtual_sdcard]
path: ~/Tom_data/gcodes
[display_status]
[pause_resume]
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 0.375
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.240000, 0.227500, 0.255000
#*# 0.070000, -0.017500, -0.045000
#*# 0.265000, 0.215000, 0.237500
#*# x_count = 3
#*# y_count = 3
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = bicubic
#*# tension = 0.2
#*# min_x = 7.0
#*# max_x = 220.0
#*# min_y = 7.0
#*# max_y = 185.0
##################Creality Ender 3 S1 Klipper Config - 3DPrintBeginner###############
######Full guide: https://3dprintbeginner.com/how-to-install-klipper-on-ender-3-s1/######
[include macros.cfg]
[stepper_x]
step_pin: PC2
dir_pin: PB9
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: !PA5
position_endstop: -5
position_min: -5
position_max: 252
homing_speed: 50
[stepper_y]
step_pin: PB8
dir_pin: PB7
enable_pin: !PC3
microsteps: 16
rotation_distance: 40
endstop_pin: !PA6
position_endstop: -5
position_min: -5
position_max: 232
homing_speed: 50
[stepper_z]
step_pin: PB6
dir_pin: !PB5
enable_pin: !PC3
microsteps: 16
rotation_distance: 8
endstop_pin: probe:z_virtual_endstop
position_max: 270
position_min: -5
[extruder]
max_extrude_only_distance: 100.0
step_pin: PB4
dir_pin: PB3
enable_pin: !PC3
microsteps: 16
rotation_distance: 7.6190
nozzle_diameter: 0.400
filament_diameter: 1.750
heater_pin: PA1
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC5
control: pid
pid_Kp: 21.761
pid_Ki: 1.261
pid_Kd: 93.844
min_temp: 0
max_temp: 250
pressure_advance = 0.07
max_extrude_cross_section: 50.0
[filament_switch_sensor RunoutSensor]
pause_on_runout: False
runout_gcode: PAUSE
insert_gcode: RESUME
switch_pin: !PC15
[heater_bed]
heater_pin: PA7
sensor_type: EPCOS 100K B57560G104F
sensor_pin: PC4
control: pid
pid_Kp: 68.385
pid_Ki: 1.093
pid_Kd: 1069.370
min_temp: 0
max_temp: 130
[heater_fan hotend_fan]
pin: PC0
heater: extruder
heater_temp: 50.0
[fan]
pin: PA0
[mcu]
serial: /dev/serial/by-path/platform-3f980000.usb-usb-0:1.1.3.4:1.0-port0
restart_method: command
[mcu rpi]
serial: /tmp/klipper_host_mcu
[adxl345]
cs_pin: rpi:None
[input_shaper]
shaper_freq_x: 45.0
shaper_type_x: ei
shaper_freq_y: 54.6
shaper_type_y: ei
[resonance_tester]
accel_chip: adxl345
probe_points:
100, 100, 20 # an example
[printer]
kinematics: cartesian
max_velocity: 500
max_accel: 3600
max_accel_to_decel: 3000
max_z_velocity: 5
square_corner_velocity: 5.0
max_z_accel: 100
[bltouch]
sensor_pin: ^PC14
control_pin: PC13
x_offset: -32
y_offset: -41
#z_offset: 2.900
speed:10
samples:1
samples_result:average
probe_with_touch_mode: true
stow_on_each_sample: false
[safe_z_home]
home_xy_position: 147,154
speed: 100
z_hop: 10
z_hop_speed: 5
[bed_mesh]
speed: 100
mesh_min: 7, 7
mesh_max: 220, 185
algorithm: bicubic
probe_count: 3,3
fade_start: 1
fade_end: 3
fade_target: 0
mesh_pps: 2,2
algorithm: bicubic
bicubic_tension: 0.2
[virtual_sdcard]
path: ~/Bert_data/gcodes
[display_status]
[pause_resume]
[temperature_sensor raspberry_pi]
sensor_type: temperature_host
min_temp: 0
max_temp: 70
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [bltouch]
#*# z_offset = 1.530
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 0.025000, -0.095000, 0.097500
#*# 0.017500, -0.070000, 0.147500
#*# 0.210000, 0.117500, 0.325000
#*# x_count = 3
#*# y_count = 3
#*# mesh_x_pps = 2
#*# mesh_y_pps = 2
#*# algo = bicubic
#*# tension = 0.2
#*# min_x = 7.0
#*# max_x = 220.0
#*# min_y = 7.0
#*# max_y = 185.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment