Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
petmakris committed Jan 27, 2024
1 parent c9e4853 commit 3d4be1e
Show file tree
Hide file tree
Showing 24 changed files with 86 additions and 91 deletions.
20 changes: 3 additions & 17 deletions config/hal/0-base.hal → config/hal/01-modules.hal
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,18 @@ loadusr -W hal_manualtoolchange
loadrt [KINS](KINEMATICS)
loadrt [EMCMOT](EMCMOT) servo_period_nsec=[EMCMOT](SERVO_PERIOD) num_joints=[KINS](JOINTS)
loadrt pid names=pid.x,pid.y,pid.z debug=1
loadrt hostmot2
loadrt [HM2](DRIVER) board_ip=[HM2](IPADDRESS) config="sserial_port_0=20000000"

setp hm2_7i97.0.dpll.01.timer-us -50
setp hm2_7i97.0.watchdog.timeout_ns 5000000

addf hm2_7i97.0.read servo-thread
addf motion-command-handler servo-thread
addf motion-controller servo-thread
addf pid.x.do-pid-calcs servo-thread
addf pid.y.do-pid-calcs servo-thread
addf pid.z.do-pid-calcs servo-thread
addf hm2_7i97.0.write servo-thread

loadrt odometer names=lube.odometer
loadrt estop_latch names=estop.latch

loadrt and2 names=tool-change.and
loadrt or2 names=lube.or,buttons.or.resume,buttons.or.pause,buttons.or.run,buttons.or.stop,spindle.on.or,spindle.off.or
loadrt not names=estop.not.0,estop.not.1,tool-change.not

loadrt lowpass names=feed-pot.lowpass
loadrt ilowpass names=jog.lowpass.x,jog.lowpass.y,jog.lowpass.z
loadrt scale names=jog.scale.x,jog.scale.y,jog.scale.z,feed-pot.scale,spindle-pot.scale,jog-pot.scale

loadrt encoder names=spindle.encoder
loadrt near names=spindle.near

loadrt conv_float_s32 names=feed-pot.conv

addf motion-command-handler servo-thread
addf motion-controller servo-thread
8 changes: 8 additions & 0 deletions config/hal/02-7i97.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
loadrt [HM2](DRIVER) board_ip=[HM2](IPADDRESS) config="sserial_port_0=20000000"
loadrt hostmot2

setp hm2_7i97.0.dpll.01.timer-us -50
setp hm2_7i97.0.watchdog.timeout_ns 5000000

addf hm2_7i97.0.read servo-thread
addf hm2_7i97.0.write servo-thread
18 changes: 5 additions & 13 deletions config/hal/11-sserial.hal → config/hal/03-7i84.hal
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
# inputs 0 -> 31

net buttons.set-x-zero <= hm2_7i97.0.7i84.0.0.input-05 => halui.mdi-command-05
net buttons.stop <= hm2_7i97.0.7i84.0.0.input-06
net buttons.run <= hm2_7i97.0.7i84.0.0.input-07
net buttons.rpm-is-set <= hm2_7i97.0.7i84.0.0.input-09

net buttons.set-spindle-off <= hm2_7i97.0.7i84.0.0.input-10
net buttons.set-spindle-on <= hm2_7i97.0.7i84.0.0.input-11

net buttons.tool-change <= hm2_7i97.0.7i84.0.0.input-12
net buttons.tool-change-completed <= hm2_7i97.0.7i84.0.0.input-13

net buttons.force-lubricator <= hm2_7i97.0.7i84.0.0.input-16

net buttons.set-x-zero <= hm2_7i97.0.7i84.0.0.input-05 => halui.mdi-command-05
net buttons.set-z-zero <= hm2_7i97.0.7i84.0.0.input-17 => halui.mdi-command-07

net buttons.program-step <= hm2_7i97.0.7i84.0.0.input-19 => halui.program.step
net buttons.home-all <= hm2_7i97.0.7i84.0.0.input-20 => halui.home-all

net buttons.set-y-zero <= hm2_7i97.0.7i84.0.0.input-21 => halui.mdi-command-06

