How to use Dealing with queue-buster when remapping code?

More
4 years 11 months ago #225643 by chen1234
Because the remapping code cannot be executed in order, I added yield INTERP_EXECUTE_FINISH, but a new problem appeared. If the remapping code cannot complete the function, the interpreter will execute the next line of G code.
The function of my remapping code is: passing parameters to the executable program (.cpp), the executable program to control the galvanometer. The current situation is that when the galvanometer work has not been completed, cnc will execute the next line of g code, and cannot wait for the completion of the remapping code. Someone told me before that I need to use INTERP_EXECUTE_FINISH, but I feel very confused because the yield INTERP_EXECUTE_FINISH cannot return normally. So what should I do? Is it to return a special code to INTERP_EXECUTE_FINISH? Or let the remapping code get the return value of the executable program?
Hope someone can help me, thanks in advance, here is my code:
 

Attachment not found

 

Attachment not found

Please Log in to join the conversation.

More
4 years 11 months ago #225651 by andypugh
I don't have that much experience with this, but you could try having the Python code toggle a G-code input pin after the INTERP_EXECUTE_FINISH and then have an M66 wait-on-input in the G-code. M66 forces an interp synch too, so at that point it should all agree.

Please Log in to join the conversation.

More
4 years 11 months ago #225691 by cmorley
If you use yeild INTERP_EXECUTE_FINISH, you cannot use return with an argument in the function. (look up python generators to find out why)

yeild INTERP_EXECUTE_FINISH, means wait for the interpreter to finish the commands before it before continuing the rest of the commands. ( a synch)

I think there should be:
yield INTERP_OK where you return is

and yield INTERP_ERROR if there is an error

Try that and report your results.


.

Please Log in to join the conversation.

More
3 years 6 months ago #268973 by zz912
chen1234 - did you solved your problem?

What version LCNC do you use?

I am solving similar problem:
forum.linuxcnc.org/38-general-linuxcnc-q...nterp-execute-finish

I use LCNC 2.9

Please Log in to join the conversation.

Time to create page: 0.176 seconds
Powered by Kunena Forum