My Bridgeport conversion has this control.
Originally, turn the oblong black knob left or right to get clockwise and counterclockwise spindle rotation. The red button stopped a running program. The black button would pause/step a program.
I've wired these to my Mesa board so that:
- red button triggers hm2_7i96s.0.gpio.001.in_not
- black button triggers hm2_7i96s.0.gpio.002.in_not
- knob left triggers [HMOT](CARD0).inm.00.input-03.
- knob right triggers [HMOT](CARD0).inm.00.input-04
- knob center triggers nothing
Not sure why there are two pins from the Mesa giving the same value, but. . .
I was able to find some HAL file snippets to make this mostly work in Gmocappy. The knob controlled the spindle. And then you could stop it via the UI. I can pause and resume with the buttons or the UI at will (like, pause with the button, and resume with the UI). I never really understood how all this stuff worked, but it worked (mostly). What I want to do is build up the functionality iteratively, so that I understand what is going on. The first step is the spindle knob. Just looking at making it go forward.
I understand that a mux (multiplexer?) is required. A mux4 will output one of 4 values depending on the combination of two inputs. In my current setup, there is a halui.spindle.0.runs-forward tied to sel0 in the mux. I'm assuming spindle-manual-cw is tied to the halui.spindle.0.runs-forward somewhere in the bowels of GMOCAPPY. After extensive searching with HalShow, I've come up with:
- halui.spindle.0.runs-forward ==> spindle-forward-button
- spindle-manual-cw ==> halui.spindle.0.forward
- spindle.0.forward ==> spindle_cw
I don't see any connection from the spindle-manual-cw to the input of the mux.
But, it's working. Turn the knob and the spindle runs, and the correct button lights up in qtdragon_hd. Move the knob to center and it keeps running though. If I stop it via the UI, it will stop even if the knob is still set to run.
IN BOSS3.HAL
# --- SPINDLE-MANUAL-CCW ---
net spindle-manual-ccw <= [HMOT](CARD0).inm.00.input-03
# --- SPINDLE-MANUAL-CW ---
net spindle-manual-cw <= [HMOT](CARD0).inm.00.input-04
IN custom_postgui.hal
loadrt mux4 count=1
addf mux4.0 servo-thread
#stop
setp mux4.0.in0 5
#forward
setp mux4.0.in1 1
#reverse
setp mux4.0.in2 2
#fault reset
setp mux4.0.in3 7
net spindle_forward_button halui.spindle.0.runs-forward => mux4.0.sel0
net spindle_rev_button halui.spindle.0.runs-backward => mux4.0.sel1
net spindle_commanded_state mux4.0.out => mb2hal.spindle_set.target_state