From d86f6b0c5b5c92dc743a8d48164bfd94a4c7f60a Mon Sep 17 00:00:00 2001 From: tehniemer Date: Wed, 22 Nov 2023 12:50:20 -0600 Subject: [PATCH 1/2] Add wipe and variable for charging nozzle to prime line macro Added a wipe after priming and a user configurable variable to set the pre-prime extrude distance, essentially charging the nozzle. --- macros/helpers/prime_line.cfg | 7 ++++++- user_templates/variables.cfg | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/macros/helpers/prime_line.cfg b/macros/helpers/prime_line.cfg index fef104b69..b932003a4 100644 --- a/macros/helpers/prime_line.cfg +++ b/macros/helpers/prime_line.cfg @@ -4,6 +4,7 @@ gcode: {% set prime_line_length = params.LINE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_length)|float %} {% set prime_line_purge_distance = params.PURGE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].prime_line_purge_distance)|float %} {% set prime_line_flowrate = params.FLOWRATE|default(printer["gcode_macro _USER_VARIABLES"].prime_line_flowrate)|float %} + {% set charge_length = params.CHARGE_LENGTH|default(printer["gcode_macro _USER_VARIABLES"].charge_length)|float %} # Set internal macro vars {% set prime_line_x, prime_line_y = printer["gcode_macro _USER_VARIABLES"].prime_line_xy|map('float') %} @@ -21,6 +22,8 @@ gcode: {% set line_height = 0.6 %} + {% set wipe_length = prime_line_length * 0.8 %} + # some more Macro parameters after retrieving defaults {% set prime_line_x = params.START_X|default(prime_line_x)|float %} {% set prime_line_y = params.START_Y|default(prime_line_y)|float %} @@ -82,14 +85,16 @@ gcode: # Add pressure in the nozzle G92 E0 - G1 E18 F300 + G1 E{charge_length} F300 # Prime line G92 E0 {% if prime_line_direction == "X" %} G1 X{prime_line_x + prime_line_length} E{prime_line_purge_distance} F{speed} + G1 X{prime_line_x + wipe_length} F{St} {% elif prime_line_direction == "Y" %} G1 Y{prime_line_y + prime_line_length} E{prime_line_purge_distance} F{speed} + G1 Y{prime_line_y + wipe_length} F{St} {% else %} { action_respond_error("Prime line direction is not valid. Choose either X or Y in the variables.cfg file!") } {% endif %} diff --git a/user_templates/variables.cfg b/user_templates/variables.cfg index c6f0468ed..fdf6e5506 100644 --- a/user_templates/variables.cfg +++ b/user_templates/variables.cfg @@ -60,6 +60,7 @@ variable_prime_line_direction: "X" # can also be set to "Y" variable_prime_line_length: 40 # length of the prime line on the bed (in mm) variable_prime_line_purge_distance: 30 # length of filament to purge (in mm) variable_prime_line_flowrate: 10 # mm3/s used for the prime line +variable_charge_length: 18 # length of filament to pressurize the nozzle before starting the move ## Park position used when pause, end_print, etc... variable_park_position_xy: -1, -1 From 175f3507c33e0ca9f3cd10994702464e4b3c993a Mon Sep 17 00:00:00 2001 From: tehniemer Date: Wed, 22 Nov 2023 13:33:10 -0600 Subject: [PATCH 2/2] Add user configurable variables for retract distances in macros Added two new variables for retract, one for the cancel and end print macros and another for the nozzle cleaning macro. --- macros/base/cancel_print.cfg | 4 +++- macros/base/end_print.cfg | 3 ++- macros/helpers/nozzle_cleaning.cfg | 8 ++++---- user_templates/variables.cfg | 4 ++++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/macros/base/cancel_print.cfg b/macros/base/cancel_print.cfg index d61f699b5..9ab43a484 100644 --- a/macros/base/cancel_print.cfg +++ b/macros/base/cancel_print.cfg @@ -10,6 +10,7 @@ gcode: {% set light_enabled = printer["gcode_macro _USER_VARIABLES"].light_enabled %} {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} + {% set retract_length = printer["gcode_macro _USER_VARIABLES"].retract_length|default(10)|float %} PARK @@ -21,7 +22,8 @@ gcode: {% else %} # pull back the filament a little bit _TIP_SHAPING - G1 E-10 F2100 + G92 E0 + G1 E-{retract_length} F3600 {% endif %} {% if turn_off_heaters_in_end_print %} diff --git a/macros/base/end_print.cfg b/macros/base/end_print.cfg index 4f1a5f23f..acaecb23b 100644 --- a/macros/base/end_print.cfg +++ b/macros/base/end_print.cfg @@ -12,6 +12,7 @@ gcode: {% set status_leds_enabled = printer["gcode_macro _USER_VARIABLES"].status_leds_enabled %} {% set bed_mesh_enabled = printer["gcode_macro _USER_VARIABLES"].bed_mesh_enabled %} {% set filter_default_time = printer["gcode_macro _USER_VARIABLES"].filter_default_time_on_end_print|default(600)|int %} + {% set retract_length = printer["gcode_macro _USER_VARIABLES"].retract_length|default(10)|float %} PARK @@ -24,7 +25,7 @@ gcode: # pull back the filament a little bit _TIP_SHAPING G92 E0 - G1 E-10 F2100 + G1 E-{retract_length} F3600 {% endif %} {% if turn_off_heaters_in_end_print %} diff --git a/macros/helpers/nozzle_cleaning.cfg b/macros/helpers/nozzle_cleaning.cfg index aa7c599b9..10f5ba0c4 100644 --- a/macros/helpers/nozzle_cleaning.cfg +++ b/macros/helpers/nozzle_cleaning.cfg @@ -68,7 +68,8 @@ gcode: [gcode_macro PURGE] description: Purge a specific amount of filament ontop of the purge bucket gcode: - {% set DISTANCE = params.DISTANCE|default(printer["gcode_macro _USER_VARIABLES"].purge_distance)|int %} + {% set DISTANCE = params.DISTANCE|default(printer["gcode_macro _USER_VARIABLES"].purge_distance)|float %} + {% set RETRACT = params.RETRACT|default(printer["gcode_macro _USER_VARIABLES"].purge_retract_length)|float %} {% set OOZE_TIME = params.OOZE_TIME|default(printer["gcode_macro _USER_VARIABLES"].purge_ooze_time)|int %} {% set TEMP = params.TEMP|default(printer["gcode_macro _USER_VARIABLES"].print_default_extruder_temp)|float %} {% set Z_DROP = params.Z_DROP|default(1)|int %} @@ -102,12 +103,11 @@ gcode: # Heat if needed and purge _LOW_TEMP_CHECK T={TEMP} G92 E0 - G1 E{DISTANCE|float} F150 + G1 E{DISTANCE} F150 # Retract G92 E0 - G1 E-1.7 F2100 - G1 E-18.3 F150 + G1 E-{RETRACT} F3600 G92 E0 # Wait some time to let the nozzle ooze before cleaning diff --git a/user_templates/variables.cfg b/user_templates/variables.cfg index c6f0468ed..30f0fd92a 100644 --- a/user_templates/variables.cfg +++ b/user_templates/variables.cfg @@ -61,6 +61,9 @@ variable_prime_line_length: 40 # length of the prime line on the bed (in mm) variable_prime_line_purge_distance: 30 # length of filament to purge (in mm) variable_prime_line_flowrate: 10 # mm3/s used for the prime line +## Length of filament to retract to reduce oozing after end of print (in mm) +variable_retract_length: 10 + ## Park position used when pause, end_print, etc... variable_park_position_xy: -1, -1 variable_park_lift_z: 50 @@ -202,6 +205,7 @@ variable_brush_over_y_axis: True # Cleanup is done moving the extruder along the variable_brush_xyz: -1, -1, -1 # Position of the brush center for nozzle cleaning variable_purge_bucket_xyz: -1, -1, -1 # Purge bucket position variable_purge_distance: 30 # Amount to purge (in mm) +variable_purge_retract_length: 5 # Length of filament to retract to reduce oozing (in mm) variable_purge_ooze_time: 10 # Time (in seconds) to wait after the purge to let the nozzle ooze before going to the brush ## Servo angles used to define the retracted and deployed positions