net buttons.resume <= hm2_7i97.0.7i84.0.0.input-23
net buttons.pause <= hm2_7i97.0.7i84.0.0.input-22
net buttons.run <= hm2_7i97.0.7i84.0.0.input-07
net buttons.stop <= hm2_7i97.0.7i84.0.0.input-06
net buttons.program-step <= hm2_7i97.0.7i84.0.0.input-19 => halui.program.step

net buttons.resume <= hm2_7i97.0.7i84.0.0.input-23

# outputs 0->15 (0->5 are red, 6->11 are green)

Expand Down
1 change: 0 additions & 1 deletion config/hal/4-estop.hal → config/hal/04-estop.hal
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ net estop.internal-estop-not => estop.not.1.in
net estop.internal-estop <= estop.not.1.out

net maho-inputs.power-on => iocontrol.0.emc-enable-in
net maho-inputs.power-on => hm2_7i97.0.ssr.00.out-00
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LINUXCNC INPUTS - 19X7 / MAHO OUTPUTS
# LINUXCNC INPUTS - 19X7 / MAHO OUTPUTS (00 to 15)

net maho-outputs.handwheel-x <= hm2_7i97.0.inmux.00.input-03
net maho-outputs.handwheel-z <= hm2_7i97.0.inmux.00.input-04
Expand Down
2 changes: 2 additions & 0 deletions config/hal/1-axis-x.hal → config/hal/07-axis-x.hal
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
addf pid.x.do-pid-calcs servo-thread

setp pid.x.Pgain [JOINT_0](P)
setp pid.x.Igain [JOINT_0](I)
setp pid.x.Dgain [JOINT_0](D)
Expand Down
2 changes: 2 additions & 0 deletions config/hal/1-axis-y.hal → config/hal/07-axis-y.hal
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
addf pid.y.do-pid-calcs servo-thread

setp pid.y.Pgain [JOINT_1](P)
setp pid.y.Igain [JOINT_1](I)
setp pid.y.Dgain [JOINT_1](D)
Expand Down
2 changes: 2 additions & 0 deletions config/hal/1-axis-z.hal → config/hal/07-axis-z.hal
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
addf pid.z.do-pid-calcs servo-thread

setp pid.z.Pgain [JOINT_2](P)
setp pid.z.Igain [JOINT_2](I)
setp pid.z.Dgain [JOINT_2](D)
Expand Down
File renamed without changes.
27 changes: 27 additions & 0 deletions config/hal/09-tool-change.hal
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
addf tool-change.not servo-thread
addf tool-change.and servo-thread

net buttons.tool-change-completed => hal_manualtoolchange.change_button

net tool-change.tool-change <= iocontrol.0.tool-change => hal_manualtoolchange.change

net tool-change.tool-changed <= hal_manualtoolchange.changed => iocontrol.0.tool-changed
net tool-change.tool-number <= iocontrol.0.tool-prep-number => hal_manualtoolchange.number
net tool-change.tool-prepare-loop <= iocontrol.0.tool-prepare => iocontrol.0.tool-prepared

# This should prevent a tool change while the spindle is running
# Maybe I should prevent a tool change while the program is running
# (In need to monitor the status of the hal variables, is-running, is-paused etc)

net spindle.is-on <= spindle.0.on
net spindle.is-on => tool-change.not.in
net spindle.is-on => whb.halui.spindle.is-on

net spindle.is-off <= tool-change.not.out
net spindle.is-off => tool-change.and.in0

net buttons.tool-change => tool-change.and.in1

net maho-inputs.tool-release <= tool-change.and.out
net maho-inputs.tool-release => spindle.0.inhibit
net maho-inputs.tool-release => motion.feed-inhibit
File renamed without changes.
File renamed without changes.
27 changes: 14 additions & 13 deletions config/hal/13-spindle.hal → config/hal/20-spindle.hal
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
addf spindle.on.or servo-thread
addf spindle.off.or servo-thread

# addf spindle.encoder.update-counters base-thread
# addf spindle.encoder.capture-position servo-thread
# setp spindle.encoder.position-scale 4
addf spindle.encoder.update-counters base-thread
addf spindle.encoder.capture-position servo-thread
setp spindle.encoder.position-scale 4

# addf spindle.near servo-thread
# setp spindle.counter-mode true
# setp spindle.near.scale 1.02
addf spindle.near servo-thread
setp spindle.counter-mode true
setp spindle.near.scale 1.03

