Giter VIP home page Giter VIP logo

klipper_toolchanger's People

Contributors

garethky avatar psyvision avatar typqxq avatar viesturz avatar xlevus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

klipper_toolchanger's Issues

How are the macros supposed to be used?

Hi, still trying to get this to work fully.
I noticed that the macros are not installed by default.

What is the plan here? Put all of them into my macros.cfg?
Then why are they each in a separate file? Should I pick and choose? Any recommendations on a good starting set?

Tool changing macro setup issue

Hi!
I'm trying to get physical tool changing work, but I keep getting errors. I am building a tool changer similar to the E3D one, but with an electromagnet instead of the stepper.
I'm using the code for testing that I found in /config/example_simple/tools.cfg, but simplified it a bit for my configuration.

[gcode_macro TOOL_PICKUP]
gcode:
  M568 P{myself.name} A2                                               # Put tool heater in Active mode
  SAVE_GCODE_STATE NAME=TOOL_PICKUP                                    # Save GCODE state. Will be restored at the end of pickup code
  G90
  G0 X{myself.zone[0]} Y{myself.zone[1]} F18000                        # Fast move Y in front of parking spot.
  G0 Y{myself.park[1]} F1800                                           # Slow Move to the pickup position for tool.
  M400                                                                 # Wait for all moves to finish.
  TOOL_LOCK                                                            # Lock the tool.
  SET_GCODE_OFFSET Z={myself.offset[2]} MOVE=1                         # Set and move the Z offset. Avoid crashing into bed when moving out later.
  {% if myself.extruder|default("none")|lower !="none" %}              # If the tool has an extruder:
    TEMPERATURE_WAIT_WITH_TOLERANCE TOOL={myself.name}                 # Wait for tool to reach target temperature.
  {% endif %}                                                          
  G0 X{myself.zone[0]} F1800                                           # Slow Move to the zone position for tool.
  M400                                                                 # Wait for current moves to finish.
  RESTORE_GCODE_STATE NAME=TOOL_PICKUP MOVE=0                          # Restore GCODE state. Was saved at thebegining of SUB_TOOL_PICKUP_START. Move fast to last location.
                                                                       # Set the toolhead offsets. Z is set and moved before any moves in SUB_TOOL_PICKUP_START. Needs to be after any RESTORE_GCODE_STATE!
  SET_GCODE_OFFSET X={myself.offset[0]} Y={myself.offset[1]} Z={myself.offset[2]} MOVE=0  # Set X and Y offsets,

But when I call the macro I get this error:
Error evaluating 'gcode_macro TOOL_PICKUP:gcode': UndefinedError: 'myself' is undefined

Am I missing something?

Tag v0.0.2

Please tag v0.0.2 for plugin installs to pickup recent bug fixes

Unable to load module 'ktcclog'

After update to v0.0.3-7-g3065012 I have this problem:

Config error Traceback (most recent call last): File "/home/pi/klipper/klippy/klippy.py", line 175, in _connect self._read_config() File "/home/pi/klipper/klippy/klippy.py", line 141, in _read_config self.load_object(config, section_config.get_name(), None) File "/home/pi/klipper/klippy/klippy.py", line 130, in load_object self.objects[section] = init_func(config.getsection(section)) File "/home/pi/klipper/klippy/extras/toollock.py", line 469, in load_config return ToolLock(config) File "/home/pi/klipper/klippy/extras/toollock.py", line 36, in __init__ self.log = self.printer.load_object(config, 'ktcclog') File "/home/pi/klipper/klippy/klippy.py", line 120, in load_object raise self.config_error("Unable to load module '%s'" % (section,)) configparser.Error: Unable to load module 'ktcclog' webhooks client 1965907888: New connection webhooks client 1965907888: Client info {'program': 'Moonraker', 'version': 'v0.8.0-5-g160f6d6'}
any idea for fixing?
thankyou a lot
MArco

How do?

Greetings,

The fact that some one has gone to the effort of creating a tool changer for those of us with many tool heads, I thank you.

so, just curious if this is a Macro based system or is there a UI menu that I should be looking for?

also, if you have any tool examples, it would help me answer some of those questions

Thanks

Heater macros don't work

