Skip to content

Commit

Permalink
vacuum OR coolant, but not both
Browse files Browse the repository at this point in the history
  • Loading branch information
travis-farmer committed Jun 5, 2021
1 parent 383a685 commit fb49d7c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 38 deletions.
33 changes: 0 additions & 33 deletions configs/my_LinuxCNC_machine/custom.hal
@@ -1,33 +0,0 @@
# Include your customized HAL commands here
# This file will not be overwritten when you run stepconf again
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600 -t 1 -S 21000
net spindle-vel-cmd-rpm-abs => vfd.speed-command
net spindle-cw spindle.0.forward => vfd.spindle-forward
net spindle-ccw spindle.0.reverse => vfd.spindle-reverse
net spindle-on spindle.0.on => vfd.spindle-on

#net spindle1-vel-cmd-rps <= spindle.1.speed-out-rps
#net spindle1-vel-cmd-rps-abs <= spindle.1.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-on <= spindle.0.on
net spindle-cw <= spindle.0.forward
net spindle-ccw <= spindle.0.reverse
net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
#net spindle1-vel-fb-rps => spindle.1.speed-in
#net spindle1-index-enable <=> spindle.1.index-enable



# external button to trigger touch off
# net run-touch-btn <= parport.1.pin-10-in => halui.mdi-command-04

#limits debounce to stop false triggers
# loadrt debounce cfg=1 #change to the number you want
# setp debounce.0.delay 100 #this sets the delay 100 iterations of the servo-thread
# addf debounce.0 servo-thread
# net deb-probe-in debounce.0.0.in <= parport.1.pin-11-in
# net probe-in debounce.0.0.out
# net probe-in => motion.probe-input
56 changes: 51 additions & 5 deletions configs/my_LinuxCNC_machine/my_LinuxCNC_machine.hal
Expand Up @@ -26,16 +26,46 @@ addf lowpass.spindle servo-thread
addf hm2_7i80.0.write servo-thread

# external output signals
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600 -t 1 -S 21000
net spindle-vel-cmd-rpm-abs => vfd.speed-command
net spindle-cw spindle.0.forward => vfd.spindle-forward
net spindle-ccw spindle.0.reverse => vfd.spindle-reverse
net spindle-on spindle.0.on => vfd.spindle-on

# --- for vacuum ---
setp hm2_7i80.0.gpio.005.invert_output true
setp hm2_7i80.0.gpio.005.is_output true
loadrt or2 count=2
addf or2.0 servo-thread

# --- spindle ---
#net spindle1-vel-cmd-rps <= spindle.1.speed-out-rps
#net spindle1-vel-cmd-rps-abs <= spindle.1.speed-out-rps-abs
net spindle-vel-cmd-rpm <= spindle.0.speed-out
net spindle-vel-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-on <= spindle.0.on

# these two with the or2.0 pins for the vacuum config below
net spindle-cw or2.0.in0 <= spindle.0.forward
net spindle-ccw or2.0.in1 <= spindle.0.reverse

net spindle-brake <= spindle.0.brake
net spindle-revs => spindle.0.revs
net spindle-at-speed => spindle.0.at-speed
#net spindle1-vel-fb-rps => spindle.1.speed-in
#net spindle1-index-enable <=> spindle.1.index-enable

# --- COOLANT-FLOOD ---
setp hm2_7i80.0.gpio.001.invert_output true
setp hm2_7i80.0.gpio.001.is_output true
net spindle-cw => hm2_7i80.0.gpio.001.out
net coolant-flood => hm2_7i80.0.gpio.001.out

# --- COOLANT-MIST ---
setp hm2_7i80.0.gpio.002.invert_output true
setp hm2_7i80.0.gpio.002.is_output true
net spindle-ccw => hm2_7i80.0.gpio.002.out
net coolant-mist => hm2_7i80.0.gpio.002.out



# --- MACHINE-IS-ENABLED ---
setp hm2_7i80.0.gpio.003.invert_output true
Expand Down Expand Up @@ -315,10 +345,26 @@ net machine-is-on halui.machine.is-on
net jog-speed halui.axis.jog-speed
net MDI-mode halui.mode.is-mdi

# ---coolant signals---
loadrt not count=1
loadrt and2 count=1
addf or2.1 servo-thread
addf not.0 servo-thread

net coolant-mist <= iocontrol.0.coolant-mist
net coolant-flood <= iocontrol.0.coolant-flood
# ---coolant signals---
# with or2.1 pins for vacuum config below
net coolant-mist or2.1.in0 <= iocontrol.0.coolant-mist
net coolant-flood or2.1.in1 <= iocontrol.0.coolant-flood

# --- Vacuum ---
# invert result of or2.1 so both mist and flood MUST be OFF to be TRUE
net either-coolant-on not.0.in <= or2.1.out
addf and2.0 servo-thread
# input signals from IF spindle-cw OR spindle-ccw into pin and2.0
net my_spindle_ison and2.0.in0 <= or2.0.out
# input signals from IF INVERTED coolant-mist OR coolant-flood into pin and2.0
net my_coolant_isoff and2.0.in1 <= not.0.out
# result of IF((spindle-cw OR spindle-ccw) AND NOT(coolant-mist OR coolant-flood))
net vac_sig_only hm2_7i80.0.gpio.005.out <= and2.0.out

# ---probe signal---

Expand Down

0 comments on commit fb49d7c

Please sign in to comment.