How to right sequence run - pause -stop

More
28 Apr 2011 17:02 #9464 by BigJohnT
My guess is each time you press the pyvcp.prog-run button you get halui.program.stop every time when you only want that if your running. A bit more logic is needed.

Something like this might work

If button pressed and running then stop
If button pressed and not running then start

So your going to need a couple of and2's to get that done I suspect... so you would have to use toggle somehow to only get one press...

John

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

More
28 Apr 2011 17:22 #9465 by piasdom
cool...Thanks i got this close to right, but my logic sucks :)

net stop-prog and2.6.in0 == pyvcp.prog-run
net stop-prog and2.6.in1 == toggle.3.in
net run-stop toggle.3.out halui.program.run
net stop-run and2.6.out halui.program.stop

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

More
28 Apr 2011 18:45 #9466 by piasdom
when i click my on/off button slow, all is well.
if i click fast, the image changes but not the on/off start.
is this what debounce is for ?


net off-btn toggle.1.in == halui.machine.on pyvcp.mach-on halui.machine.off
net off-on toggle.1.out == pyvcp.selectimage

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

More
28 Apr 2011 23:02 #9481 by BigJohnT
I did get this to work for me as a pause/resume button

xml

<button>
<halpin>"pause-resume"</halpin>
<text>"Pause/Resume"</text>
</button>

custom.hal

loadrt and2 count=2
loadrt oneshot count=1

addf and2.0 servo-thread
addf and2.1 servo-thread
addf oneshot.0 servo-thread

setp oneshot.0.width 1

postgui.hal
net pause-resume-button oneshot.0.in <= pyvcp.pause-resume
net run-status and2.0.in0 <= halui.program.is-running
net one-shot-pr and2.0.in1 <= oneshot.0.out
net set-pause halui.program.pause <= and2.0.out

net pause-status and2.1.in0 <= halui.program.is-paused
net one-shot-pr => and2.1.in1
net set-run halui.program.resume <= and2.1.out


John

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

More
02 May 2011 10:55 #9533 by piasdom
i got this to work. couldn't get yours' to work on mine. emc opened, but wouldn't pause
or resume. and with my config., on the first click the machine hesitates a micro-second.
but after that - - pause/resume works great. would ya'll know why that is ?





net pause-resume toggle.2.in == halui.program.pause pyvcp.prog-pause
net resume-pause toggle.2.out halui.program.resume

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

More
03 May 2011 10:48 - 03 May 2011 11:19 #9552 by piasdom
been working with the below for about a day so far.i can't get both(run/stop) to work without
errors. something about can't do that while interpreter is idle or in auto mode. i moved each
part in every position and can't get this to work. both of these start a program, but each
give error when stopping about the interpreter. my logic is giving me a headache :)
how do i put the machine in auto mode to start the program and change to
manual(or whatever mode) to stop the program? i can get it auto to start but i get error
when trying to stop because i'm in auto. i tried putting auto mode in the first part and manual
in the second - it no like :) i tried with no mode and thought the toggle would switch from
run to stop. what does it toggle, the lights :) ?
Thanks




#net start-stop toggle.3.in == pyvcp.prog-run halui.program.run
#net stop-start toggle.3.out == halui.program.stop halui.mode.auto

net prog-start and2.5.in0 == halui.program.run
net prog-start and2.5.in1 == pyvcp.prog-run halui.mode.auto
net stop-start halui.program.stop == and2.5.out
Last edit: 03 May 2011 11:19 by piasdom.

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

More
03 May 2011 13:05 #9556 by piasdom
i can get this to work. i have to click at just the right speed though. the first click
works right. but i have to click(mouse) at just the right speed to get stop to
work. does this have to do with debounce? looked it up but just goes to
stuff like this
www.linuxcnc.org/docview/html/man/man9/debounce.9.html
and i can't get that to work. says 'debounce.1 not found'. i know debounce is
for digital, so i'm guessing that i have a digital mouse ....... ?


net start-stop toggle.3.in == pyvcp.prog-run halui.program.run halui.mode.auto
net stop-start halui.program.stop == toggle.3.out

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

More
03 May 2011 13:20 #9558 by BigJohnT
I think you will have to do like my pause/resume example to get this to work right.

Debounce is for mechanical inputs not a mouse input. The mouse click on the pyvcp button is a digital input and will not bounce.

You might want to revisit the pause/resume example and attempt to get that to work. You don't say why it didn't work for you...

John

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

More
03 May 2011 14:15 #9560 by piasdom
ok...i'll retry your example. i didn't say why it didn't work as i don't know why it didn't.
emc started ok but pause/resume didn't do anything.
thanks

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

More
03 May 2011 14:24 #9562 by BigJohnT
Did you add the functions to the servo-thread with addf? Not doing that is the usual cause when hal components load but do nothing.

John

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

Time to create page: 0.960 seconds
Powered by Kunena Forum