klipper icon indicating copy to clipboard operation
klipper copied to clipboard

gcode_macro parameters not working

Open lufton opened this issue 8 years ago • 8 comments

I have gcode_macro section in my printer.cfg that uses parameter DELAY (from example-extras.cfg):

[gcode_macro MY_DELAY]
gcode:
	G4 P{DELAY}

Now I execute:

MY_DELAY DELAY=100

And get:

Recv: !! Error on "G4 P{DELAY}": unable to parse {

klippy.log

lufton avatar Sep 29 '18 18:09 lufton

I'll check, thanks for the feedback.

mcmatrix avatar Sep 30 '18 09:09 mcmatrix

From your log I see that your macro definition is

[gcode_macro MY_DELAY]
gcode = "G4 P{DELAY}"

Try to remove double quotes

[gcode_macro MY_DELAY]
gcode = G4 P{DELAY}

mcmatrix avatar Sep 30 '18 09:09 mcmatrix

I think I tried both and both is not working.

lufton avatar Sep 30 '18 10:09 lufton

Actually I tried:

gcode:
G4 P{DELAY}

lufton avatar Sep 30 '18 10:09 lufton

It seems that you don't have the latest code. Try to update your codebase.

cd ~/klipper
git pull
sudo service klipper restart

I get the same parsing error when I use gcode_macro.py before the macro improvement with parameters change.

mcmatrix avatar Sep 30 '18 11:09 mcmatrix

pi@octopi:~/klipper $ git pull
Already up-to-date.

lufton avatar Sep 30 '18 11:09 lufton

Check the size of gcode_macro.py. It has to be ~1307 bytes. What's the git log output

cd ~/klipper
git log -n 5

EDIT:

Try to update again

cd ~/klipper
git fetch
git checkout -f master
git pull
sudo service klipper restart

mcmatrix avatar Sep 30 '18 11:09 mcmatrix

Yeap, git reset --hard helped. Sorry. Closed.

lufton avatar Sep 30 '18 14:09 lufton