bigtreetech / KNOMI

158 stars 73 forks source link

Knomi 2 Macro G28 called recursively #63

Open rmilyard opened 4 months ago

rmilyard commented 4 months ago

When trying to home printer with sensorless-homing,cfg we are getting error: Macro G28 called recursively

What is going on? I believe I have newest firmware that was posted 2 months ago.

Biffes commented 4 months ago

Got this problem too. Maybe it is a collision between the sensorless.cfg and the knomi macro. Mainsail console logs about five g28 commands while the error happens.

Specker commented 4 months ago

I was able to solve this. If you have a [homing_override] in your printer.cfg you will have to change G28 in there with G28.1. Similar to mine: image There might be more similar recursive calls that you will have to look for.

Think of it like. old G28 gets renamed to G28.1, new G28 sets variable to true, then calls old G28 by it's new name G28.1, and after it finishes sets variable to false.

When you try homing from the UI it will execute G28 and by extension [homing_override]. Which most likely also calls G28 with parameters X, Y or Z.
So without changing those variables it will call itself over and over again.

Biffes commented 4 months ago

Thanks for the reply, Specker! I tested your solution and it worked! But i had to change the G28s in the sensorless.cfg too. I found another solution after looking for a fix to the bed mesh calibration for kamp here: https://github.com/bigtreetech/KNOMI/issues/25

I commented the Knomi G28 macro completly out

[gcode_macro G28]

rename_existing: G28.1

gcode:

SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True

G28.1 {rawparams}

SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False

and changed the macros in my sensorless.cfg like this:

{% if home_all or 'X' in params %} SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True _HOME_X SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False {% endif %}

{% if home_all or 'Y' in params %} SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True _HOME_Y SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False {% endif %}

{% if home_all or 'Z' in params %} SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=True G90 G0 X150 Y150 G28 Z G1 Z10 SET_GCODE_VARIABLE MACRO=_KNOMI_STATUS VARIABLE=homing VALUE=False

Worked perfectly and i dont have to mess around with modified G28s.