Stop program from M-Code

More
8 years 4 months ago #112859 by ciccio85
Hello,

I'm trying to setup a simple Mcode which asks to the user if some actions were performed before continuing with the program. If the actions were performed the user clicks on Continue, whereas if the actions were not performed the user clicks on STOP and the program stops. Here is the simple Mcode.
Code:
(sleep 1 && wmctrl -F -a "Probe" -b add,above) & yad --title "Probe" --image=/home/ciccio/linuxcnc/configs/10060_4th/M-codes/qs.png --geometry="290x120" --text="<big>Hai fatto il probe? Hai posizionato il mandrino in un punto dove poter cambiare l'utensile?</big>" --button="STOP" --button="Continua" case $? in 0)sleep 2; halcmd setp halui.program.stop True ;; esac exit 0

The problems is that when I send the halcmd command I get an error: "can't do that emc_task_plan_run in auto mode with interpreter reading" and the program doesn't stop. Do you how to stop the program with halcmd?

Thank you

Francesco

Please Log in to join the conversation.

More
8 years 4 months ago #112907 by andypugh
Replied by andypugh on topic Stop program from M-Code
You could try halui.abort, though the docs say that they both do the same thing.

Please Log in to join the conversation.

More
8 years 4 months ago #112918 by ciccio85
Replied by ciccio85 on topic Stop program from M-Code
Hello,

I already tried halui.abort but I get the same error.

Francesco

Please Log in to join the conversation.

More
8 years 4 months ago #112921 by andypugh
Replied by andypugh on topic Stop program from M-Code
Do you get the same result if you connect a GUI (or physical) button to the stop / abort pins?

If you do then I think that means something is wrong.
Which version of LinuxCNC?

I just checked what Axis does
github.com/LinuxCNC/linuxcnc/blob/master...cripts/axis.py#L2287
And there seems to be no mode-switching there.

A workaround might be to switch your M-code to Python, though that definitely should not be necessary.

I will try to remember to check the behaviour in different versions and scenarios tonight. I feel that this might be a bug.

Please Log in to join the conversation.

More
8 years 4 months ago #112923 by ciccio85
Replied by ciccio85 on topic Stop program from M-Code
Hello,

thank you for your reply. I will check tonight to connect a GUI button to see if it works. The version I use is the 2.7.13

Francesco

Please Log in to join the conversation.

More
8 years 4 months ago #112926 by nkp
Replied by nkp on topic Stop program from M-Code
It works for me
Code:
(sleep 1 && wmctrl -F -a "Probe" -b add,above) & yad --title "Probe" --text="<big>Hai fatto il probe? Hai posizionato il mandrino in un punto dove poter cambiare l'utensile?</big>" --button="STOP" --button="Continua" case $? in 0)sleep 2; halcmd setp halui.program.stop False sleep 2; halcmd setp halui.program.stop True ;; esac


exit 0

Please Log in to join the conversation.

More
8 years 4 months ago #112927 by ciccio85
Replied by ciccio85 on topic Stop program from M-Code
OK,

so tonight I will try your modified script.

Thank you

Please Log in to join the conversation.

More
8 years 4 months ago #112936 by ciccio85
Replied by ciccio85 on topic Stop program from M-Code
Nothing, for me it does not work :(

I always have the same error, @andypugh using a normal GUI button works...very strange

Francesco

Please Log in to join the conversation.

More
8 years 4 months ago #112941 by andypugh
Replied by andypugh on topic Stop program from M-Code
I did some experiments.

I can get that error message by making the M101 file not executable.

The error message is unhelpful and wrong.

Please Log in to join the conversation.

More
8 years 4 months ago #112971 by ciccio85
Replied by ciccio85 on topic Stop program from M-Code
My M-code was always executable. The permissions are: -rwxr-xr-x

Which version of linuxcnc did you use?

Please Log in to join the conversation.

Time to create page: 0.224 seconds
Powered by Kunena Forum