Hi!
Thank you for creating this plugin. It would make life so much easier but unfortunately, I can't make it work properly.
I have 2 tools for now, but I don't have any changing movement yet, I just want to verify that all the basic functions work. For some reason the heating macros don't work for me. I replaced the originals with the provided M104 and M109 macros, but they do nothing when they are called. Also SET_TOOL_TEMPERATURE and TEMPERATURE_WAIT_WITH_TOLERANCE doesn't work either.
If I call SET_TOOL_TEMPERATURE TOOL=0 ACTV_TMP=200 and then SET_TOOL_TEMPERATURE TOOL=0 it shows that it changed the temp value in code, but the heater won't turn on.

2023-05-28_13h26_46

I'm not the best in programming, so maybe I missed a step in the configuration. I upload my configs.
tc_test.cfg is for the second toolhead setup, macro_remap.cfg is for the new macros and ktcc.cfg is for the plugin's config.
Could you please check if I've done the configs right?
klipper_config_20230528.zip

Thank you!

Internal error on command:"KTCC_T0"

Hi,

Thank you for creating such a valuable repository. Your hard work and dedication are appreciated.

I've been trying to use your code to control a Jubilee-style printer with two extruders. Almost all macros work fine, except for T1 and T0 (the two tools I have). I'm encountering the following error:

20:32:20
- DEBUG: _save_changes_timer_event:Exception: Internal error on command:"KTCC_T0"
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown
20:32:20
Internal error on command:"KTCC_T0"
20:32:20
Internal error on command:"KTCC_T0"
Once the underlying issue is corrected, use the
"FIRMWARE_RESTART" command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown
20:32:20
- - TRACE: Saving state in logs.
20:32:14
Internal error on command:"T0"
20:32:14
Internal error on command:"_SET_ACTIVE_TOOL"
20:32:14
Internal error on command:"KTCC_T0"
20:32:14
Klipper state: Shutdown
20:32:14
- - TRACE: cmd_SelectTool: T0 - Not Virtual - Pickup
20:32:14
- - TRACE: increase_tool_statistics: After running for Tool: 0. Key: toolmounts_started is: 3
20:32:14
- - TRACE: increase_tool_statistics: Before running for Tool: 0. Key: toolmounts_started is: 2
20:32:14
- - TRACE: increase_tool_statistics: Running for Tool: 0. Provided to record tool stats while key: toolmounts_started and count: 1
20:32:14
- - TRACE: _set_tool_statistics: Tool: 0 provided to record tool stats while key: tracked_mount_start_time and value: 1678769407.61
20:32:13
- - TRACE: _set_tool_statistics:Running for Tool: 0 provided to record tool stats while key: tracked_mount_start_time and value: 1678769407.61
20:32:13
- - TRACE: track_mount_start: Running for Tool: 0.
20:32:13
- - TRACE: _set_tool_statistics: Tool: 0 provided to record tool stats while key: tracked_start_time_active and value: 1678769407.6
20:32:13
- - TRACE: _set_tool_statistics:Running for Tool: 0 provided to record tool stats while key: tracked_start_time_active and value: 1678769407.6
20:32:13
- - TRACE: track_active_heater_start: Running for Tool: 0.
20:32:13
- - TRACE: _set_tool_statistics_time_diff: Tool: 0 value after running: final_time_key: time_heater_standby=0, start_time_key: tracked_start_time_standby=0.
20:32:13
- - TRACE: track_standby_heater_end: Running for Tool: 0.
20:32:13
- - TRACE: .set_timer: T0; temp_type:0; duration:0.
20:32:13
- - TRACE: .set_timer: T0; temp_type:1; duration:0.
20:32:13
- - TRACE: This tool is_virtual is False.
20:32:13
- - TRACE: Current Tool is T-1.
20:32:13
- - TRACE: T0 Selected.
20:32:13
T0

This is my tools.cfg file:

# Config order: ToolGroups must come before tools that use them. Tool that are used as physical_parent must be configured before other virtual tools that use that as parent.


# Enables saving of variables between powerdown of machine. Must be configured before [toollock].
[save_variables]
filename:  ~/variables.cfg

[ktcclog] # Log_level & logfile_level can be set to one of (0 = essential, 1 = info, 2 = debug, 3 = trace)
log_level: 3
logfile_level: 3

