Klipper error with Mainsail website macros

hello guys!

after adding PAUSE RESUME CANCEL macros from the Mainsail website, Klipper shows me this error:

Option ‘{% if printer.pause_resume.is_paused|lower’ is not valid in section ‘gcode_macro cancel_print’

any idea please? Thank you

klippy.log (777.0 KB)

As the error says there is something wrong with the macro.
Maybe there is only a character missing but without the whole config it is hard to say.
Please attach the latest klippy.log or at least your printer.cfg if everything is put in there.

@hitman47
That’s the reason we ask for the klippy.log you did not provide

klipper log added, sorry!

klipper log added, sorry noob here!

Obviously you made a change to [gcode_macro cancel_print]

Before:

[gcode_macro CANCEL_PRINT]
description = Cancel the actual running print
rename_existing = BASE_CANCEL_PRINT
gcode = 
	SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
	TURN_OFF_HEATERS
	G0 X5 Y220 Z10
	CLEAR_PAUSE
	SDCARD_RESET_FILE
	BASE_CANCEL_PRINT

After:

[gcode_macro CANCEL_PRINT]
description = Cancel the actual running print
rename_existing = CANCEL_PRINT_BASE
gcode = 
	SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
variable_park = True
{% if printer.pause_resume.is_paused|lower = = 'false' and park|lower == 'true'%}
	_TOOLHEAD_PARK_PAUSE_CANCEL
	{% endif %}
	
	
	TURN_OFF_HEATERS
	CANCEL_PRINT_BASE

What was your intension?

My intention was to get a clean macro, because I was not sure about the previous one I found in a random github.

So I copied the macros from the Mainsail website, just added my sensor commands and here I am…

I’m not into coding and spent hours looking for that line but I don’t understand what’s wrong with it.

Did the printer already run with Klipper?

I would recommend to use the previous one. That worked.

I do not know that macro in particular but it is essential to use the proper indention of the code.
So at least from this perspective it should look like follows:

[gcode_macro CANCEL_PRINT]
description = Cancel the actual running print
rename_existing = CANCEL_PRINT_BASE
gcode = 
	SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=0
	variable_park = True
	{% if printer.pause_resume.is_paused|lower = = 'false' and park|lower == 'true' %}
		_TOOLHEAD_PARK_PAUSE_CANCEL
	{% endif %}
	
	
	TURN_OFF_HEATERS
	CANCEL_PRINT_BASE

I feel so dumb guys… :sweat_smile:
Just opened mainsail.cfg and all these macros are already into it…
So there’s no reason to ass pause resume cancel to my macros.cfg right?

Why go the easy way if you can go the hard one. :smiley:
Adapt the present macros if needed.