Error on 'SET_HEATER_TEMPERATURE HEATER=toolhead TARGET=': unable to parse

Basic Information:

Printer Model: Custom Tool changer
MCU / Printerboard: BTT GTR-M5 and BTT EBB 42 CanBUS
klippy.log (5.6 MB)

Describe your issue:

Hello. I have 2 questions.I am trying to build a tool changer E3D style. Now it is only boards and wired components that I test before building the printer. Toolhead has an EBB 42 Canbus board and tools are wired to the main GTR and M5 board.

  1. When I start a print with T0 and T1, T0 is the first tool that will have to work but it is not loaded on the toolhead, looks like klipper thinks that there is allready a T0 on the toolhead. Instead of loading it, it directly starts the print
 How can I set the toolhead to confirm that there no tools on it before any print and that the toolhead will have to load T0 properly before the print ?

  2. When T0 is loaded, I want the toolhead heater (EBB 42 Canbus} becoming the heater synchronized with T0 extruder but i get the error : Error on ‘SET_HEATER_TEMPERATURE HEATER=toolhead TARGET=’: unable to parse
    Check my T0 macro.




Did you check the forum search?

Additionally you have a heater_generic, the tmc2209 extruder_stepper and heater_fan named toolhead.
This should cause the parsing error as the last toolhead named component/object is your fan.
The TMC stepper section only allows one name and not two.

I changed my toolhead.cfg but still get the same error : Error on ‘SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET=’: unable to parse

[mcu EBBCan]
serial: /dev/serial/by-id/usb-Klipper_stm32g0b1xx_1F0058000A50415833323720-if00
#serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
#canbus_uuid: 0e0d81e4210c

[adxl345]
cs_pin: EBBCan:PB12
spi_software_sclk_pin: EBBCan:PB10
spi_software_mosi_pin: EBBCan:PB11
spi_software_miso_pin: EBBCan:PB2
axes_map: x,y,z

[extruder_stepper extruder_toolhead]
extruder: 
step_pin: EBBCan:PD0
dir_pin: !EBBCan:PD1
enable_pin: !EBBCan:PD2
microsteps: 16
rotation_distance: 33.500
#nozzle_diameter: 0.400
#filament_diameter: 1.750

[heater_generic heater_toolhead]
gcode_id:
#   The id to use when reporting the temperature in the M105 command.
#   This parameter must be provided.
heater_pin: EBBCan:PB13
#max_power:
sensor_type: EPCOS 100K B57560G104F
sensor_pin: EBBCan:PA3
control: pid
pid_Kp: 21.527
pid_Ki: 1.063
pid_Kd: 108.982
min_extrude_temp: 40
min_temp: 0
max_temp: 250
#smooth_time:
#pwm_cycle_time:
#   See the "extruder" section for the definition of the above
#   parameters.

# sensor_type:MAX31865
# sensor_pin: EBBCan:PA4
# spi_bus: spi1
# rtd_nominal_r: 100
# rtd_reference_r: 430
# rtd_num_of_wires: 2

[tmc2209 extruder_stepper extruder_toolhead]
uart_pin: EBBCan:PA15
run_current: 0.650
stealthchop_threshold: 999999

[heater_fan fan_toolhead]
pin: EBBCan:PA1
heater: heater_toolhead
heater_temp: 50.0

[fan]
pin: EBBCan:PA0

For the sake of clearness please use the preformatted text tags for such code snippets:
image
Please update your last post with those tags.

Did you pass the desired temperature value to this command?
You at least miss the referenced extruder for your extruder_stepper.

Those explanations in your config should be commented out.
Best is you try fixing the obvious stuff and upload your printer.cfg.

2 Likes

Did you pass the desired temperature value to this command?

Sorry, I am new to Klipper. I am not sure to understand You. The temperature is shown in the gcode but i get the error message.

You at least miss the referenced extruder for your extruder_stepper.

Because I don’t want it referenced to only one extruder. it is one extruder stepper on the toolhead that loads 9 extruders parqued that don’t have steppers.

This is my macros.cfg

