|
| 1 | +# Include servo hardware definition separately to allow for automatic upgrade |
| 2 | +[include mmu_erec_cutter_hw.cfg] |
| 3 | + |
| 4 | +########################################################################### |
| 5 | +# Optional EREC Filament Cutter Support |
| 6 | +# |
| 7 | +# https://github.com/kevinakasam/ERCF_Filament_Cutter |
| 8 | +# |
| 9 | +# This is the supplementary macro to support filament cutting at the MMU |
| 10 | +# on a ERCF design. |
| 11 | +# |
| 12 | +# To configure: |
| 13 | +# 1. Add this to your printer.cfg: |
| 14 | +# |
| 15 | +# [include mmu/addons/mmu_erec_cutter.cfg] |
| 16 | +# |
| 17 | +# 2. In mmu_macro_vars.cfg, change this line: |
| 18 | +# |
| 19 | +# variable_user_post_unload_extension : "EREC_CUTTER_ACTION" |
| 20 | +# |
| 21 | +# 3. Tune the servo configuration and macro "variables" below |
| 22 | +# |
| 23 | + |
| 24 | +# EREC CUTTER CONFIGURATION ----------------------------------------------- |
| 25 | +# (addons/mmu_erec_cutter.cfg) |
| 26 | +# |
| 27 | +[gcode_macro _EREC_VARS] |
| 28 | +description: Empty macro to store the variables |
| 29 | +gcode: # Leave empty |
| 30 | + |
| 31 | +# These variables control the servo movement |
| 32 | +variable_servo_closed_angle : 70 ; Servo angle for closed postion with bowden aligned MMU |
| 33 | +variable_servo_open_angle : 10 ; Servo angle to open up the cutter and move bowden away from MMU |
| 34 | +variable_servo_duration : 0.4 ; Time (s) of PWM pulse to activate servo |
| 35 | +variable_servo_idle_time : 0.5 ; Time (s) to let the servo to reach it's position |
| 36 | + |
| 37 | +# Controls for feed and cut lengths |
| 38 | +variable_feed_length : 58 ; Distance in mm from gate parking position to position of blade |
| 39 | +variable_cut_length : 10 ; Amount in mm of filament to cut |
| 40 | +variable_cut_attempts : 1 ; Number of times the cutter tries to cut the filament |
| 41 | + |
| 42 | + |
| 43 | +########################################################################### |
| 44 | +# Macro to perform the cutting step. Designed to be included to the |
| 45 | +# _MMU_POST_UNLOAD step |
| 46 | +# |
| 47 | +[gcode_macro EREC_CUTTER_ACTION] |
| 48 | +description: Cut off the filament tip at the MMU after the unload sequence is complete |
| 49 | +gcode: |
| 50 | + {% set vars = printer["gcode_macro _EREC_VARS"] %} |
| 51 | + |
| 52 | + _CUTTER_OPEN |
| 53 | + _MMU_STEP_MOVE MOVE={vars.feed_length + vars.cut_length} |
| 54 | + {% for i in range(vars.cut_attempts) %} |
| 55 | + _CUTTER_CLOSE |
| 56 | + _CUTTER_OPEN |
| 57 | + {% endfor %} |
| 58 | + _MMU_STEP_MOVE MOVE=-1 |
| 59 | + _CUTTER_CLOSE |
| 60 | + |
| 61 | + _MMU_STEP_SET_FILAMENT STATE=2 # FILAMENT_POS_START_BOWDEN |
| 62 | + _MMU_STEP_UNLOAD_GATE # Repeat gate parking move |
| 63 | + _MMU_M400 # Wait on both move queues |
| 64 | + |
| 65 | +[gcode_macro _CUTTER_CLOSE] |
| 66 | +description: Helper macro to set cutting servo the closed position |
| 67 | +gcode: |
| 68 | + {% set vars = printer["gcode_macro _EREC_VARS"] %} |
| 69 | + SET_SERVO SERVO=cut_servo ANGLE={vars.servo_closed_angle} DURATION={vars.servo_duration} |
| 70 | + G4 P{vars.servo_idle_time * 1000} |
| 71 | + RESPOND MSG="EREC Cutter closed" |
| 72 | + M400 |
| 73 | + |
| 74 | +[gcode_macro _CUTTER_OPEN] |
| 75 | +description: Helper macro to set cutting servo the open position |
| 76 | +gcode: |
| 77 | + {% set vars = printer["gcode_macro _EREC_VARS"] %} |
| 78 | + SET_SERVO SERVO=cut_servo ANGLE={vars.servo_open_angle} DURATION={vars.servo_duration} |
| 79 | + G4 P{vars.servo_idle_time * 1000} |
| 80 | + RESPOND MSG="EREC Cutter open" |
| 81 | + M400 |
| 82 | + |
0 commit comments