[toollock]
purge_on_toolchange = True          # Here we can disable all purging. When disabled it overrides all other purge options. Defaults to true. This can be turned off by a macro for automatic probing hot tools without probing them. For example when doing TAMV or ZTATP.
#init_printer_to_last_tool = True   #Initialise as it was turned off, unlock tool if none was loaded or lock if one was loaded. Defaults to True
tool_lock_gcode:
    SAVE_GCODE_STATE NAME=tool_unlock_state                                         # Save gcode state
    #MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=0                                 # Set assumed possition as rotated to min
    MANUAL_STEPPER STEPPER=tool_lock Move=1.3 SPEED=0.5 SYNC=1      # Move until no longer endstop is triggered, max 1degree. If Endstop is not untriggered then raise an error. Wait for the movement before continuing.
    #SET_TMC_CURRENT STEPPER=tool_lock CURRENT=0.8                                   # Raise current of stepper temporarily
    #MANUAL_STEPPER STEPPER=tool_lock Move=140 SPEED=50 STOP_ON_ENDSTOP=1 SYNC=1     # Move to max and stop on endstop. If Endstop is not triggered then raise an error. Wait for the movement before continuing.
    M400
   # MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=0                                 # Set manual extruder position as 0
   # SET_TMC_CURRENT STEPPER=tool_lock CURRENT=0.7                                   # Decrease current to standard current.
   # RESTORE_GCODE_STATE NAME=tool_unlock_state MOVE=0                               # Restore gcode state
    M117 "Unknown tool Loaded"                                                      # Tool Loaded Message that stays on display.

tool_unlock_gcode:
    SAVE_GCODE_STATE NAME=tool_lock_state                                           # Save gcode state
    MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=0                               # Set assumed possition as rotated to max
    MANUAL_STEPPER STEPPER=tool_lock Move=-3 SPEED=0.5 STOP_ON_ENDSTOP=1 SYNC=1    # Move until no longer endstop is triggered, max 1degree. If Endstop is not untriggered then raise an error. Wait for the movement before continuing.
    #MANUAL_STEPPER STEPPER=tool_lock Move=0 SPEED=100 STOP_ON_ENDSTOP=1 SYNC=1      # Move to min and stop on endstop. If Endstop is not triggered then raise an error. Wait for the movement before continuing.
    M400
    MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=0                                 # Set manual extruder position as 0
    #MANUAL_STEPPER STEPPER=tool_lock ENABLE=0                                       # Turn off the stepper while unlocked so it can rest without triggering the endswitch
    RESTORE_GCODE_STATE NAME=tool_lock_state MOVE=0                                 # Restore gcode state
    M117 Tool Unloaded                                                              # Tool UnLoaded Message that stays on display.

# Used to group several tools with similar settings.
[toolgroup 0]
is_virtual: False            # If True then must have a physical_parent declared and shares extruder, hotend and fan with the physical_parent
pickup_gcode: 
  SUB_TOOL_PICKUP_START T={myself.name}
  SUB_TOOL_PICKUP_END T={myself.name}
dropoff_gcode:
  SUB_TOOL_DROPOFF_START T={myself.name}
  SUB_TOOL_DROPOFF_END T={myself.name}

[tool 0]
tool_group: 0
extruder: extruder
fan: fan
zone: 496,467
park: 496,526
offset: 30.544,37.525,17.576
meltzonelength: 14 #18
idle_to_standby_time: 0.1
#shaper_freq_x: 126.8
#shaper_freq_y: 128.6
#shaper_type_x: 3hump_ei
#shaper_type_y: 3hump_ei

[tool 1]
tool_group: 0
extruder: extruder1
fan: fan1
zone: 363,467
park: 363,526
offset: 30.544,37.525,17.576
meltzonelength: 14 #18
idle_to_standby_time: 0.1
#shaper_freq_x: 119.8
#shaper_freq_y: 126.6
#shaper_type_x: mzv
#shaper_type_y: 2hump_ei