[gcode_macro HOME_LOCK]
gcode:
        MANUAL_STEPPER STEPPER=tool_lock move=280 speed=20 stop_on_endstop=1
        MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=0
        
[gcode_macro START_PRINT]
gcode:
        # Parameters
        {% set BED_TEMP = params.BED_TEMP|int %}
        {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|int %}
        {% set EXTRUDERONE_TEMP = params.EXTRUDERONE_TEMP|int %}

        M190 S{BED_TEMP}            ; set and wait for bed to reach temp
        M109 S{EXTRUDER_TEMP}       ; set and wait for hot end to reach temp
        M109 S{EXTRUDERONE_TEMP}       ; set and wait for hot end to reach temp

[gcode_macro unloadEXTRUDER]                                                     # PARQUER L'EXTRUDER
gcode:
        G1 X345 F12000                                                           # Toolhead va en face de son port non alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée
        G1 Y310 F12000                                                           # Toolhead va dans la safe zone
        G1 Y350 F600                                                             # Approche le tool Ă  5 mm du parc
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET=0                          # Coupe la chauffe de la 
        G1 Y355 F600                                                             # Tool parqué !!
        MANUAL_STEPPER STEPPER=tool_lock move=120 speed=100                        # Unlock tool
        G1 Y310 F600                                                             # Toolhead revient dans la safe zone

[gcode_macro load]                                                               # RETIRER L'EXTRUDER
gcode:
        G1 X345 F12000                                                           # Toolhead va en face de son port alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée
        G1 Y310 F12000                                                           # Toolhead sort du plateau et atteind le Y max
        G1 Y355 F600                                                             # Toolhead en contact avec l'extrudeur parqué
        MANUAL_STEPPER STEPPER=tool_lock move=0 speed=100                      # Lock tool     
        G1 Y350 F600                                                             # Toolhead se retire de 5mm
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDER_TEMP}   
        ACTIVATE_EXTRUDER EXTRUDER=extruder
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=extruder             # Synchronize le stepper de la toolhead Ă  l'extruder
        G1 Y310 F600                                                             # Toolhead revient dans la safe zone

[gcode_macro unloadEXTRUDER1]                                                    # PARQUER L'EXTRUDER1
gcode:
        G1 X262 F12000                                                           # Toolhead va en face de son port non alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée
        G1 Y310 F12000                                                           # Toolhead va dans la safe zone
        G1 Y350 F600                                                             # Approche le tool Ă  5 mm du parc
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET=0                          # Coupe la chauffe de la 
        G1 Y355 F600                                                             # Tool parqué !!
        MANUAL_STEPPER STEPPER=tool_lock move=120 speed=100                        # Unlock tool
        G1 Y310 F600                                                             # Toolhead revient dans la safe zone

[gcode_macro load1]                                                              # RETIRER L'EXTRUDER1
gcode:
        G1 X262 F12000                                                           # Toolhead va en face de son port alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée
        G1 Y310 F12000                                                           # Toolhead sort du plateau et atteind le Y max
        G1 Y355 F600                                                             # Toolhead en contact avec l'extrudeur1 parqué
        MANUAL_STEPPER STEPPER=tool_lock move=0 speed=100                      # Lock tool     
        G1 Y350 F600                                                             # Toolhead se retire de 5mm
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDERONE_TEMP}
        ACTIVATE_EXTRUDER EXTRUDER=extruder1
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=extruder1            # Synchronize le stepper de la toolhead Ă  l'extruder
        G1 Y310 F600                                                             # Toolhead revient dans la safe zone 


[gcode_macro T0]
#variable_pos: 100
gcode:
        #SET_GCODE_VARIABLE MACRO=T0 VARIABLE=POS VALUE={printer.gcode.gcode_position.z}
        SAVE_GCODE_STATE NAME=toolchange
        {% if printer.toolhead.extruder == "none" %}
                load  
        {% elif printer.toolhead.extruder != "extruder" %}
                unload{printer.toolhead.extruder}
                load                
        {% endif %}
        RESTORE_GCODE_STATE NAME=toolchange MOVE=1 MOVE_SPEED=100
        SET_GCODE_OFFSET Z=0
        
