diff --git a/klipper-printer-sovol-sv06.cfg b/klipper-printer-sovol-sv06.cfg index bc25656..7d9696c 100644 --- a/klipper-printer-sovol-sv06.cfg +++ b/klipper-printer-sovol-sv06.cfg @@ -9,14 +9,16 @@ # that was flashed. # See docs/Config_Reference.md for a description of parameters. -[include mainsail.cfg] +[include macros.cfg] [include mechanical_level_tmc2209.cfg] [mcu] +##################################################################### +# Obtain definition by "ls -l /dev/serial/by-id/" +##################################################################### serial: /dev/serial/by-id/usb-1a86_USB2.0-Serial-if00-port0 restart_method: command - [adxl345] cs_pin: rpi:None @@ -34,8 +36,14 @@ probe_points: 110, 110, 20 kinematics: cartesian max_velocity: 300 max_accel: 3000 +max_accel_to_decel: 1500 max_z_velocity: 5 max_z_accel: 100 +# square_corner_velocity: 6.0 + +##################################################################### +# X/Y Stepper Settings +##################################################################### [stepper_x] step_pin: PC2 @@ -81,6 +89,10 @@ uart_address: 3 driver_SGTHRS: 82 diag_pin: PA6 +##################################################################### +# Z Stepper Settings +##################################################################### + [stepper_z] step_pin: PB6 dir_pin: !PB5 @@ -101,13 +113,12 @@ sense_resistor: 0.150 uart_address: 3 diag_pin: PA7 -[thermistor sovol_thermistor] -temperature1: 25 -resistance1: 94162 -beta: 4160 +##################################################################### +# Extruder +##################################################################### [extruder] -max_extrude_only_distance: 100.0 +max_extrude_only_distance: 150.0 step_pin: PB4 dir_pin: !PB3 enable_pin: !PC3 @@ -124,6 +135,7 @@ pid_kp: 21.479 pid_ki: 1.326 min_temp: 0 max_temp: 260 +min_extrude_temp: 190 [tmc2209 extruder] uart_pin: PC14 @@ -133,6 +145,15 @@ interpolate: False sense_resistor: 0.150 uart_address: 3 +##################################################################### +# Misc +##################################################################### + +[thermistor sovol_thermistor] +temperature1: 25 +resistance1: 94162 +beta: 4160 + [heater_bed] heater_pin: PA2 sensor_type: EPCOS 100K B57560G104F @@ -158,6 +179,7 @@ samples_tolerance_retries: 5 [safe_z_home] home_xy_position: 85,135 +# speed: 50.0 z_hop: 10 z_hop_speed: 5 diff --git a/macros.cfg b/macros.cfg new file mode 100644 index 0000000..34ac8d2 --- /dev/null +++ b/macros.cfg @@ -0,0 +1,208 @@ +[pause_resume] +[display_status] + +[gcode_macro PURGE_LINE] +# https://github.com/JoeCat1207/V0.1-Purge-line-SuperSlicer/blob/main/Purgeline.txt +gcode: + G0 Y0 X40 F11000 ; go to tongue of print bed + G1 Z0.2 F500.0 ; move bed to nozzle + G92 E0.0 ; reset extruder + G1 E1.40 F500 ; pre-purge prime LENGTH SHOULD MATCH YOUR PRINT_END RETRACT + G1 X80 E8.0 F500.0 ; intro line 1 + G1 Y0.3 ; move in a little + G1 X40 E8.0 F500.0 ; second line + G92 E0.0 ; reset extruder + G1 Z2.0 ; move nozzle to prevent scratch + +[gcode_macro CANCEL_PRINT] +description: Cancel the actual running print +rename_existing: CANCEL_PRINT_BASE +gcode: + TURN_OFF_HEATERS + M107 ; turn off fan + CANCEL_PRINT_BASE + +[gcode_macro PRINT_START] +# Use PRINT_START for the slicer starting script - please customize for your slicer of choice +#gcode: +# G28 ; home all axes +# G1 Z20 F3000 ; move nozzle away from bed +gcode: + # Parameters + {% set bedtemp = params.BED|int %} + {% set hotendtemp = params.HOTEND|int %} + {% set chambertemp = params.CHAMBER|default(0)|int %} + + G28 X Y + # + M190 S{bedtemp} ; set & wait for bed temp + # TEMPERATURE_WAIT SENSOR="temperature_sensor chamber" MINIMUM={chambertemp} ; wait for chamber temp + # + M109 S{hotendtemp} ; set & wait for hotend temp + # + G28 Z ; final z homing + G1 Z20 F3000 ; move nozzle away from bed + # SKEW_PROFILE LOAD=my_skew_profile + +[gcode_macro PRINT_END] +# Use PRINT_END for the slicer ending script - please customize for your slicer of choice +gcode: + M400 ; wait for buffer to clear + G92 E0 ; zero the extruder + G1 E-1.40 F400 ; retract filament + G91 ; relative positioning + # SET_SKEW CLEAR=1 ; clear skew_profile + + # Get Boundaries + {% set max_x = printer.configfile.config["stepper_x"]["position_max"]|float %} + {% set max_y = printer.configfile.config["stepper_y"]["position_max"]|float %} + {% set max_z = printer.configfile.config["stepper_z"]["position_max"]|float %} + + # Check end position to determine safe direction to move + {% if printer.toolhead.position.x < (max_x - 20) %} + {% set x_safe = 20.0 %} + {% else %} + {% set x_safe = -20.0 %} + {% endif %} + + {% if printer.toolhead.position.y < (max_y - 20) %} + {% set y_safe = 20.0 %} + {% else %} + {% set y_safe = -20.0 %} + {% endif %} + + {% if printer.toolhead.position.z < (max_z - 2) %} + {% set z_safe = 2.0 %} + {% else %} + {% set z_safe = max_z - printer.toolhead.position.z %} + {% endif %} + + G0 Z{z_safe} F1000 ; move nozzle up ;3600 + G0 X{x_safe} Y{y_safe} F7200 ; move nozzle to remove stringing ;20000 ;9000 + TURN_OFF_HEATERS + M107 ; turn off fan + G90 ; absolute positioning + G0 X60 Y{max_y} F3600 ; park nozzle at rear + +[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 + +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 %} + # 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 + bound %} + {% set x_max = printer.toolhead.axis_maximum.x - bound %} + {% set y_min = printer.toolhead.axis_minimum.y + 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)) } + + # Absolute positioning + G90 + + # Set new limits + SET_VELOCITY_LIMIT VELOCITY={speed} ACCEL={accel} ACCEL_TO_DECEL={accel / 2} + + # Home and get position for comparison later: + 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 %} + G0 X{printer.toolhead.axis_maximum.x} Y{printer.toolhead.axis_maximum.y} F{30*60} + G4 P1000 + GET_POSITION + + # Go to starting position + G0 X{x_min} Y{y_min} Z{bound + 10} F{speed*60} + + {% 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} + + # 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 + # Small 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 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 + 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} + + # Re-home and get position again for comparison: + G28 + # Go to XY home positions (in case your homing override leaves it elsewhere) + G0 X{printer.toolhead.axis_maximum.x} Y{printer.toolhead.axis_maximum.y} F{30*60} + G4 P1000 + GET_POSITION + + # Restore previous gcode state (absolute/relative, etc) + RESTORE_GCODE_STATE NAME=TEST_SPEED + +[gcode_macro LOAD_FILAMENT] +gcode: + M83 ; set extruder to relative + G1 E30 F300 ; load + G1 E15 F150 ; prime nozzle with filament + M82 ; set extruder to absolute + +[gcode_macro UNLOAD_FILAMENT] +gcode: + M83 ; set extruder to relative + G1 E10 F300 ; extrude a little to soften tip + G1 E-40 F1800 ; retract some, but not too much or it will jam + M82 ; set extruder to absolute diff --git a/mechanical_level_tmc2209.cfg b/mechanical_level_tmc2209.cfg index 6668a47..66ff0d6 100644 --- a/mechanical_level_tmc2209.cfg +++ b/mechanical_level_tmc2209.cfg @@ -1,5 +1,6 @@ ############################################################################### -# +# Source https://github.com/strayr/strayr-k-macros/blob/e0807570a66d28735cf05143b105ab4ea6d9798f/mechanical_level_tmc2209.cfg +# # Mechanical Gantry Calibration # # Requires TMC2209 drivers with UART control, some tuning and perhaps