Desactivate M120 on nested macro call
-
Is there a way to desactivate a M120 command when call a macro?
I use a macro wich call themself each time I need it(for manually levelling my bed with help of my capacitive probe). The problem is, if I agree to do it more then 5 or 6 time, I've got a "push stack overflow" wich I assume is usefull but not in my case. Here attached my macro "Bed Level"G0 Z10
; Point1 front left
G0 X-26 Y10 F10000
G30 S-1
M114
G0 Z10
; Point 2 front right
G0 X182 Y10 F10000
G30 S-1
M114
G0 Z10
; Point 3 rear right
G0 X182 Y217 F10000
G30 S-1
M114
G0 Z10
; Point 4 rear left
G0 X-26 Y217 F10000
G30 S-1
M114
G0 Z10
; Do it again?
M291 P"Recommencer?" S3
M98 P0:/macros/Levelling/Bed LevelIs there also possibility to stock the M114 result into variable wich I could display with a M117? (not really important as I could see it in gcodeconsole)
-
Hi,
Did you try adding a M121 before you call it again?
How many times do find you are repeating this?
On my machines I find that after third time there is little improvement.
Frederick
-
@fcwilt said in Desactivate M120 on nested macro call:
Did you try adding a M121 before you call it again?
I didn't. Does it reset the stack?
@fcwilt said in Desactivate M120 on nested macro call:
How many times do find you are repeating this?
3 times start to be correct, but within 5 or 6 times, I manage to be as 0.01 deviation
-
Well the M120 stores the state of the machine on the stack.
The M121 is the opposite, if you will, and restores the state of the machine and frees up the stack memory that the M120 used.
However I just tried it and it doesn't work. No error message but the macro is not called again.
How about putting multiple M291/M98 pairs in one macro and calling another.
That works and while it is not as elegant it solves the push/pop problem.
Frederick
-
I tried too. M121 just blocks the macro wherever it is.
@fcwilt said in Desactivate M120 on nested macro call:
How about putting multiple M291/M98 pairs in one macro and calling another.
I'll maybe do that (or one big with multiple cycle and M291) or if there is a GOTO like gcode but I don't think so.
Thx