[gcode_macro T1]
#variable_pos: 100
gcode:
        #SET_GCODE_VARIABLE MACRO=T1 VARIABLE=POS VALUE={printer.gcode.gcode_position.z}
        SAVE_GCODE_STATE NAME=toolchange
        {% if printer.toolhead.extruder == "none" %}
                load1  
        {% elif printer.toolhead.extruder != "extruder1" %}
                unload{printer.toolhead.extruder}
                load1                
        {% endif %}
        RESTORE_GCODE_STATE NAME=toolchange MOVE=1 MOVE_SPEED=100
        SET_GCODE_OFFSET Z=0

printer.cfg (11.5 KB)

I’m not sure that I understand what you are trying to achieve.

You have defined 9 extruder sections, each of them with an own heater definition.
So the command for setting its temperature would simply be:

SET_HEATER_TEMPERATURE HEATER=extruder7 TARGET=220

or similar.

1 Like

I try to build a tool changer with 9 extruders E3D style. But to spare parts, I want only one extruder stepper mounted on the toolhead that has her own Canbus board. The tools are parked, don’t have extruder steppers. Only heater, heater_fan and thermistor are wired to BTT GTR-M5 Boards via pogo connectors. The idea is that the toolhead that also have pogo connectors loads the tool that is warmed by the board via pogo connectors. This avoids lots of cables between park dock and tool. When the tool is picked it can not be warmed any more from the board and that’s why the heater of the toolhead takes control. I hope it is clear :slight_smile:

Why the following could not work ? I know that target needs a numeric value but in others examples I saw people using string.

SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDER_TEMP}

Because you have no heater called heater_toolhead?

Your heaters are tied to your defined extruders and if I understood your concept correctly, this is also needed otherwise you will not be able to control the heating process of the individual tools.

If you need a heater that takes over at a certain point you likely will need to have complex macros that:

  • turn off the heater that is associated with the extruder
  • move and attach the pre-warmed tool to the printing head
  • turn on a heater_generic to continue

Heater_generic heater_toolhead is defined in toolhead.cfg as mentionned above

[mcu EBBCan]
serial: /dev/serial/by-id/usb-Klipper_stm32g0b1xx_1F0058000A50415833323720-if00
#serial: /dev/serial/by-id/usb-Klipper_Klipper_firmware_12345-if00
#canbus_uuid: 0e0d81e4210c

[adxl345]
cs_pin: EBBCan:PB12
spi_software_sclk_pin: EBBCan:PB10
spi_software_mosi_pin: EBBCan:PB11
spi_software_miso_pin: EBBCan:PB2
axes_map: x,y,z

[extruder_stepper extruder_toolhead]
extruder: 
step_pin: EBBCan:PD0
dir_pin: !EBBCan:PD1
enable_pin: !EBBCan:PD2
microsteps: 16
rotation_distance: 33.500
#nozzle_diameter: 0.400
#filament_diameter: 1.750

[heater_generic heater_toolhead]
gcode_id:
#   The id to use when reporting the temperature in the M105 command.
#   This parameter must be provided.
heater_pin: EBBCan:PB13
#max_power:
sensor_type: EPCOS 100K B57560G104F
sensor_pin: EBBCan:PA3
control: pid
pid_Kp: 21.527
pid_Ki: 1.063
pid_Kd: 108.982
min_extrude_temp: 40
min_temp: 0
max_temp: 250
#smooth_time:
#pwm_cycle_time:
#   See the "extruder" section for the definition of the above
#   parameters.

# sensor_type:MAX31865
# sensor_pin: EBBCan:PA4
# spi_bus: spi1
# rtd_nominal_r: 100
# rtd_reference_r: 430
# rtd_num_of_wires: 2

[tmc2209 extruder_stepper extruder_toolhead]
uart_pin: EBBCan:PA15
run_current: 0.650
stealthchop_threshold: 999999

[heater_fan fan_toolhead]
pin: EBBCan:PA1
heater: heater_toolhead
heater_temp: 50.0

