Wating for return of custom M-code

More
17 Feb 2022 09:19 #235108 by Bocnc
Hi,

I am struggeling with the behaviour of a custom M-code.
In short: I wrote a custom M-code which I need for a toolchange script (Remapped M6 to toolchange.ngc).
Within my toolchange.ngc I call the custom M-code (M130).
However, linuxcnc will not wait for the M-code to finish but immediately proceed with the subsequent code.

Example:

toolchange.ngc
o<toolchange> sub

M130 P4
(debug, OUTPUT should be visible after M130 finished)
o<toolchange> endsub

M130
#!/bin/bash
test=$1
while [ $test -gt 0] do
 sleep 1
 test=(($test - 1))
done
exit 0

The debug output gets printed immediately (and any following code). If I run the M script in a terminal while linuxcnc is running, the M file returns after X seconds.
Furthermore I can see that the run state of linuxcnc is active for X seconds but the toolchange.ngc does not wait for the M130 to return. Any ideas?

Please Log in or Create an account to join the conversation.

More
17 Feb 2022 11:07 #235116 by Bocnc
Just found the solution. The problem is, that the debug output gets printed immediately. However, if any motion comands are placed after the M-code, they get correctly executed after the M-Code finished.

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum