executing subroutines even during import of GCODE file

More
12 Apr 2025 17:56 #326183 by filipkochan
Hello.
In my program, I use a custom subroutine where I wait for some input value to turn 1 and then continue. When I import the g code (with this function), LinuxCNC hangs and I have to kill it from terminal. Even with a simple function

o<myfunc> sub
#1 = 0
o150 while [#1 le 0]
o150 endwhile
o<myfunc> endsub
M2


and a minimal program

o<myfunc> call
M2


the import of the program hangs. As soon as I change "[#1 le 0]" to "[#1 lt 0]", it imports correctly. So my question is: does LinuxCNC execute all the subroutines even during importing of program? And since the change of value I am waiting for will never occur during import of program, what could I do? How to prevent linuxcnc from infinitely waiting in the while cycle?

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

More
12 Apr 2025 18:11 - 12 Apr 2025 18:12 #326185 by Aciera
You can use the 'task' parameter like this:
o100 if [#<_task> EQ 1]
;everything in here is only executed during actual gcode execution
o100 endif
Last edit: 12 Apr 2025 18:12 by Aciera.
The following user(s) said Thank You: filipkochan

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

Time to create page: 0.083 seconds
Powered by Kunena Forum