[fan]
pin: EBBCan:PA0

I think you understand my project. I am testing with 2 tools. Here are the macros. My guess is, M109 S
 T0 and T1 warm at start gcode. So the docks are always powering the tools. On a toolchange from T0 to T1, T0 is first unload , extruder_toolhead tool is no more synchronised to extruder and the heater_toolhead is cut off. Then T1 is loaded, activate extruder1, sync the extruder_toolhead to extruder1, heater_toolhead takes control. Now with the if statement in gcode_macro load1, I have no more error message but nothing happening, the heater_toolhead des not warm.

[gcode_macro HOME_LOCK]
gcode:
        MANUAL_STEPPER STEPPER=tool_lock move=280 speed=20 stop_on_endstop=1
        MANUAL_STEPPER STEPPER=tool_lock SET_POSITION=0
        
[gcode_macro START_PRINT]
gcode:
        # Parameters
        {% set BED_TEMP = params.BED_TEMP %}
        {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP %}
        {% set EXTRUDERONE_TEMP = params.EXTRUDERONE_TEMP %}

        M190 S{BED_TEMP}            ; set and wait for bed to reach temp
        M109 S{EXTRUDER_TEMP}       ; set and wait for hot end to reach temp
        M109 S{EXTRUDERONE_TEMP}       ; set and wait for hot end to reach temp

[gcode_macro unloadEXTRUDER]                                                     # PARQUER L'EXTRUDER
gcode:
        G1 X345 F12000                                                           # Toolhead va en face de son port non alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée
        G1 Y350 F12000                                                          # Approche le tool Ă  5 mm du parc
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET=0                          # Coupe la chauffe de la 
        G1 Y355 F600                                                             # Tool parqué !!
        MANUAL_STEPPER STEPPER=tool_lock move=120 speed=100                        # Unlock tool
        G1 Y350 F600                                                            # Toolhead revient dans la safe zone
        G1 Y310 F12000

[gcode_macro load]                                                               # RETIRER L'EXTRUDER
gcode:        
        G1 X345 F12000                                                           # Toolhead va en face de son port alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée
        G1 Y350 F12000                                                           # Toolhead sort du plateau et atteind le Y max
        G1 Y355 F600                                                             # Toolhead en contact avec l'extrudeur parqué
        MANUAL_STEPPER STEPPER=tool_lock move=0 speed=100                      # Lock tool     
        G1 Y350 F600                                                             # Toolhead se retire de 5mm
        ACTIVATE_EXTRUDER EXTRUDER=extruder
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=extruder             # Synchronize le stepper de la toolhead Ă  l'extruder
        {% if params.EXTRUDER_TEMP %}
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDER_TEMP}
        {% endif %} 
        
        G1 Y310 F12000                                                             # Toolhead revient dans la safe zone

[gcode_macro unloadEXTRUDER1]                                                    # PARQUER L'EXTRUDER1
gcode:
        G1 X262 F12000                                                           # Toolhead va en face de son port non alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée        
        G1 Y350 F12000                                                             # Approche le tool Ă  5 mm du parc
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET=0                          # Coupe la chauffe de la 
        G1 Y355 F600                                                             # Tool parqué !!
        MANUAL_STEPPER STEPPER=tool_lock move=120 speed=100                        # Unlock tool
        G1 Y350 F600                                                             # Toolhead revient dans la safe zone
        G1 Y310 F12000

[gcode_macro load1]                                                              # RETIRER L'EXTRUDER1
gcode:
        G1 X262 F12000                                                           # Toolhead va en face de son port alimenté
        G1 Z310 F12000                                                           # Toolhead monte à hauteur de la 1Úre rangée
        G1 Y350 F12000                                                           # Toolhead sort du plateau et atteind le Y max
        G1 Y355 F600                                                             # Toolhead en contact avec l'extrudeur1 parqué
        MANUAL_STEPPER STEPPER=tool_lock move=0 speed=100                      # Lock tool     
        G1 Y350 F600                                                             # Toolhead se retire de 5mm
        ACTIVATE_EXTRUDER EXTRUDER=extruder1
        SYNC_EXTRUDER_MOTION EXTRUDER=extruder_toolhead MOTION_QUEUE=extruder1            # Synchronize le stepper de la toolhead Ă  l'extruder
        # Parameters
        {% set BED_TEMP = params.BED_TEMP %}
        {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP %}
        {% set EXTRUDERONE_TEMP = params.EXTRUDERONE_TEMP %}
        {% if params.EXTRUDERONE_TEMP %}
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDERONE_TEMP}
        {% endif %}
        
        G1 Y310 F12000                                                             # Toolhead revient dans la safe zone 


