My printer.cfg includes 2 other files (in addition to some other) within which I have macros that call other macros. The files are:
options/probe/probe.cfg
sovol-macros.cfg
The macros in options/probe/probe.cfg successfully call other macros that are defined in the same file (like STOW_PROBE calling _ASSERT_HOMED)
The one in sovol-macros.cfg has a START_PRINT that calls macros such as QGL and MY_BED_MESH_CALIBRATE but they are never actually called/executed. The QUAD_GANTRY_LEVEV is never executed. As you can see in my macro, I have added bunch of debugging message!
Funny part is that I can run those macros from console or a G-CODE file but never from the START_PRINT! I have even added typos and non-existing macros to the bunch (such as EUCLID_PROBE_BEGIN_BATCH or G20008 X Y), but Klipper does not even complain about them and just runs through the code as if there is no tomorrow
Why am I seeing this contradicting behavior between these 2 files?
(Note: can the issue be related to the Important note in the docs? but then why other macros in the probe.cfg work? or why does Klipper completely ignoring my typos and non-existing commands?)
According to your log, your macros are throwing errors, and you are creating one error yourself with action_raise_error. This command will break the execution of all currently running macros and their calling macros.
I added action_raise_error as a debugging step to confirm the preceding commands were not actually executed.
Beside that, which macro is throwing error?
bed_mesh: Unknown profile [default]
Script running error
Traceback (most recent call last):
File "/home/biqu/klipper/klippy/extras/delayed_gcode.py", line 34, in _gcode_timer_event
self.gcode.run_script(self.timer_gcode.render())
File "/home/biqu/klipper/klippy/gcode.py", line 230, in run_script
self._process_commands(script.split('\n'), need_ack=False)
File "/home/biqu/klipper/klippy/gcode.py", line 212, in _process_commands
handler(gcmd)
File "/home/biqu/klipper/klippy/gcode.py", line 140, in <lambda>
func = lambda params: origfunc(self._get_extended_params(params))
File "/home/biqu/klipper/klippy/extras/bed_mesh.py", line 1757, in cmd_BED_MESH_PROFILE
options[key](name)
File "/home/biqu/klipper/klippy/extras/bed_mesh.py", line 1713, in load_profile
raise self.gcode.error(
gcode.CommandError: bed_mesh: Unknown profile [default]
You somewhere reference a non existing bed mesh. And there is:
Heat soaking the bed for 0 min
Done soaking the bed for 0 min
printer.quad_gantry_level.applied: false
Starting QGL 🥸
🥸 Beeping 🥸
🥸 Waiting P1000 🥸
Calling MY_QGL 🥸
🥸 Starting CALIBRATE_Z 🥸
🥸 DONE CALIBRATE_Z 🥸
Error evaluating 'gcode_macro START_PRINT:gcode': gcode.CommandError: 💥💥 QGL WAS NOT APPLIED
Traceback (most recent call last):
File "/home/biqu/klipper/klippy/extras/gcode_macro.py", line 61, in render
return str(self.template.render(context))
File "/home/biqu/klippy-env/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/biqu/klippy-env/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/home/biqu/klippy-env/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 118, in top-level template code
File "/home/biqu/klipper/klippy/extras/gcode_macro.py", line 89, in _action_raise_error
raise self.printer.command_error(msg)
gcode.CommandError: 💥💥 QGL WAS NOT APPLIED
Error evaluating 'gcode_macro START_PRINT:gcode': gcode.CommandError: 💥💥 QGL WAS NOT APPLIED
Nozzle not hot enough
Cancel Print Success!
Your macros actually run, but then you do action_raise_error which cancels all running macros.
In addition the Cancel Print Success! indicates that you somewhere call your CANCEL_PRINT macro.
thanks for your reply. I was using RESPOND or M118 prior to raising error, and I was still experiencing the issue: klipper would not call any macro within START_PRINT. For example the QGL macro would not be run and I will only see the debug messages before and after the call (QGL has its own debug messages too):
I simply used the raise_error to stop the printer from doing the other steps.
As I said in my post, Klipper would happily show me the debug messages from the following snippet without any complains about the G20008 command or non-existence STABLE_Z_HOME macro!, and then continue to start the print!
{action_respond_info("Homing X-Y Before STABLE_Z_HOME")}
G20008 X Y
RESPOND MSG="Homing STABLE_Z_HOME"
STABLE_Z_HOME
The code that you show is also not using RESPOND, so it’s useless for debugging execution order. If you want help, you need to set up your code in a way that makes sense and then share a log from executing it. In the state you’ve shown us, the results you get are what is expected.