Pause/Resume Button using one input

More
15 years 6 months ago #9518 by BigJohnT
Thanks to piasdoms constant searching I added to his example to not get out of sync if the button is pressed when not running or paused

A pause/resume button using halui and hal. The input can be either a pyvcp button or a physical button. In this example I used a pyvcp button.

xml

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

custom.hal

loadrt and2 count=2
loadrt or2 count=1
loadrt toggle count=1
loadrt toggle2nist count=1

addf and2.0 servo-thread
addf and2.1 servo-thread
addf or2.0 servo-thread
addf toggle.0 servo-thread
addf toggle2nist.0 servo-thread

postgui.hal
# External Program Pause/Resume Button
net pause-resume-btn and2.0.in0 and2.1.in0 <= pyvcp.pause-resume
net pause-on toggle2nist.0.is-on and2.0.in1 <= halui.program.is-paused
net run-on and2.1.in1 <= halui.program.is-running
net pause-sig or2.0.in0 <= and2.0.out
net resume-sig or2.0.in1 <= and2.1.out
net toggle-ok toggle.0.in <= or2.0.out
net togglesig toggle2nist.0.in <= toggle.0.out
net toggleon halui.program.pause <= toggle2nist.0.on
net toggleoff halui.program.resume <= toggle2nist.0.off

John

Please Log in to join the conversation.

  • piasdom
  • New Member
  • New Member
More
15 years 5 months ago #9929 by piasdom
Replied by piasdom on topic Re:Pause/Resume Button using one input
here's another example

custom.hal
loadrt toggle2nist count=3
addf toggle2nist.0 servo-thread

custom_postgui.hal
#pause/resume
net pausesig pyvcp.prog-pause toggle.4.in
net togglesig toggle.4.out toggle2nist.0.in
net toggleon toggle2nist.0.on => halui.program.pause
net toggleoff toggle2nist.0.off => halui.program.resume
#net pauseison halui.program.is-paused => toggle2nist.0.is-on

xml
<button> <!-- program pause -->
<halpin>"prog-pause"</halpin>
<text>"Pause/Resume"</text>
<font>('Helvetica 2',18)</font>
<fg>"midnightblue"</fg>
</button>

Kenneth

Please Log in to join the conversation.

  • piasdom
  • New Member
  • New Member
More
15 years 5 months ago #9932 by piasdom
Replied by piasdom on topic Re:Pause/Resume Button using one input
BigJohnT corrected me(Thanks), it WILL get out of sync if paused without
program running.

Please Log in to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum