Skip to content

Instantly share code, notes, and snippets.

@andyshinn
Created September 3, 2022 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andyshinn/baca6d8cd4aaaf69bc13a8059a5433b6 to your computer and use it in GitHub Desktop.
Save andyshinn/baca6d8cd4aaaf69bc13a8059a5433b6 to your computer and use it in GitHub Desktop.
# [include Macros.cfg] # You have to copy it /home/pi/klipper_config https://www.klipper3d.org/Config_Reference.html#include
# [include client_macros.cfg] # These macros are required for Fluidd to correctly function.
# This is a Klipper configuration for Qidi X-Max, with
# V4.6 motherboard. with the cooperation of Funkton and oaba200
# instruction https://github.com/KevinOConnor/klipper/blob/master/docs/Config_Reference.md
[mcu]
restart_method: command
serial: /dev/ttyS0
# find your serial port https://www.klipper3d.org/FAQ.html?fbclid=IwAR1aq9KdH9c--IUKsE9OEHn2vpHL_2Utyjpwsnog2PJQve9dx3mQplK-XHY#wheres-my-serial-port
#/dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
baud: 115200
# CONFIG_SERIAL_PORT == 1 setup for PA9, PA10
# setup for PA9, PA10 USART1_tx / rx directly connected to the RPI GPIO TX / RX pins
# These are the pins the GTR uses for its built in RPI 40 pin connector
# only connect GND, TX, RX - supply 5v power to the RPI separately
# cross over TX/RX
# Use "sudo raspi-config" to disable the serial terminal - but enable the serial port.
# When running "make menuconfig" you must un-select the USB Serial check box
#
[verify_heater extruder]
check_gain_time: 120
[gcode_button pwr_button]
pin: PE1 # PE1(142) pin connected to the power relay board trought con1
press_gcode: SET_PIN PIN=system_power VALUE=0 # SET_PIN PIN:A list of G-Code commands to execute when the button is pressed.
[virtual_sdcard] # Fluidd requires
path: ~/gcode_files # Fluidd requires
[display_status] # Fluidd requires
[pause_resume] # Fluidd requires
[printer]
kinematics: cartesian
max_velocity: 300
max_accel: 2000
max_z_velocity: 12
max_z_accel: 5
square_corner_velocity: 3
[stepper_x]
step_pin: PE5
dir_pin: PF1
enable_pin: !PF0
microsteps: 8
rotation_distance: 17.1052 # Set the step with the 100mm distance calibration. Tis setting for 1.8 degree stepper 16 17.1052
endstop_pin: !PC15
position_endstop: 270
position_min: 0
position_max: 270
homing_retract_dist: 10
homing_speed: 30
second_homing_speed: 10
[stepper_y]
step_pin: PF9
dir_pin: PF3
enable_pin: !PF5
microsteps: 8
rotation_distance: 17.1052 # Set the step with the 100mm distance calibration. Tis setting for 0.9 degree stepper 16 33.992
endstop_pin: !PC14
position_endstop: 200
position_max: 200
position_min: 0
homing_retract_dist: 10
homing_speed: 30
second_homing_speed: 10
[stepper_z]
step_pin: PA6
dir_pin: PF15
enable_pin: !PA5
microsteps: 16
rotation_distance: 7.9672 # Set the step with the 100mm distance calibration. Tis setting for 1.8 degree stepper 16 7.9672
endstop_pin: !PC13
position_endstop: 200
position_max: 205
position_min: 3
homing_retract_dist: 5
homing_speed: 12
second_homing_speed: 1
[stepper_z1] # This is the right Z axis 16 7.9672
step_pin: PD12
dir_pin: PG4
enable_pin: !PG5
microsteps: 16
rotation_distance: 7.9672
endstop_pin: !PE6
#z[z_tilt]
#z_positions:
#-80,20
#295,20
#points:
#-20,110
#110,110
#horizontal_move_z: 10
#retries: 5
#retry_tolerance: 0.05
[extruder]
step_pin: PB1 # PB1(47) pin connected to the step pin of the stepper driver
dir_pin: PF13 # PF13(53) pin connected to the direction pin of the stepper driver
enable_pin: !PF14 # PF14(54) pin connected to the enable pin of the stepper driver
microsteps: 16 # Set microstepping 16 3.34
rotation_distance: 7.771 # Set the step with the extrusion lenght calibration. Tis setting for 0.9 degree stepper
nozzle_diameter: 0.400 # Set the nozzle diameter
filament_diameter: 1.750 # Set the filament diameter
pressure_advance: 0.025 # Calculated by the pressure advance test
#max_extrude_cross_section: 7
#max_extrude_only_velocity:
#max_extrude_only_accel:
#pressure_advance: 0.0
pressure_advance_smooth_time: 0.040
heater_pin: PG0 # PG0(48) pin connected to Q5 gate to the extuder heater
sensor_type: MAX6675 # Sensor ampifier type
spi_bus: spi2 # It uses hardware SPI2
sensor_pin: PD13 #ChipSelect # PD13(82) pin connected to the MAX6675 pin 6 Chip select
#spi_software_miso_pin: PB14 # MISO pin # That is for software SPI
#spi_software_sclk_pin: PB13 # SCK # That is for software SPI
#spi_software_mosi_pin: PB15 #dummy mosi pin # That is for software SPI
#spi_speed: 4000000 # That is for software SPI
#control: pid # Control algorithm
#pid_Kp: 29.970 # Kp is the "proportional" constant for the pid.
#pid_Ki: 1.921 # Ki is the "integral" constant for the pid.
#pid_Kd: 116.883 # Kd is the "derivative" constant for the pid.
min_extrude_temp: 170 # The minimum temperature (in Celsius) at which extruder move commands may be issued.
min_temp: 00 # The maximum range of valid temperatures (in Celsius) that the heater must remain within. This controls a safety feature implemented in the micro-controller code
max_temp: 290 # Should the measured temperature ever fall outside this range then the micro-controller will go into a shutdown state will go into a shutdown state
max_extrude_only_distance: 300
[heater_bed] # setup the heater bed
heater_pin: !PB2 # PB2(48) pin connected to Q6 and Q8 gate to the heater bed
sensor_type: EPCOS 100K B57560G104F # Type of sensor - common thermistors
sensor_pin: PC2 # PC2(28) pin connected to the green connector of the heater bed
#control: pid # Control algorithm
min_temp: 0 # The maximum range of valid temperatures (in Celsius) that the heater must remain within. This controls a safety feature implemented in the micro-controller code
max_temp: 130 # Should the measured temperature ever fall outside this range then the micro-controller will go into a shutdown state will go into a shutdown state
#pid_Kp: 73.932 # Kp is the "proportional" constant for the pid.
#pid_Ki: 1.521 # Ki is the "integral" constant for the pid.
#pid_Kd: 898.279 # Kd is the "derivative" constant for the pid.
[bed_screws] # The position ofthe bed levelling screws
screw1: 153,240 # Commands:
screw2: 290,10 # BED_SCREWS_ADJUST
screw3: 10,10 # ACCEPT
################################ QIDI X-MAX Fan SETTINGS ##################################
[heater_fan hotend_fan] # Setup of the hotend cooling Fan (fan that will be enabled whenever its associated heater is active)
pin: PB6 # PB6(136) pin connected to Q15 gate to the hotend Fan
fan_speed: 1 # The fan speed (expressed as a value from 0.0 to 1.0) that the fan will be set to when its associated heater is enabled.
heater: extruder # Name of the config section defining the heater that this fan is associated with.
# heater_temp: 70.0
[fan] # Setup of the Print cooling cooling Fan
pin: PD7 # PD7(123) pin connected to Q3 gate to the Print cooling cooling Fan
max_power: 1 # The maximum power (expressed as a value from 0.0 to 1.0) that the pin may be set to.
off_below: 0.1 # The minimum input speed which will power the fan
[fan_generic chamber_fan] # Setup Manually controlled fan. The two extractor fan at the back of the machine
pin: PG7 # PG7(92) pin connected to Q11 gate to the Circulating Chamber Fans.
max_power: 1 # The maximum power (expressed as a value from 0.0 to 1.0) that the pin may be set to.
off_below: 0.1 # The minimum input speed which will power the fan
# On X-MAX the Extruder Fan and the mother board fan is on the same connector uses the PB6
# [controller_fan motherboard_fan] # Setup the Fan that will be enabled whenever its associated heater or any configured stepper driver is active.
# pin: PB6 # PB6(136) pin connected to Q15 gate to the Stepper driver cooling fan
# max_power:1 # The maximum power (expressed as a value from 0.0 to 1.0) that the pin may be set to.
# off_below: 0.1 # The minimum input speed which will power the fan
############################### QIDI X-MAX Output SETTINGS #################################
[output_pin beeper] # Valid config section name
pin: PA8 # PA8(100) pin connected to Q2 gate to the speaker
pwm: True # A piezo beeper needs a PWM signal, a DC buzzer doesn't.
value: 0 # Initial value on power up
shutdown_value: 0 # Disable it at emergency shutdown
cycle_time: 0.001 # PWM frequency : 0.001s 1kHz
scale: 10 # Adjust the volume in 10 steps
[output_pin caselight] # Valid config section name (Issue with the capitel letters)
pin: PF10 # PF10(142) pin connected to Q3 gate to the LED strip
pwm: True # to let the brigtness adjustable
value: 10 # Initial value on powerup
shutdown_value: 0 # Disable it at emergency shutdown
cycle_time: 0.0083 # PWM frequency : 0.0083s 120Hz
scale: 10 # Adjust the brightness in 10 steps
[output_pin system_power]
pin: PE0
value: 1 # The value to initially set the pin to during MCU configuration. The default is 0 (for low voltage).
shutdown_value: 1 # The value to set the pin to on an MCU shutdown event. The default. is 0 (for low voltage).
[gcode_button pwr_button] # Setup power button input
pin: PE1 # PE1(100) pin connected to the power relay board trough CN1
press_gcode: SET_PIN PIN=system_power VALUE=0
[gcode_macro CANCEL_PRINT]
rename_existing: BASE_CANCEL_PRINT
gcode:
TURN_OFF_HEATERS
CLEAR_PAUSE
SDCARD_RESET_FILE
BASE_CANCEL_PRINT
[gcode_macro PAUSE]
rename_existing: BASE_PAUSE
gcode:
{% set E = params.E|default(1.7)|float %}
{% set x_park = printer.toolhead.axis_maximum.x|float - 5.0 %}
{% set y_park = printer.toolhead.axis_maximum.y|float - 5.0 %}
{% 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 %}
SAVE_GCODE_STATE NAME=PAUSE_state
BASE_PAUSE
G91
G1 E-{E} F2100
G1 Z{z_safe} F900
G90
G0 X{x_park} Y{y_park} F6000
G91
[gcode_macro RESUME]
rename_existing: BASE_RESUME
gcode:
{% set E = params.E|default(1)|float %} # edit to your preferred retract length
G91
G1 E{E} F2100
G90
RESTORE_GCODE_STATE NAME=PAUSE_state MOVE=1
BASE_RESUME
[gcode_macro RETRACT]
gcode:
{% set f = params.F|default(600)|float %}
{% if 'D' in params %}
{% if printer.idle_timeout.state == "Printing" and not printer.pause_resume.is_paused %}
{action_respond_info("This command cannot be used while printing")}
{% elif printer.extruder.temperature < 170 %}
{action_respond_info("Extruder temperature too low")}
{% else %}
SAVE_GCODE_STATE NAME=RETRACT_state
M83
G1 E-{params.D} F{f}
RESTORE_GCODE_STATE NAME=RETRACT_state MOVE=0
{% endif %}
{% endif %}
[bed_mesh]
speed: 120
horizontal_move_z: 5
mesh_min: 35, 6
mesh_max: 280, 230
probe_count: 5, 3
##################### Generated by BED and Extruder PID tuning ##################################
#*# <---------------------- SAVE_CONFIG ---------------------->
#*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated.
#*#
#*# [extruder]
#*# control = pid
#*# pid_kp = 18.553
#*# pid_ki = 0.683
#*# pid_kd = 125.928
#*#
#*# [heater_bed]
#*# control = pid
#*# pid_kp = 74.133
#*# pid_ki = 1.171
#*# pid_kd = 1173.149
#*#
#*# [bed_mesh default]
#*# version = 1
#*# points =
#*# 4.650507, 4.700302, 4.700302, 4.690343, 4.650507
#*# 4.779974, 4.809851, 4.799892, 4.799892, 4.725199
#*# 4.750097, 4.779974, 4.750097, 4.700302, 4.600712
#*# tension = 0.2
#*# min_x = 35.0
#*# algo = lagrange
#*# y_count = 3
#*# mesh_y_pps = 2
#*# min_y = 6.0
#*# x_count = 5
#*# max_y = 230.0
#*# mesh_x_pps = 2
#*# max_x = 280.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment