From b00dfaf8a751c72934c2e138b8a768df13202ca8 Mon Sep 17 00:00:00 2001 From: gennro Date: Sun, 10 Sep 2023 10:52:33 -0800 Subject: [PATCH] Update ercf_additional.cfg Fixed cutting gcode --- ercf_additional.cfg | 71 +++++++++------------------------------------ 1 file changed, 13 insertions(+), 58 deletions(-) diff --git a/ercf_additional.cfg b/ercf_additional.cfg index f3eec63..d8359f7 100644 --- a/ercf_additional.cfg +++ b/ercf_additional.cfg @@ -8,8 +8,8 @@ variable_retract_length: 35 # The location of the pin, this should be the position of the toolhead when the cutter # just lightly touches the pin -variable_pin_loc_x: 21 -variable_pin_loc_y: 19 +variable_pin_loc_x: 13 +variable_pin_loc_y: 56 # The starting and end positions when making the cut # In particular, instead of making the cut by traveling to the pin location above, @@ -19,17 +19,17 @@ variable_pin_park_x_dist: 5.0 # Position of the toolhead when the cutter is fully compressed # Should leave a small headroom to avoid banging the toolhead or gantry -variable_pin_loc_x_compressed: 5.0 +variable_pin_loc_x_compressed: 0 # Speed related settings # Note that if the cut speed is too fast, the steppers can lose steps # Therefore, for a cut: # - We first make a fast move to accumulate some momentum and get the cut blade to the initial contact with the filament # - We then make a slow move for the actual cut to happen -variable_travel_spd: 7800 -variable_cut_fast_move_spd: 2000 -variable_cut_slow_move_spd: 500 -variable_evacuate_speed: 7800 +variable_travel_spd: 18000 +variable_cut_fast_move_spd: 4000 +variable_cut_slow_move_spd: 800 +variable_evacuate_speed: 18000 variable_cut_dwell_time: 200 # time to dwell at the cut point in ms variable_cut_fast_move_fraction: 0.5 # fraction of the move that uses fast move @@ -39,28 +39,12 @@ variable_cut_fast_move_fraction: 0.5 # fraction of the move that uses fast move variable_safe_margin_x: 30 variable_safe_margin_y: 30 -# Whether or not to make a second cut -# The goal of the second cut is to avoid filament adding friction to the blade causing the lever unable to decompress -# If set to a positive value, we first retract this amount, make the second cut, then extrude back -# Set to 0 to disable to second cut -# You should only enable this if you cannot get the lever to reliabily decompress. -variable_second_cut_retract_length: 0 +#this is the length of filament to move after filament has been cut, just need enough to move it away from the cutting slot. +variable_cut_retract_length: 2 # Whether to eject the filament at the end variable_final_eject: 0 -# Currently ERCF software assumes that tip forming move always moves the extruder (and consequently the encoder) -# Ideally, we should bring formal support of filament cutters to the ERCF software -# In the short term, we perform a "hack" where we wiggle the extruder a little after cutting, -# if the extruder did not make enough movement during the filament cutting phase. -variable_extruder_minimum_movement: 0 # the minimum extruder movement required for this tip forming move, this depends on the minimum distance that the encoder can reliably detect - # setting it to a lower value requires the ERCF encoder to be more sensitive. -variable_extruder_wiggle_length: 10 # the length to retract -> extrude during a wiggle, this needs to be large enough for the encoder to detect the movement -variable_extruder_wiggle_repeat: 3 # number of repeats for the wiggle - -# State variables -variable_retracted_length_: 0 # a state variable to keep track of how much we have retracted during the last cut, this is useful for restoring the filament position - gcode: {% set RETRACT_LENGTH = params.RETRACT_LENGTH | default(printer['gcode_macro CUT_FILAMENT']['retract_length']) | float %} {% set FINAL_EJECT = params.FINAL_EJECT | default(printer['gcode_macro CUT_FILAMENT']['final_eject'], True) | int %} @@ -85,34 +69,17 @@ gcode: G1 E-{RETRACT_LENGTH} F3000 # retract to save filament waste {% set _extruder_moved_dist = _extruder_moved_dist + RETRACT_LENGTH %} {% endif %} - SET_GCODE_VARIABLE macro=CUT_FILAMENT variable=retracted_length_ value={RETRACT_LENGTH} G90 # absolute positioning _MOVE_TO_CUTTER_PIN PIN_PARK_X_LOC={pin_park_x_loc} PIN_PARK_Y_LOC={pin_park_y_loc} # Make the main cut _DO_CUT_MOTION PIN_PARK_X_LOC={pin_park_x_loc} - # Optional secondary cut to help decompressing the lever - {% if second_cut_retract_length > 0 %} - G1 E-{second_cut_retract_length} F3000 - _DO_CUT_MOTION PIN_PARK_X_LOC={pin_park_x_loc} - G1 E{second_cut_retract_length} F3000 - {% endif %} - {% if FINAL_EJECT == 1 %} - G1 E-80 F3000 - {% set _extruder_moved_dist = _extruder_moved_dist + 80 %} - {% endif %} + G1 E-{cut_retract_length} F3000 #moves filament after cut, but not past the toolhead sensor - {% if _extruder_moved_dist < extruder_minimum_movement %} - # make some wiggle moves so that the encoder catch them - {% for _ in range(extruder_wiggle_repeat) %} - G1 E-{extruder_wiggle_length} F3000 - G1 E{extruder_wiggle_length} F3000 - {% endfor %} - {% endif %} - - SET_PRESSURE_ADVANCE ADVANCE={prev_pa} # restore PA + M400 + M117 Filament cut! RESTORE_GCODE_STATE NAME=cut_filament_state [gcode_macro _MOVE_TO_CUTTER_PIN] @@ -149,18 +116,6 @@ gcode: G4 P{cut_dwell_time} G1 X{pin_park_x_loc} F{evacuate_speed} # evacuate -[gcode_macro restore_cutted_filament] -description: extrudes an amount equal (or proportional) to the retraction during the last cut -gcode: - SAVE_GCODE_STATE NAME=restore_cutted_filament_state - {% set RETRACTED_LENGTH = printer['gcode_macro CUT_FILAMENT']['retracted_length_'] | float %} - M83 # relative extrusion - G1 E{RETRACTED_LENGTH} F3000 - SET_GCODE_VARIABLE macro=CUT_FILAMENT variable=retracted_length_ value=0 # clear the retracted amount - RESTORE_GCODE_STATE NAME=restore_cutted_filament_state - - [gcode_macro _ERCF_FORM_TIP_STANDALONE] gcode: - CUT_FILAMENT {rawparams} - + CUT_FILAMENT {rawparams} \ No newline at end of file