Stop program from M-Code

More
28 Jun 2018 19:48 #113015 by dgarrett
Replied by dgarrett on topic Stop program from M-Code
The error message reported:

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"


indicates that an attempt to issue a RUN command (emc_task_plan_run)
was made which is consistent with using halui.program.run instead of
halui.program.stop.

Also, as mentioned, the code posted at message
forum.linuxcnc.org/10-advanced-configura...code?start=10#113013
...
case $? in
    0)sleep 3; halcmd setp halui.program.stop True

     sleep 6;
    ;;
esac
...
does not ensure that halui.program.stop is returned to
the unasserted (False) state (but it should using an appropriate
sleep delay).

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

More
28 Jun 2018 20:05 #113019 by andypugh
Replied by andypugh on topic Stop program from M-Code

My USER M CODE path is should be ok. My M codes are in that folder and they work. If it really is wrong please tell me why. Maybe is this the problem.


You git has

USER_M_PATH = /home/ciccio/linuxcnc/configs/3040t_no-endstops/M-codes

But there did not seem to be a _no_endstops in the actual path.
But looking again, I think that depends on where you install the config.

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

More
28 Jun 2018 20:06 #113020 by andypugh
Replied by andypugh on topic Stop program from M-Code

does not ensure that halui.program.stop is returned to
the unasserted (False) state (but it should using an appropriate
sleep delay).


Would it be better to poll for interp_idle ? (or a similar state)

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

More
28 Jun 2018 20:07 #113021 by ciccio85
Replied by ciccio85 on topic Stop program from M-Code
OK, so maybe I have to use the timedelay component. Right? So, do you have an idea of how to properly write the M-code?

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

More
28 Jun 2018 20:16 #113023 by dgarrett
Replied by dgarrett on topic Stop program from M-Code
The method already posted at message
forum.linuxcnc.org/10-advanced-configura...?limitstart=0#112926
...
case $? in
    0)sleep 2; halcmd setp halui.program.stop False

    sleep 2; halcmd setp halui.program.stop True
    ;;
esac
...
will probably work

but just pulsing halui.program.stop is a little more straightforward and ensures that
halui.program.stop is returned to the deasserted (False) state:
...
case $? in
    0)halcmd setp halui.program.stop True
      sleep 2
      halcmd setp halui.program.stop False
    ;;
esac
The following user(s) said Thank You: ciccio85

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

More
28 Jun 2018 20:17 #113024 by andypugh
Replied by andypugh on topic Stop program from M-Code
I think that you can do the time delay in the M-code, but it might be more reliable to to use the oneshot component:

linuxcnc.org/docs/2.7/html/man/man9/oneshot.9.html

Then you can net the oneshot output to program-stop. This means that you can toggle the oneshot input off-then-on in your M-code but program-stop only sees a brief pulse that resets.
#!/bin/sh
halcmd setp oneshot.0.in False
(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 oneshot.0.in True
    ;;
esac
exit 0

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

More
28 Jun 2018 20:19 #113025 by andypugh
Replied by andypugh on topic Stop program from M-Code

Tbut just pulsing halui.program.stop is a little more straightforward and ensures that
halui.program.stop is returned to the deasserted (False) state:
...
case $? in
    0)halcmd setp halui.program.stop True
      sleep 2
      halcmd setp halui.program.stop False
    ;;
esac


The only drawback there is that the dialog box hangs around on screen for 2 seconds after you press the stop button.
The following user(s) said Thank You: ciccio85

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

More
28 Jun 2018 20:31 #113027 by ciccio85
Replied by ciccio85 on topic Stop program from M-Code
That worked!! Thank you!!

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

Time to create page: 0.083 seconds
Powered by Kunena Forum