[gcode_macro T0]
#variable_pos: 100
gcode:
        #SET_GCODE_VARIABLE MACRO=T0 VARIABLE=POS VALUE={printer.gcode.gcode_position.z}
        SAVE_GCODE_STATE NAME=toolchange
        {% if printer.toolhead.extruder == "none" %}
                load  
        {% elif printer.toolhead.extruder != "extruder" %}
                unload{printer.toolhead.extruder}
                load                
        {% endif %}
        RESTORE_GCODE_STATE NAME=toolchange MOVE=1 MOVE_SPEED=100
        SET_GCODE_OFFSET Z=0
        
[gcode_macro T1]
#variable_pos: 100
gcode:
        #SET_GCODE_VARIABLE MACRO=T1 VARIABLE=POS VALUE={printer.gcode.gcode_position.z}
        SAVE_GCODE_STATE NAME=toolchange
        {% if printer.toolhead.extruder == "none" %}
                load1  
        {% elif printer.toolhead.extruder != "extruder1" %}
                unload{printer.toolhead.extruder}
                load1                
        {% endif %}
        RESTORE_GCODE_STATE NAME=toolchange MOVE=1 MOVE_SPEED=100
        SET_GCODE_OFFSET Z=0

And when I erase the if statement and just set :

SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET=210

everything works as intented. I just dont want to manually target the temperatures in the macro file everytime i change the slicer temp.

[gcode_macro load]                                                               # RETIRER L'EXTRUDER
gcode:        
        ...
        {% if params.EXTRUDER_TEMP %}
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDER_TEMP}
        {% endif %} 
        ...

You are talking about this part, right?

If so, there is nowhere in this macro where you would pass any EXTRUDER_TEMP.
See Help with Macro: SET_GCODE_VARIABLE doesnt set my variable - #12 by theophile and the following few posts for some information that might be useful.

Yes it is that part but in the load1 macro. I tried :

{% set EXTRUDERONE_TEMP = params.EXTRUDERONE_TEMP %}
        {% if params.EXTRUDERONE_TEMP %}
        SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDERONE_TEMP}
        {% endif %}

No error and still nothing happening. I am lost.

And from where do you pass EXTRUDERONE_TEMP into the load macro?
Again, refer to above link as it discusses some stuff relevant to this:

  1. template expansion, i.e. when are variables evaluated
  2. ways to work with variables across different macros
1 Like

What do you mean exactly ? sorry i am new to klipper. Do you mean from where the temperature is defined ? I defined it in start _print macro. I tried to read your link but the level is hard for me. Does it talk about setting a variable that could be my extruder temp and use it somewhere else ?

Well, you have chosen a quite complex setup that requires a bit more understanding. And at least I will neither write these macros for you nor talk you through each detail of this complex system.

Some pointer, but the rest will be up to you to dig into it:

Yeah it is complex for a newbie like me. I allready read the macro tutorial and the one from voron. They helped me a lot and I tried the search printer objetcs. I will dig.

I tried that and it worked.

{% set EXTRUDER_TEMP = printer.extruder.temperature|int %}
SET_HEATER_TEMPERATURE HEATER=heater_toolhead TARGET={EXTRUDER_TEMP}

Last point is : When I start a print with T0 and T1, T0 is the first tool that will have to work but it is not loaded on the toolhead, klipper shows that there is allready a T0 on the toolhead. Instead of loading it, it directly starts the print
 How can I set the toolhead to confirm that there is no tools on it ? :slight_smile:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.