[gcode_macro SUB_TOOL_PICKUP_START]
description: Internal subroutine. Do not use!
# Tnnn: Tool to pickup
gcode:
  {%set myself = printer['tool '~params.T]%}

  M568 P{myself.name} A2                                               # Put tool heater in Active mode

  SAVE_ACCELERATION                                                    # Save current acceleration value.
  M204 S8000                                                           # Set high acceleration for toolchanging

  SAVE_GCODE_STATE NAME=TOOL_PICKUP                                    # Save GCODE state. Will be restored at the end of SUB_TOOL_PICKUP_END
  SET_GCODE_VARIABLE MACRO=HOMING_STATUS VARIABLE=maxx VALUE=0         # Don't use the X-max endstop as EmergencyStop.
  G90

  ##############  Move in to zone  ##############
#{% if printer.toolhead.position.x < 500 %}                           # If Printer inside safezone:
  G0 Y{myself.zone[1]} F4000 
  G0 X{myself.zone[0]} F4000                                     # Fast move XY inside the safezone.
  #{% else %}                                                           # Else, outside of safezone:
  #  G0 X500 F40000                                                       # Fast move X inside the safezone, so we don't crash into other tools.
   # G0 Y{myself.zone[1]} F40000                                          # Fast move Y in front of parking spot.
 # {% endif %}                                                          # /

  ##############  Move in to parking spot  ##############
  #G0 Y{myself.park[1]|int - 15}  F40000                                # Fast Move near the pickup position for tool.
  G0 Y{myself.park[1]} F300                                            # Slow Move to the pickup position for tool.

  ##############  Lock Tool  ##############
  M400                                                                 # Wait for all moves to finish.
  TOOL_LOCK                                                            # Lock the tool.
  SET_GCODE_OFFSET Z={myself.offset[2]} MOVE=1                         # Set and move the Z offset. Avoid crashing into bed when moving out later.

  ##############  Wait for heater  ##############
  {% if myself.extruder|default("none")|lower !="none" %}              # If the tool has an extruder:
    M116 P{myself.name}                                                  # Wait for tool to reach target temperature.
  {% endif %}                                                          # /

  ##############  Move out to zone  ##############
  G0 Y{myself.zone[1]} F6000                                           # Slow Move to the zone position for tool.

[gcode_macro SUB_TOOL_PICKUP_END]
description: Internal subroutine. Do not use!
# Tnnn: Tool to pickup
gcode:
  {%set myself = printer['tool '~params.T]%}
    ##############  Move out to Safe position  ##############
  G0 Y460 F4000                                                        # Fast Move to the safe position for tools.

    ##############  Check Tool Lock  ##############
  #QUERY_ENDSTOPS                                                       # Check the endstops and save the state to be retrieved in the macro below.
  #TOOL_LOCK_CHECK                                                      # MAcro to check so the tool is mounted by slightly advancing the lock again until hit endstop, only if endstop not already hit. Do not wait for it to finish.

    ##############  Finnish up  ##############
  M400                                                                 # Wait for current moves to finish.
  SET_GCODE_VARIABLE MACRO=HOMING_STATUS VARIABLE=maxx VALUE=0         # DONT Use the X max as EmergencyStop.
  RESTORE_GCODE_STATE NAME=TOOL_PICKUP MOVE=0                          # Restore GCODE state. Was saved at thebegining of SUB_TOOL_PICKUP_START. Move fast to last location.
                                                                       # Set the toolhead offsets. Z is set and moved before any moves in SUB_TOOL_PICKUP_START. Needs to be after any RESTORE_GCODE_STATE!
  SET_GCODE_OFFSET X={myself.offset[0]} Y={myself.offset[1]} Z={myself.offset[2]} MOVE=0  # Set X and Y offsets, 

    ##############  Return to saved position  ##############
  G1 F40000
  RESTORE_POSITION

  SAVE_GCODE_STATE NAME=TOOL_PICKUP2                            # Save state for priming nozzle
#  RESPOND MSG="First if:{myself.extruder|default("none")|lower}"

    ##############  Prime the filament, asume it was retracted as per e3d Revo documentation  ##############
  {% if myself.extruder|default("none")|lower !="none" %}       # If the tool has an extruder:
#    RESPOND MSG="First if1:{myself.extruder|default("none")|lower}"
#    RESPOND MSG="Second if:{printer[myself.extruder].can_extrude|default("false")|lower}"
#    RESPOND MSG="Second if1:{printer.toollock.purge_on_toolchange}"
                                                                  # If can extrude and global purge is active:
    {% if printer[myself.extruder].can_extrude|default("false")|lower == 'true' and printer.toollock.purge_on_toolchange %}
