Category: HAL
I have this gamepad.hal as an example for my problem.
This is used with the button of a gamepad.I start a program by a button, then I can pause/resume it by another button.The third button is to stop the program.
The problem I have: If the program is started and I press pause/resume and stop at the same time, sometimes the toggle2nist_on get stucked in on state and the pause/resume will not work until I quit linuxcnc and start again. Is this a known behavior, or is something wrong in my gamepad.hal
# test for linuxcnc 2.9 2025-09-28 work
# generic china Gamepad
loadusr -W hal_input -KRAL USB Gamepad
#---------------------
# Program Stop
#---------------------
#halui.program.stop (bit, in) - pin for stopping a program
net button13 input.0.btn-base5 => halui.program.stop
#---------------------
#---------------------
# Program Start
#---------------------
net button16 input.0.btn-base4 => halui.program.run
#---------------------
#---------------------
# Program Pause on/ Pause off
#---------------------
# known bugs: if you stop while in pause, than swich on and start program again, pause will not work.
# sometimes tog2nist_1.on stays on !
loadrt toggle names=tog_1
addf tog_1 servo-thread 1
loadrt toggle2nist names=tog2nist_1
addf tog2nist_1 servo-thread 2
net net-button-pause-trigger input.0.btn-base6 => tog_1.in # this is the pause button
net net-button-pause tog2nist_1.in <= tog_1.out
net net-pause-is-on tog2nist_1.is-on <= halui.program.is-paused
net net-pause-off tog2nist_1.off => halui.program.resume
net net-pause-on tog2nist_1.on => halui.program.pause
#---------------------