Skip to content

Commit 473ffd8

Browse files
committed
globals: More config error detection
1 parent 52fa6cc commit 473ffd8

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ section.
8989
> macros can cause all sorts of weird and frustrating problems.
9090
9191
> **Note:** If you have a `[homing_override]` section you will need to update
92-
> any `G28` commands in that section to use to `G28.6245197` instead (which is
92+
> any `G28` commands in the gcode part to use `G28.6245197` instead (which is
9393
> the renamed version of Klipper's built-in `G28`). Failure to do this will
9494
> cause `G28` commands to error out with the message ***Macro G28 called
9595
> recursively***.
@@ -602,6 +602,12 @@ arguments.
602602

603603
* `O` - Omits axes from the homing procedure if they are already homed.
604604

605+
> **Note:** If you have a `[homing_override]` section you will need to update
606+
> any `G28` commands in the gcode part to use `G28.6245197` instead (which is
607+
> the renamed version of Klipper's built-in `G28`). Failure to do this will
608+
> cause `G28` commands to error out with the message ***Macro G28 called
609+
> recursively***.
610+
605611
### Layer Triggers
606612

607613
Provides the capability to run user-specified g-code commands at arbitrary layer

globals.cfg

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,11 @@ gcode:
106106
{% endif %}
107107
{% endfor %}
108108
{% if output %}
109-
{ action_emergency_stop(
109+
{ action_emergency_stop((
110110
"required printer.cfg section(s) missing:\n"
111111
~ output | join("\n")) ~
112-
"See readme: https://github.com/jschuh/" }
112+
"See readme: https://github.com/jschuh/klipper-macros\x23klipper-setup")
113+
}
113114
{% endif %}
114115

115116
# Bed leveling behavior is based on config options.
@@ -158,6 +159,18 @@ gcode:
158159
{action_raise_error("%s is not a valid type for _KM_OPTIONS."|format(k))}
159160
{% endif %}
160161
{% endfor %}
162+
163+
{% if "homing_override" in printer.configfile.config %}
164+
{% for l in printer.configfile.config.homing_override.gcode.split("\n") %}
165+
{% if " g28 " in (" " ~ l.split("\x23")[0].split(";")[0]|lower ~ " ") %}
166+
{ action_raise_error(
167+
"G28 in [homing_override] gcode. Replace with G28.6245197 to "
168+
"fix recursive macro call.\n"
169+
"See readme: https://github.com/jschuh/klipper-macros\x23g28") }
170+
{% endif %}
171+
{% endfor %}
172+
{% endif %}
173+
161174
M400
162175

163176
[delayed_gcode INIT_GLOBALS]

0 commit comments

Comments
 (0)