#      RESPOND MSG="Second if2:{printer[myself.extruder].can_extrude|default("false")|lower}"
#      RESPOND MSG="Second if3:{printer.toollock.purge_on_toolchange}"
      M83                                                           # Relative extrusion
      G1 E{myself.meltzonelength|int - 2} F1300                     # DeRetract filament from meltzone
      G1 E2 F400                                                    # DeRetract filament from meltzone
    {% endif %}
  {% endif %}
  RESTORE_GCODE_STATE NAME=TOOL_PICKUP2                          # Restore state after priming nozzle
  G1 F30000
  RESTORE_ACCELERATION                                           # Restore saved acceleration value.



[gcode_macro SUB_TOOL_DROPOFF_START]
description: Internal subroutine. Do not use!
# Tnnn: Tool to pickup
gcode:
  {%set myself = printer['tool '~params.T]%}

  SAVE_ACCELERATION                                            # Save current acceleration value.
  M204 S8000                                                   # Set high acceleration for toolchanging

  {% if myself.name|int != printer.toollock.tool_current|int %}
    { action_raise_error("SUB_TOOL_DROPOFF_START: Wrong tool. Asked to dropoff T" ~ myself.name ~ " while current is T" ~ printer.toollock.tool_current ~ ".") }
  {% endif %}

    ##############  Retract the filament as per e3d Revo documentation  ##############
  {% if myself.extruder|default("none")|lower !="none" %}       # If the tool has an extruder:
    M568 P{myself.name} A1                                        # Put tool heater in standby

    {% if printer[myself.extruder].can_extrude|default("false")|lower == 'true' and printer.toollock.purge_on_toolchange %}
      M83                                                           # Relative extrusion
      G1 E-4 F2700                                                  # retract filament from meltzone
      G1 E2 F800                                                    # Extrude slightly to form a tip
      G1 E-{myself.meltzonelength|int - 2} F800                     # Retract filament from meltzone
    {% endif %}
  {% endif %}

  SET_GCODE_OFFSET X=0 Y=0                                      # Set XY offset to 0 so we park the tool right.
  SAVE_GCODE_STATE NAME=TOOL_DROPOFF_002                        # Save GCode state.
  G90                                                           # Absolute positions

  SET_GCODE_VARIABLE MACRO=HOMING_STATUS VARIABLE=maxx VALUE=0 # Don't use the X max as EmergencyStop.

  # Fast Move to the general pickup position for tools.
 #% if printer.toolhead.position.x|int < 500 %}
  G0 X{myslef.zone[0]} F4000 
  G0 Y{myself.zone[1]} F4000 
  #{% else %}
  #  G0 X500 F40000               # Move X and lift z so we don't crash the bed or into other tools.
   # G0 Y{myself.zone[1]} F40000            # Move Y after X and Z
  #{% endif %}
  M400                                # Wait for current moves to finish

  #G0 X{myself.zone[0]} F40000              # Fast Move near the dropoff position for tool.
  G0 Y{myself.park[1]} F3000               # Slow Move to the dropoff position for tool.


[gcode_macro SUB_TOOL_DROPOFF_END]
description: Internal subroutine. Do not use!
# Tnnn: Tool to pickup
gcode:
  {%set myself = printer['tool '~params.T]%}

  M400                                # Wait for current moves to finish
  TOOL_UNLOCK                         # Unlock the tool

  #G0 X{myself.park[0]|int - 15} F6000     # Slow Move to the pickup position for tool.
  G0 Y{myself.zone[1]} F4000                           # Fast Move to the general pickup position for tools.
  M400

  SET_GCODE_VARIABLE MACRO=HOMING_STATUS VARIABLE=maxx VALUE=0 # Use the X max as EmergencyStop.
  RESTORE_GCODE_STATE NAME=TOOL_DROPOFF_002 MOVE=0   # Restore Gcode state
  RESTORE_ACCELERATION                # Restore saved acceleration value.

