Skip to content

Commit

Permalink
expose new option 'toolhead_post_load_tighten' to help mitigate false…
Browse files Browse the repository at this point in the history
… clog detection immediately after load when not syncing extruder and gear
  • Loading branch information
moggieuk committed Jul 13, 2024
1 parent 2c48ecc commit 8e11456
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
6 changes: 3 additions & 3 deletions config/base/mmu_macro_vars.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ variable_extruder_eject_speed : 25 ; Speed mm/s used for parking_distance (an


# CLIENT MACROS -----------------------------------------------------------
# If using the PAUSE/RESUME/CANCEL_PRINT macros shipped with Happy Hare
# these variables allow for customizaion and basic extension
# If using the recommended PAUSE/RESUME/CANCEL_PRINT macros shipped with
# Happy Hare these variables allow for customization and basic extension
# (optional/client_macros.cfg)
#
[gcode_macro _MMU_CLIENT_VARS]
Expand All @@ -280,7 +280,7 @@ variable_unretract : 1.0 ; Distance in mm to extruder to undo retr
variable_unretract_speed : 30 ; Speed mm/s of extrusion movement

# You can extend functionality by adding a command (or call to your gcode
# macro). E.g. for additional LED control
# macro). E.g. for additional LED control or custom operations
variable_user_pause_extension : '' ; Executed after the klipper base pause
variable_user_resume_extension : '' ; Executed before the klipper base resume
variable_user_cancel_extension : '' ; Executed before the klipper base cancel_print
Expand Down
6 changes: 6 additions & 0 deletions config/base/mmu_parameters.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ toolhead_ooze_reduction: 0 # Reduction in extruder loading length to fine tune
#
toolhead_unload_safety_margin: 10 # Extra movement saftey margin (default: 10mm)

# If not synchronizing gear and extruder and you experience a "false" clog detection immediately after the tool change
# it might be because of a long bowden and/or large internal diameter that causes slack in the filament. This optional
# move will tighten the filament after a load
#
toolhead_post_load_tighten: 1 # 1 to enable, 0 disabled. Ignored if 'sync_to_extruder: 1'

# ADVANCED: Controls the detection of successful extruder load/unload movement and represents the fraction of allowable
# mismatch between actual movement and that seen by encoder. Setting to 100% tolerance effectively turns off checking.
# Some designs of extruder have a short move distance that may not be picked up by encoder and cause false errors. This
Expand Down
8 changes: 4 additions & 4 deletions config/base/mmu_software.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ gcode:
{% set home_mmu = vars.home_mmu|lower == 'true' %}

{% set filament_loaded = printer.mmu.filament_pos == 10 %}
{% set using_bypass = printer.mmu.tool == -2 and filament_loaded %}
{% set using_bypass = printer.mmu.tool == -2 %}
{% set num_colors = referenced_tools|length %}

{% if printer.mmu.enabled %}
Expand Down Expand Up @@ -138,8 +138,8 @@ gcode:
MMU_SLICER_TOOL_MAP

SET_GCODE_VARIABLE MACRO=_MMU_ERROR_DIALOG VARIABLE=show_abort VALUE={True} # Show abort option during startup
{% if using_bypass %}
RESPOND MSG="MMU Bypass selected"
{% if using_bypass and filament_loaded %}
RESPOND MSG="MMU Bypass selected and loaded"
{% if num_colors > 1 %}
SET_GCODE_VARIABLE MACRO=_MMU_ERROR_DIALOG VARIABLE=custom_msg VALUE="{custom_msg}"
MMU_PAUSE MSG="Bypass selected for multi-color print"
Expand Down Expand Up @@ -174,7 +174,7 @@ gcode:
{% set slicer_tool_map = printer.mmu.slicer_tool_map %}
{% set initial_tool = slicer_tool_map.initial_tool %}
{% set tools = slicer_tool_map.referenced_tools %}
{% if not using_bypass or tools|length >= 1 %}
{% if not using_bypass %}
# Future: Could do extra checks like filament material type/color checking here
# to ensure what's loaded on MMU matches the slicer expectations
{% if check_gates and tools|length > 0 %}
Expand Down
18 changes: 11 additions & 7 deletions extras/mmu.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def __init__(self, config):
self.toolhead_ooze_reduction = config.getfloat('toolhead_ooze_reduction', 0., minval=-10., maxval=35.) # +ve value = reduction of load length
self.toolhead_unload_safety_margin = config.getfloat('toolhead_unload_safety_margin', 10., minval=0.) # Extra unload distance
self.toolhead_move_error_tolerance = config.getfloat('toolhead_move_error_tolerance', 60, minval=0, maxval=100) # Allowable delta movement % before error
self.toolhead_post_load_tighten = config.getint('toolhead_post_load_tighten', 0, minval=0, maxval=1) # Whether to apply filament tightening move after load (if not synced). TODO: Currently hidden
self.toolhead_post_load_tighten = config.getint('toolhead_post_load_tighten', 0, minval=0, maxval=1) # Whether to apply filament tightening move after load (if not synced)

# Extra Gear/Extruder synchronization controls
self.sync_to_extruder = config.getint('sync_to_extruder', 0, minval=0, maxval=1)
Expand Down Expand Up @@ -6180,6 +6180,7 @@ def cmd_MMU_TEST_CONFIG(self, gcmd):
self.toolhead_sensor_to_nozzle = gcmd.get_float('TOOLHEAD_SENSOR_TO_NOZZLE', self.toolhead_sensor_to_nozzle, minval=0.)
self.toolhead_extruder_to_nozzle = gcmd.get_float('TOOLHEAD_EXTRUDER_TO_NOZZLE', self.toolhead_extruder_to_nozzle, minval=0.)
self.toolhead_ooze_reduction = gcmd.get_float('TOOLHEAD_OOZE_REDUCTION', self.toolhead_ooze_reduction, minval=0.)
self.toolhead_post_load_tighten = gcmd.get_int('TOOLHEAD_POST_LOAD_TIGHTEN', self.toolhead_post_load_tighten, minval=0, maxval=1)
self.gcode_load_sequence = gcmd.get_int('GCODE_LOAD_SEQUENCE', self.gcode_load_sequence, minval=0, maxval=1)
self.gcode_unload_sequence = gcmd.get_int('GCODE_UNLOAD_SEQUENCE', self.gcode_unload_sequence, minval=0, maxval=1)

Expand Down Expand Up @@ -6286,6 +6287,7 @@ def cmd_MMU_TEST_CONFIG(self, gcmd):
if self._has_sensor(self.ENDSTOP_EXTRUDER_ENTRY):
msg += "\ntoolhead_entry_to_extruder = %.1f" % self.toolhead_entry_to_extruder
msg += "\ntoolhead_ooze_reduction = %.1f" % self.toolhead_ooze_reduction
msg += "\ntoolhead_post_load_tighten = %d" % self.toolhead_post_load_tighten
msg += "\ngcode_load_sequence = %d" % self.gcode_load_sequence
msg += "\ngcode_unload_sequence = %d" % self.gcode_unload_sequence

Expand All @@ -6303,6 +6305,14 @@ def cmd_MMU_TEST_CONFIG(self, gcmd):
msg += "\ntoolchange_retract = %.1f" % self.toolchange_retract
msg += "\ntoolchange_retract_speed = %.1f" % self.toolchange_retract_speed

msg += "\n\nLOGGING:"
msg += "\nlog_level = %d" % self.log_level
msg += "\nlog_file_level = %d" % self.log_file_level
if self.mmu_logger:
msg += "\nlog_visual = %d" % self.log_visual
msg += "\nlog_statistics = %d" % self.log_statistics
msg += "\nconsole_gate_stat = %s" % self.console_gate_stat

msg += "\n\nOTHER:"
msg += "\nextruder_temp_variance = %.1f" % self.extruder_temp_variance
if self._has_encoder():
Expand All @@ -6319,12 +6329,6 @@ def cmd_MMU_TEST_CONFIG(self, gcmd):
msg += "\nretry_tool_change_on_error = %d" % self.retry_tool_change_on_error
msg += "\nprint_start_detection = %d" % self.print_start_detection
msg += "\nshow_error_dialog = %d" % self.show_error_dialog
msg += "\nlog_level = %d" % self.log_level
msg += "\nlog_file_level = %d" % self.log_file_level
if self.mmu_logger:
msg += "\nlog_visual = %d" % self.log_visual
msg += "\nlog_statistics = %d" % self.log_statistics
msg += "\nconsole_gate_stat = %s" % self.console_gate_stat

msg += "\n\nCALIBRATION:"
msg += "\nmmu_calibration_bowden_length = %.1f" % self.calibrated_bowden_length
Expand Down

0 comments on commit 8e11456

Please sign in to comment.