diff --git a/printer.cfg b/printer.cfg index be593b6..4e8667b 100644 --- a/printer.cfg +++ b/printer.cfg @@ -85,8 +85,8 @@ serial: /dev/serial/by-id/usb-Klipper_lpc1768_0260000E648C48AF0B98335DC12000F5-i [printer] kinematics: corexy max_velocity: 300 -max_accel: 7000 #Max 4000 -max_z_velocity: 15 #Max 15 for 12V TMC Drivers, can increase for 24V +max_accel: 40000 +max_z_velocity: 25 #Max 15 for 12V TMC Drivers, can increase for 24V max_z_accel: 350 square_corner_velocity: 5.0 @@ -127,7 +127,7 @@ homing_positive_dir: true [tmc2209 stepper_x] uart_pin: P1.17 interpolate: False -run_current: 0.8 +run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 @@ -152,8 +152,8 @@ position_min: 0 #position_max: 300 ## Uncomment for 350mm build -position_endstop: 350 -position_max: 350 +position_endstop: 355 +position_max: 355 ##-------------------------------------------------------------------- homing_speed: 25 #Max 100 @@ -164,7 +164,7 @@ homing_positive_dir: true [tmc2209 stepper_y] uart_pin: P1.15 interpolate: False -run_current: 0.8 +run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 @@ -208,7 +208,7 @@ homing_retract_dist: 3 [tmc2209 stepper_z] uart_pin: z:P1.17 interpolate: False -run_current: 0.8 +run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 @@ -226,7 +226,7 @@ microsteps: 32 [tmc2209 stepper_z1] uart_pin: z:P1.15 interpolate: False -run_current: 0.8 +run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 @@ -244,7 +244,7 @@ microsteps: 32 [tmc2209 stepper_z2] uart_pin: z:P1.10 interpolate: False -run_current: 0.8 +run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 @@ -262,7 +262,7 @@ microsteps: 32 [tmc2209 stepper_z3] uart_pin: z:P1.8 interpolate: False -run_current: 0.8 +run_current: 1.0 sense_resistor: 0.110 stealthchop_threshold: 0 @@ -303,9 +303,10 @@ control = pid pid_kp = 22.780 pid_ki = 1.298 pid_kd = 99.947 +max_extrude_only_distance = 101 ## Try to keep pressure_advance below 1.0 -#pressure_advance: 0.05 +pressure_advance: 0.055 ## Default is 0.040, leave stock #pressure_advance_smooth_time: 0.040 @@ -352,7 +353,7 @@ pid_kd = 266.452 pin: z:P1.24 x_offset: 0 y_offset: 25.0 -z_offset: 2.400 +#z_offset: 2.400 speed: 10.0 samples: 3 samples_result: median @@ -430,7 +431,7 @@ timeout: 1800 ## Update -10,-10 to the XY coordinates of your endstop pin ## (such as 157,305) after going through Z Endstop Pin ## Location Definition step. -home_xy_position: 234,350 +home_xy_position: 232,355 speed:100 z_hop:10 @@ -543,7 +544,7 @@ gcode: [gcode_macro PARK] gcode: {% set th = printer.toolhead %} - G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y//5} Z100 + G0 X{th.axis_maximum.x//2} Y{th.axis_maximum.y//5} Z100 F2000 [gcode_macro G32] gcode: @@ -558,16 +559,92 @@ gcode: [gcode_macro PRINT_START] # Use PRINT_START for the slicer starting script - please customise for your slicer of choice gcode: - G32 ; home all axes - G90 ; absolute positioning - G1 Z20 F3000 ; move nozzle away from bed - SFS_ENABLE + # This part fetches data from your slicer. Such as bed temp, extruder temp, chamber temp and size of your printer. + {% set target_bed = params.BED|int %} + {% set target_extruder = params.EXTRUDER|int %} + {% set target_chamber = params.CHAMBER|default("40")|int %} + {% set x_wait = printer.toolhead.axis_maximum.x|float / 2 %} + {% set y_wait = printer.toolhead.axis_maximum.y|float / 2 %} + {% set FL_SIZE = params.SIZE|default("0_0_0_0")|string %} + + # Homes the printer, sets absolute positioning and updates the Stealthburner leds. + #STATUS_HOMING # Sets SB-leds to homing-mode + G28 # Full home (XYZ) + G90 # Absolut position + + ## Uncomment for bed mesh (1 of 2) + #BED_MESH_CLEAR # Clears old saved bed mesh (if any) + + SET_DISPLAY_TEXT MSG="Bed: {target_bed}c" # Displays info + #STATUS_HEATING # Sets SB-leds to heating-mode + M106 S255 # Turns on the PT-fan + # ## Uncomment if you have a Nevermore. + # #SET_PIN PIN=nevermore VALUE=1 # Turns on the nevermore + G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed + M190 S{target_bed} # Sets the target temp for the bed + {% if target_bed|int > 90 %} + SET_DISPLAY_TEXT MSG="Soak for 5min" # Displays info + G4 P60000 # Waits 5 min for the bedtemp to stabilize + SET_DISPLAY_TEXT MSG="Soak for 4min" # Displays info + G4 P60000 # Waits 5 min for the bedtemp to stabilize + SET_DISPLAY_TEXT MSG="Soak for 3min" # Displays info + G4 P60000 # Waits 5 min for the bedtemp to stabilize + SET_DISPLAY_TEXT MSG="Soak for 2min" # Displays info + G4 P60000 # Waits 5 min for the bedtemp to stabilize + SET_DISPLAY_TEXT MSG="Soak for 1min" # Displays info + G4 P60000 # Waits 5 min for the bedtemp to stabilize + {% endif %} + {% if printer.extruder.temperature < 160|float %} + # Heating nozzle to 150 degrees. This helps with getting a correct Z-home + SET_DISPLAY_TEXT MSG="Hotend: 150c" # Displays info + M109 S150 # Heats the nozzle to 150c + {% endif %} + + # Uncomment for V2 (Quad gantry level AKA QGL) + SET_DISPLAY_TEXT MSG="QGL" # Displays info + #STATUS_LEVELING # Sets SB-leds to leveling-mode + QUAD_GANTRY_LEVEL # Levels the buildplate via QGL + G28 Z # Homes Z again after QGL + + ## Uncomment for Klicky auto-z + #CALIBRATE_Z # Calibrates Z-offset with klicky + #SET_DISPLAY_TEXT MSG="Z-offset" # Displays info + + ## Uncomment for bed mesh (2 of 2) + #SET_DISPLAY_TEXT MSG="Bed mesh" # Displays info + #STATUS_MESHING # Sets SB-leds to bed mesh-mode + #BED_MESH_CALIBRATE ADAPTIVE=1 # Starts bed mesh + #ADAPTATIVE_BED_MESH SIZE={FL_SIZE} # Adaptative bed mesh from here: https://github.com/The-Conglomerate/Voron-Klipper-Common/blob/main/macros/adaptive_bed_mesh.cfg + + # Heats up the nozzle up to target via data from slicer + SET_DISPLAY_TEXT MSG="Hotend: {target_extruder}c" # Displays info + #STATUS_HEATING # Sets SB-leds to heating-mode + G1 X{x_wait} Y{y_wait} Z15 F9000 # Goes to center of the bed + M107 # Turns off partcooling fan + M109 S{target_extruder} # Heats the nozzle to printing temp + + # enable filament sensor + SFS_ENABLE + + # Gets ready to print by doing a purge line and updating the SB-leds + SET_DISPLAY_TEXT MSG="Printer goes brr" # Displays info + #STATUS_PRINTING # Sets SB-leds to printing-mode + G0 X{x_wait - 50} Y4 F10000 # Moves to starting point + G0 Z0.4 # Raises Z to 0.4 + G92 E0 ; Reset Extruder + G1 Z2.0 F3000 ; Move Z Axis up little to prevent scratching of Heat Bed + G1 X0.5 Y20 Z0.3 F5000.0 ; Move to start position + G1 X0.5 Y200.0 Z0.3 F1500.0 E15 ; Draw the first line + G1 X0.9 Y200.0 Z0.3 F5000.0 ; Move to side a little + G1 X0.9 Y20 Z0.3 F1500.0 E15 ; Draw the second line + G92 E0 ; Reset Extruder + [gcode_macro PRINT_END] # Use PRINT_END for the slicer ending script - please customise for your slicer of choice gcode: - # safe anti-stringing move coords + # safe anti-stringing move coords {% set th = printer.toolhead %} {% set x_safe = th.position.x + 20 * (1 if th.axis_maximum.x - th.position.x > 20 else -1) %} {% set y_safe = th.position.y + 20 * (1 if th.axis_maximum.y - th.position.y > 20 else -1) %} @@ -577,7 +654,7 @@ gcode: M400 ; wait for buffer to clear G92 E0 ; zero the extruder - G1 E-5.0 F1800 ; retract filament + G1 E-8.0 F1800 ; retract filament TURN_OFF_HEATERS @@ -614,7 +691,7 @@ probe_count: 6, 6 [filament_motion_sensor SFS_T0] detection_length: 10.00 ; This can be adjusted to your desired level of sensitivity. 10 is a recommended value to prevent flow dropoff false triggers. extruder: extruder -switch_pin: ^P1.27 +switch_pin: ^P1.25 pause_on_runout: True ; This can be set to false to debug false positives putting the sensor in "monitor mode". The printer will not pause but it will run the runout_gcode below. event_delay: 3.0 pause_delay: 0.5 @@ -640,8 +717,145 @@ gcode: G92 E0 SET_FILAMENT_SENSOR SENSOR=SFS_T0 ENABLE=0 ; Put your filament sensor's name after SENSOR= +[gcode_macro TEST_SPEED] +# Home, get position, throw around toolhead, home again. +# If MCU stepper positions (first line in GET_POSITION) are greater than a full step different (your number of microsteps), then skipping occured. +# We only measure to a full step to accomodate for endstop variance. +# Example: TEST_SPEED SPEED=300 ACCEL=5000 ITERATIONS=10 + +description: Test for max speed and acceleration parameters for the printer. Procedure: Home -> ReadPositionFromMCU -> MovesToolhead@Vel&Accel -> Home -> ReadPositionfromMCU + +gcode: + # Speed + {% set speed = params.SPEED|default(printer.configfile.settings.printer.max_velocity)|int %} + # Iterations + {% set iterations = params.ITERATIONS|default(5)|int %} + # Acceleration + {% set accel = params.ACCEL|default(printer.configfile.settings.printer.max_accel)|int %} + # Minimum Cruise Ratio + {% set min_cruise_ratio = params.MIN_CRUISE_RATIO|default(0.5)|float %} + # Bounding inset for large pattern (helps prevent slamming the toolhead into the sides after small skips, and helps to account for machines with imperfectly set dimensions) + {% set bound = params.BOUND|default(20)|int %} + # Size for small pattern box + {% set smallpatternsize = SMALLPATTERNSIZE|default(20)|int %} + + # Large pattern + # Max positions, inset by BOUND + {% set x_min = printer.toolhead.axis_minimum.x %} + {% if x_min < 0 %} + {% set x_min = 0 %} + {% endif %} + + {% set y_min = printer.toolhead.axis_minimum.y %} + {% if y_min < 0 %} + {% set y_min = 0 %} + {% endif %} + + {% set x_min = x_min + bound %} + {% set x_max = printer.toolhead.axis_maximum.x - bound %} + {% set y_min = y_min + bound %} + {% set y_max = printer.toolhead.axis_maximum.y - bound %} + + # Small pattern at center + # Find X/Y center point + {% set x_center = (printer.toolhead.axis_minimum.x|float + printer.toolhead.axis_maximum.x|float ) / 2 %} + {% set y_center = (printer.toolhead.axis_minimum.y|float + printer.toolhead.axis_maximum.y|float ) / 2 %} + + # Set small pattern box around center point + {% set x_center_min = x_center - (smallpatternsize/2) %} + {% set x_center_max = x_center + (smallpatternsize/2) %} + {% set y_center_min = y_center - (smallpatternsize/2) %} + {% set y_center_max = y_center + (smallpatternsize/2) %} + + # Save current gcode state (absolute/relative, etc) + SAVE_GCODE_STATE NAME=TEST_SPEED + + # Output parameters to g-code terminal + { action_respond_info("TEST_SPEED: starting %d iterations at speed %d, accel %d" % (iterations, speed, accel)) } + + # Home and get position for comparison later: + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + G28 + # QGL if not already QGLd (only if QGL section exists in config) + {% if printer.configfile.settings.quad_gantry_level %} + {% if printer.quad_gantry_level.applied == False %} + QUAD_GANTRY_LEVEL + G28 Z + {% endif %} + {% endif %} + # Move 50mm away from max position and home again (to help with hall effect endstop accuracy - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/24) + G90 + G1 X{printer.toolhead.axis_maximum.x-50} Y{printer.toolhead.axis_maximum.y-50} F{30*60} + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + G28 X Y + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} + G4 P1000 + GET_POSITION + + # Go to starting position + G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} + + # Set new limits + {% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %} + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} MINIMUM_CRUISE_RATIO={min_cruise_ratio} + {% else %} + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} + {% endif %} + + {% for i in range(iterations) %} + # Large pattern diagonals + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Large pattern box + G0 X{x_min} Y{y_min} F{speed*60} + G0 X{x_min} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_max} F{speed*60} + G0 X{x_max} Y{y_min} F{speed*60} + + # Small pattern diagonals + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + + # Small pattern box + G0 X{x_center_min} Y{y_center_min} F{speed*60} + G0 X{x_center_min} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_max} F{speed*60} + G0 X{x_center_max} Y{y_center_min} F{speed*60} + {% endfor %} + + # Restore max speed/accel/accel_to_decel to their configured values + {% if printer.configfile.settings.printer.minimum_cruise_ratio is defined %} + SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} MINIMUM_CRUISE_RATIO={printer.configfile.settings.printer.minimum_cruise_ratio} + {% else %} + SET_VELOCITY_LIMIT VELOCITY={printer.configfile.settings.printer.max_velocity} ACCEL={printer.configfile.settings.printer.max_accel} ACCEL_TO_DECEL={printer.configfile.settings.printer.max_accel_to_decel} + {% endif %} + + # Re-home and get position again for comparison: + M400 # Finish moves - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/66 + G28 # This is a full G28 to fix an issue with CoreXZ - https://github.com/AndrewEllis93/Print-Tuning-Guide/issues/12 + # Go to XY home positions (in case your homing override leaves it elsewhere) + G90 + G0 X{printer.toolhead.axis_maximum.x-1} Y{printer.toolhead.axis_maximum.y-1} F{30*60} + G4 P1000 + GET_POSITION + + # Restore previous gcode state (absolute/relative, etc) + RESTORE_GCODE_STATE NAME=TEST_SPEED + #*# <---------------------- SAVE_CONFIG ----------------------> #*# DO NOT EDIT THIS BLOCK OR BELOW. The contents are auto-generated. #*# #*# [stepper_z] -#*# position_endstop = -1.410 +#*# position_endstop = -1.241 +#*# +#*# [probe] +#*# z_offset = 2.375