[gcode_macro SUB_TOOL_WIPE]
description: Internal subroutine. Do not use!
# Tnnn: Tool
gcode:
  {%set myself = printer['tool '~params.T]%}
  ##############  Wipe the nozzle  ##############
  G0 X{myself.park[0]|int - 10}  F3000                                # Fast Move near the pickup position for tool.
  G0 X{myself.zone[0]} F3000                                          # Fast Move to the zone position for tool.
  G0 X{myself.park[0]|int - 10}  F3000                                # Fast Move near the pickup position for tool.
  G0 X{myself.zone[0]} F3000                                          # Fast Move to the zone position for tool.
  G0 X{myself.park[0]|int - 10}  F3000                                # Fast Move near the pickup position for tool.
  G0 X{myself.zone[0]} F3000                                          # Fast Move to the zone position for tool.
  G0 X{myself.park[0]|int - 10}  F3000                                # Fast Move near the pickup position for tool.
  G0 X{myself.zone[0]} F3000                                          # Fast Move to the zone position for tool.

And this is my tool_macros.cfg file:

########################################################################
# Tool change macros for Mainsail compability
#######################################################################
[gcode_macro T_1]
gcode: KTCC_TOOL_DROPOFF_ALL
[gcode_macro T0]
variable_active: 0
gcode: _SET_ACTIVE_TOOL TOOL=0
[gcode_macro T1]
variable_active: 0
gcode: _SET_ACTIVE_TOOL TOOL=1


[gcode_macro TOOL_DROPOFF]
gcode:
  KTCC_TOOL_DROPOFF_ALL
  SUB_SET_ALL_TOOLS_DEACTIVE


[gcode_macro _SET_ACTIVE_TOOL]
description: Sets the active tool in mainsail (and all others inactive)
gcode:
  SUB_SET_ALL_TOOLS_DEACTIVE
  {% set TOOL = params.TOOL|default(-1)|int %}
  SET_GCODE_VARIABLE MACRO=T{TOOL} VARIABLE=active VALUE=1
  KTCC_T{TOOL}

[gcode_macro SUB_SET_ALL_TOOLS_DEACTIVE]
description: Sets the active tool in mainsail (and all others inactive)
gcode:
  SET_GCODE_VARIABLE MACRO=T0 VARIABLE=active VALUE=0
  SET_GCODE_VARIABLE MACRO=T1 VARIABLE=active VALUE=0

#[gcode_macro SUB_TOOL_LOCK_ENDSTOP_CHECK]
#description: Before this is called and evaluated a QUERY_ENDSTOPS checks the endstops. If not triggered this will advance the stepper 1*, check the endstop and call the next step.
#gcode:
    # If endstop is not triggered then try to lock again just in case the lock slipped. Need to check the endstops before calling this. 
    # {% if printer.toollock.last_endstop_query['manual_stepper tool_lock']|default(0) == 0  %}
#    {% if printer.toollock.last_endstop_query['manual_stepper tool_lock']|default(False) == False  %}
#    {% if printer.query_endstops.last_query['manual_stepper tool_lock']|default(0) == 0 %}
#      {action_respond_info("TOOL_LOCK_ENDSTOP_CHECK: Endstop on manual_stepper tool_lock not triggered at check.") }
#      MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=140                                 # Set assumed possition as rotated to max (should already be this)
 #     MANUAL_STEPPER STEPPER=tool_lock Move=142 SPEED=50 STOP_ON_ENDSTOP=2 SYNC=1       # Move 2 degrees over max and stop on endstop. If Endstop is not triggered then raise an error. Wait for the movement before continuing.
 #     M400
#      QUERY_ENDSTOPS
#      G4 P1000 # Dwell one second.
 #     KTCC_ENDSTOP_QUERY ENDSTOP='manual_stepper tool_lock' ATEMPTS=3
 #     SUB_TOOL_LOCK_ENDSTOP_CHECK_SECONDSTAGE
 #   {% endif %}

#[gcode_macro SUB_TOOL_LOCK_ENDSTOP_CHECK_SECONDSTAGE]
#description: Before this is called and evaluated a QUERY_ENDSTOPS checks the endstops. If not triggered this will advance the stepper 1*, check the endstop and call the next step.
#gcode:
    # If endstop is not triggered then try to lock again just in case the lock slipped. Need to check the endstops before calling this. 
    # {% if printer.toollock.last_endstop_query['manual_stepper tool_lock']|default(0) == 0  %}