net maho-inputs.spindle-cw <= spindle.0.reverse
net maho-inputs.spindle-ccw <= spindle.0.forward

# net spindle.position <= encoder.0.position => spindle.0.revs
net spindle.position <= spindle.encoder.position => spindle.0.revs

# net spindle.velocity <= encoder.0.velocity => spindle.0.speed-in
# net spindle.velocity => near.0.in2
net spindle.velocity <= spindle.encoder.velocity
net spindle.velocity => spindle.0.speed-in
net spindle.velocity => spindle.near.in2

# net spindle.phase-a <= hm2_7i97.0.inmux.00.input-12 => encoder.0.phase-A
# net spindle.commanded-speed <= spindle.0.speed-out-rps-abs => near.0.in1
# net spindle.at-speed <= near.0.out => spindle.0.at-speed
net spindle.phase-a <= hm2_7i97.0.inmux.00.input-12 => spindle.encoder.phase-A
net spindle.commanded-speed <= spindle.0.speed-out-rps-abs => spindle.near.in1
net spindle.at-speed <= spindle.near.out => spindle.0.at-speed

net spindle-on => whb.halui.spindle.is-on
net spindle.is-on => whb.halui.spindle.is-on

net buttons.set-spindle-on => spindle.on.or.in0
net pendant.spindle.on <= whb.halui.spindle.start => spindle.on.or.in1
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 0 additions & 24 deletions config/hal/9-tool-change.hal

This file was deleted.

44 changes: 22 additions & 22 deletions config/maho.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,28 +40,28 @@ SUBROUTINE_PATH = /home/pmakris/linuxcnc/subroutines

[HAL]
HALUI = halui
HALFILE = hal/0-base.hal
HALFILE = hal/1-axis-x.hal
HALFILE = hal/1-axis-y.hal
HALFILE = hal/1-axis-z.hal
HALFILE = hal/2-maho-outputs.hal
HALFILE = hal/3-maho-inputs.hal
HALFILE = hal/4-estop.hal
HALFILE = hal/5-limits.hal
HALFILE = hal/7-lube.hal
HALFILE = hal/9-tool-change.hal
HALFILE = hal/10-coolant.hal
HALFILE = hal/11-sserial.hal
HALFILE = hal/12-panel-feed-override.hal
HALFILE = hal/12-panel-jog-speed.hal
HALFILE = hal/12-panel-spindle-speeed.hal
HALFILE = hal/13-spindle.hal
HALFILE = hal/20-xhc-whb04b-6.hal
HALFILE = hal/21-xhc-whb04b-6-axis-x.hal
HALFILE = hal/22-xhc-whb04b-6-axis-y.hal
HALFILE = hal/23-xhc-whb04b-6-axis-z.hal
HALFILE = hal/24-xhc-whb04b-6-mdi.hal

HALFILE = hal/01-modules.hal
HALFILE = hal/02-7i97.hal
HALFILE = hal/03-7i84.hal
HALFILE = hal/04-estop.hal
HALFILE = hal/05-maho-inputs.hal
HALFILE = hal/05-maho-outputs.hal
HALFILE = hal/07-axis-x.hal
HALFILE = hal/07-axis-y.hal
HALFILE = hal/07-axis-z.hal
HALFILE = hal/08-limits.hal
HALFILE = hal/09-tool-change.hal
HALFILE = hal/16-coolant.hal
HALFILE = hal/19-lube.hal
HALFILE = hal/20-spindle.hal
HALFILE = hal/30-panel-feed-override.hal
HALFILE = hal/30-panel-jog-speed.hal
HALFILE = hal/30-panel-spindle-speed.hal
HALFILE = hal/50-xhc-whb04b-6.hal
HALFILE = hal/51-xhc-whb04b-6-axis-x.hal
HALFILE = hal/52-xhc-whb04b-6-axis-y.hal
HALFILE = hal/53-xhc-whb04b-6-axis-z.hal
HALFILE = hal/54-xhc-whb04b-6-mdi.hal

POSTGUI_HALFILE = panel.hal

Expand Down

0 comments on commit 3d4be1e

Please sign in to comment.