Run/Step Hold/Resume Buttons

More
05 Aug 2020 15:31 #177394 by harindugamlath
Thanks BigJohnT

This code works like a charm. I'm using Probe basic and it updates the gui too which is nice. But I would like to add some info so this might be helpful to someone.

In the original code the following lines should be changed according to your physical buttons. I mean Normally Open or Closed.

For the feed hold button,

net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i20.0.gpio.027.in_not (this is your input)

For the cycle start button,

net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i20.0.gpio.026.in_not (this is your input)

as we can see mesa card input has been inverted in both. This almost crashed my machine (partly my error when testing the G-code with a bad preset z height)

in Short if you have Normally closed switches (if your input stays true and goes false when you press) use the inverted pin.
if you have normally open switches(if your input stays false and goes true when you press) use the mesa pin without inverting.



what happened was original feed hold button on my machine was a normally closed one and the cycle start was normally open. Real fun part started when I try to hit the stop button on the gui as I saw I was having a wrong Z height. It just went back to normal cycle run. Pressing the Stop button again and again didn't help it just went in to normal cycle and Estop saved the day. Hope this helps someone else to be a bit less stupid than me.

What I ended up with - for feed hold (NC switch)
net pause-resume-btn and2.0.in0 and2.1.in0 <= hm2_5i25.0.7i76.0.0.input-31-not

for cycle start (No switch)
net run-step-btn and2.2.in0 and2.3.in0 <= hm2_5i25.0.7i76.0.0.input-30

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

More
23 Sep 2020 08:30 #183431 by raychar
i encounter the same problem as what Jensor said about BigJohnT program, it works only for the Pause/Resume button but never on Run/Step one. If I deleted either one, the remained one in the program runs, of course this is not the solution.

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

More
23 Sep 2020 09:40 #183438 by rodw
Replied by rodw on topic Run/Step Hold/Resume Buttons
This code has worked perfectly for me for a number of years. If you are going to use some advanced hal stuff, you need to take responsibility for your machine. I always start by reviewing signals to make sure they are doing what I want them to do before building out the feature. If you use NC switches where NO switches are expected it on you to get it right.

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

More
01 Dec 2020 03:06 #190738 by Benb
Replied by Benb on topic Run/Step Hold/Resume Buttons
Raychar,

If I understand your problem, Hold/resume PB works, but run/step does not. However, if you delete or comment-out Hold/resume HAL net part of the configuration, the run/step part works. This tells me that your HAL configuration suffers from an order of execution of HAL components.

To solve this problem, I would draw function blocks of your hall configuration and decide which components should execute first.
You can set the order by adding a number at the end of each addf.

For more information how linuxcnc set the order of execution of the hall component.
linuxcnc.org/docs/2.7/html/man/man3/hal_..._to_thread.3hal.html

halui expects the signals to be debounced.
linuxcnc.org/docs/2.7/html/man/man1/halui.1.html

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

More
01 Dec 2020 18:03 #190783 by chris@cnc
Hi,
i have also one simple two button example.
One cycle start and one cycle pause.
was not easy to diff between start, idle and resume. But now it works...

addf and2.1 servo-thread
addf and2.2 servo-thread

net cycle-start hm2_7i76e.0.7i84.0.1.input-11

net cycle-pause halui.program.pause hm2_7i76e.0.7i84.0.1.input-12-not

net cycle-idle halui.program.is-idle
net cycle-ist-pause halui.program.is-paused

net cycle-start => and2.1.in0
net cycle-idle => and2.1.in1

net cycle-start => and2.2.in0
net cycle-ist-pause => and2.2.in1

net start halui.program.run and2.1.out
net weiter halui.program.resume and2.2.out
The following user(s) said Thank You: tommylight, Sadmeatball

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

More
13 Dec 2020 18:19 #191880 by The Feral Engineer
I do all of my HAL stuff in a sim before I copy/pasta to my real machine files
The following user(s) said Thank You: tommylight, Sadmeatball

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

More
13 Dec 2020 18:27 #191883 by tommylight

I do all of my HAL stuff in a sim before I copy/pasta to my real machine files

Pasta on a machine ?
I am hungry ! :)

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

More
14 Dec 2020 03:23 #191939 by The Feral Engineer
It was supposed to be a reply to rodw :)

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

More
14 Dec 2020 04:34 #191940 by rodw
Replied by rodw on topic Run/Step Hold/Resume Buttons

It was supposed to be a reply to rodw :)


Man, I'm not even Italian!

I would think its hard to build out in a sim when you need to interact with real hardware.

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

Time to create page: 0.086 seconds
Powered by Kunena Forum