#    {% if printer.toollock.last_endstop_query['manual_stepper tool_lock']|default(False) == False  %}
#    {% if printer.query_endstops.last_query['manual_stepper tool_lock']|default(0) == 0 %}
#      {action_respond_info("TOOL_LOCK_ENDSTOP_CHECK: Endstop on manual_stepper tool_lock not triggered at check.") }
#      MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=140                                 # Set assumed possition as rotated to max (should already be this)
#      MANUAL_STEPPER STEPPER=tool_lock Move=142 SPEED=50 STOP_ON_ENDSTOP=2 SYNC=1       # Move 2 degrees over max and stop on endstop. If Endstop is not triggered then raise an error. Wait for the movement before continuing.
 #     M400
 #     QUERY_ENDSTOPS
 #     G4 P1000 # Dwell one second.
 #     QUERY_ENDSTOPS
 #     G4 P1000 # Dwell one second.
    #  QUERY_ENDSTOPS
 #     G4 P1000 # Dwell one second.
 #     KTCC_ENDSTOP_QUERY ENDSTOP='manual_stepper tool_lock' ATEMPTS=3
 #     SUB_TOOL_LOCK_ENDSTOP_CHECK_THIRDSTAGE
  #  {% endif %}

#[gcode_macro SUB_TOOL_LOCK_ENDSTOP_CHECK_THIRDSTAGE]
#description: Before this is called and evaluated a QUERY_ENDSTOPS checks the endstops. If not triggered this either pause the print or throw an error.
#gcode:
  # If endstop is not triggered then pause or raise error.
#  {% if printer.toollock.last_endstop_query['manual_stepper tool_lock']|default(False) == False  %}
#    KTCC_LOG_INFO MSG="SUB_TOOL_LOCK_ENDSTOP_CHECK_THIRDSTAGE: Endstop on manual_stepper tool_lock still not triggered at second check. Pauses untill endstop is triggerd."
#    SET_TMC_CURRENT STEPPER=tool_lock CURRENT=0.7             # Decrease current to somewhat lower current.
#    KTCC_SET_ALL_TOOL_HEATERS_OFF
#    KTCC_ENDSTOP_QUERY ENDSTOP='manual_stepper tool_lock'     # Running continuesly until triggered and called by GCODE so it will be executed after previous commands in order.

    # After this we asume the error is fixed and can resume.
#    KTCC_RESUME_ALL_TOOL_HEATERS

#  {% endif %}

#[gcode_macro SUB_TOOL_LOCK_CHECK]
#description: Check so the tool is mounted by slightly advancing the lock again until hit endstop, only if endstop not already hit. Do not wait for it to finish.
#gcode:
  # If endstop is not triggered then try to lock again for safety. Need to check the endstops before calling this. 
#  {% if printer.toollock.last_endstop_query['manual_stepper tool_lock']|default(False) == False  %}
#    SET_TMC_CURRENT STEPPER=tool_lock CURRENT=1.0
#    MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=140                                 # Set assumed possition as rotated to max (should already be this)
#    MANUAL_STEPPER STEPPER=tool_lock Move=150 SPEED=50 STOP_ON_ENDSTOP=2 SYNC=1       # Move 10 degrees over max and stop on endstop. If Endstop is not triggered then raise an error. Wait for the movement before continuing.
    # Ceck if the tool is locked by checking on the endstops.
#    KTCC_ENDSTOP_QUERY ENDSTOP='manual_stepper tool_lock' ATEMPTS=3
    # QUERY_ENDSTOPS
#    SUB_TOOL_LOCK_ENDSTOP_CHECK
#    M400
#    SET_TMC_CURRENT STEPPER=tool_lock CURRENT=0.8
#  {% endif %}


#[gcode_macro SUB_TOOL_UNLOCK_ENDSTOP_CHECK]
#description: Before this is called and evaluated a QUERY_ENDSTOPS checks the endstops. If not triggered this either pause the print or throw an error.
#gcode:
  # If endstop is not triggered then pause or raise error.
#  {% if printer.toollock.last_endstop_query['manual_stepper tool_lock']|default(False) == False  %}
#    {action_respond_info("SUB_TOOL_UNLOCK_ENDSTOP_CHECK: Endstop on manual_stepper tool_lock still not triggered at unlock.") }
    # {% if printer['gcode_macro HOMING_STATUS'].z|int == 3 %}  # If printer is homing Z
    #   { action_emergency_stop("The tool didn't unlock during homing.") }     # Emergency stop so we don't crash the bed. Pause won't work.
    # {% endif %}
 #   SET_TMC_CURRENT STEPPER=tool_lock CURRENT=0.7             # Decrease current to somewhat lower current.
#    KTCC_LOG_INFO MSG="SUB_TOOL_LOCK_ENDSTOP_CHECK_THIRDSTAGE: Endstop on manual_stepper tool_lock still not triggered at second check. Pauses untill endstop is triggerd."
 #   KTCC_SET_ALL_TOOL_HEATERS_OFF
 #   KTCC_ENDSTOP_QUERY ENDSTOP='manual_stepper tool_lock'     # Running continuesly until triggered and called by GCODE so it will be executed after previous commands in order.

    # After this we asume the error is fixed and can resume.
   # KTCC_RESUME_ALL_TOOL_HEATERS
 # {% endif %}


[gcode_macro ToolUnlock]
gcode:
  Tool_Unlock
  M117 Current Tool set to -1
  { action_respond_info('Current Tool set to -1 (Unlocked).') }

[gcode_macro ToolLock]
gcode:
  Tool_Lock
  M117 Current Tool set to -2
  { action_respond_info('Current Tool set to -2 (Unknown tool). To indicate actual tool, use SAVE_CURRENT_TOOL Tn') }

[gcode_macro SAVE__CURRENT__TOOL]
gcode:
  {% if params.T is defined %}
    SAVE_CURRENT_TOOL T{params.T}
  {% endif %}

[gcode_macro SAVE_ACCELERATION]
variable_max_accel: 0
gcode:
  SET_GCODE_VARIABLE MACRO=SAVE_ACCELERATION VARIABLE=max_accel VALUE={printer.toolhead.max_accel}

[gcode_macro RESTORE_ACCELERATION]
gcode:
  {% if printer['gcode_macro SAVE_ACCELERATION'].max_accel|int == 0 %}
    { action_respond_info("RESTORE_ACCELERATION: No acceleration saved.") }
  {% else %}
    M204 S{printer['gcode_macro SAVE_ACCELERATION'].max_accel}
  {% endif %}

[gcode_macro KTCC__DUMP__PRINT__STATS]
gcode:
  KTCC_DUMP_PRINT_STATS

[gcode_macro KTCC__INIT__PRINT__STATS]
gcode:
  KTCC_INIT_PRINT_STATS

Any help or guidance you could provide to resolve this issue would be greatly appreciated.

Thank you.

Sincerely,
Anuar R. Giménez

tool 0 is not well formated

Hi,
I am try to implement your Toolchanger.
I am running a Jubilee typ Toolchanger.
My problem is that i cant get the tool configuration to work. When I try to declare a tool in the printer.cfg, an error pops up and tells me:

"Coordinates of section 'tool 0' is not well formated: zone Offset is malformed, must be a list of x,y,z If you want it blank, use 0,0,0"

My config looks like this:

[toolgroup 0]
is_virtual: False # If True then must have a physical_parent declared and shares extruder, hotend and fan with the physical_parent
pickup_gcode:
SUB_TOOL_PICKUP_START T={myself.name}
SUB_TOOL_PICKUP_END T={myself.name}
dropoff_gcode:
SUB_TOOL_DROPOFF_START T={myself.name}
SUB_TOOL_DROPOFF_END T={myself.name}

[tool 0]
tool_group: 0
extruder: extruder
fan: fan
zone: 550,100
park: 598,100
offset: -1.046,-0.220,-1.510

If i delete "tool group: 0", i get the error:

"Option 'tool_group' in section 'tool 9' must be specified"

which makes sense, since you sad in your explanation, it has to be declared.

What do you think is my mistake?
Thanks in advance

Start Macro on Extruder 2 while printing with Extruder 1

Hi,

is it possible to have an extruder in parking position already heating and purging, while the printer is busy printing with another extruder? That would save a lot of time, because the tool change could be really quick.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.