From 3d4be1ea3bd1c479672ca555fc9d208d522d3a08 Mon Sep 17 00:00:00 2001 From: Petros Makris Date: Sun, 28 Jan 2024 00:07:35 +0200 Subject: [PATCH] updates --- config/hal/{0-base.hal => 01-modules.hal} | 20 ++------- config/hal/02-7i97.hal | 8 ++++ config/hal/{11-sserial.hal => 03-7i84.hal} | 18 +++----- config/hal/{4-estop.hal => 04-estop.hal} | 1 - .../{3-maho-inputs.hal => 05-maho-inputs.hal} | 0 ...2-maho-outputs.hal => 05-maho-outputs.hal} | 2 +- config/hal/{1-axis-x.hal => 07-axis-x.hal} | 2 + config/hal/{1-axis-y.hal => 07-axis-y.hal} | 2 + config/hal/{1-axis-z.hal => 07-axis-z.hal} | 2 + config/hal/{5-limits.hal => 08-limits.hal} | 0 config/hal/09-tool-change.hal | 27 ++++++++++++ config/hal/{10-coolant.hal => 16-coolant.hal} | 0 config/hal/{7-lube.hal => 19-lube.hal} | 0 config/hal/{13-spindle.hal => 20-spindle.hal} | 27 ++++++------ ...verride.hal => 30-panel-feed-override.hal} | 0 ...l-jog-speed.hal => 30-panel-jog-speed.hal} | 0 ...e-speed.hal => 30-panel-spindle-speed.hal} | 0 ...0-xhc-whb04b-6.hal => 50-xhc-whb04b-6.hal} | 0 ...-axis-x.hal => 51-xhc-whb04b-6-axis-x.hal} | 0 ...-axis-y.hal => 52-xhc-whb04b-6-axis-y.hal} | 0 ...-axis-z.hal => 53-xhc-whb04b-6-axis-z.hal} | 0 ...b04b-6-mdi.hal => 54-xhc-whb04b-6-mdi.hal} | 0 config/hal/9-tool-change.hal | 24 ---------- config/maho.ini | 44 +++++++++---------- 24 files changed, 86 insertions(+), 91 deletions(-) rename config/hal/{0-base.hal => 01-modules.hal} (73%) create mode 100644 config/hal/02-7i97.hal rename config/hal/{11-sserial.hal => 03-7i84.hal} (99%) rename config/hal/{4-estop.hal => 04-estop.hal} (90%) rename config/hal/{3-maho-inputs.hal => 05-maho-inputs.hal} (100%) rename config/hal/{2-maho-outputs.hal => 05-maho-outputs.hal} (93%) rename config/hal/{1-axis-x.hal => 07-axis-x.hal} (96%) rename config/hal/{1-axis-y.hal => 07-axis-y.hal} (96%) rename config/hal/{1-axis-z.hal => 07-axis-z.hal} (96%) rename config/hal/{5-limits.hal => 08-limits.hal} (100%) create mode 100644 config/hal/09-tool-change.hal rename config/hal/{10-coolant.hal => 16-coolant.hal} (100%) rename config/hal/{7-lube.hal => 19-lube.hal} (100%) rename config/hal/{13-spindle.hal => 20-spindle.hal} (65%) rename config/hal/{12-panel-feed-override.hal => 30-panel-feed-override.hal} (100%) rename config/hal/{12-panel-jog-speed.hal => 30-panel-jog-speed.hal} (100%) rename config/hal/{12-panel-spindle-speed.hal => 30-panel-spindle-speed.hal} (100%) rename config/hal/{20-xhc-whb04b-6.hal => 50-xhc-whb04b-6.hal} (100%) rename config/hal/{21-xhc-whb04b-6-axis-x.hal => 51-xhc-whb04b-6-axis-x.hal} (100%) rename config/hal/{22-xhc-whb04b-6-axis-y.hal => 52-xhc-whb04b-6-axis-y.hal} (100%) rename config/hal/{23-xhc-whb04b-6-axis-z.hal => 53-xhc-whb04b-6-axis-z.hal} (100%) rename config/hal/{24-xhc-whb04b-6-mdi.hal => 54-xhc-whb04b-6-mdi.hal} (100%) delete mode 100644 config/hal/9-tool-change.hal diff --git a/config/hal/0-base.hal b/config/hal/01-modules.hal similarity index 73% rename from config/hal/0-base.hal rename to config/hal/01-modules.hal index 6af9192..96db10e 100644 --- a/config/hal/0-base.hal +++ b/config/hal/01-modules.hal @@ -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 diff --git a/config/hal/02-7i97.hal b/config/hal/02-7i97.hal new file mode 100644 index 0000000..889d88e --- /dev/null +++ b/config/hal/02-7i97.hal @@ -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 diff --git a/config/hal/11-sserial.hal b/config/hal/03-7i84.hal similarity index 99% rename from config/hal/11-sserial.hal rename to config/hal/03-7i84.hal index 9cf555e..bc09152 100644 --- a/config/hal/11-sserial.hal +++ b/config/hal/03-7i84.hal @@ -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) diff --git a/config/hal/4-estop.hal b/config/hal/04-estop.hal similarity index 90% rename from config/hal/4-estop.hal rename to config/hal/04-estop.hal index c23da20..05e8f61 100644 --- a/config/hal/4-estop.hal +++ b/config/hal/04-estop.hal @@ -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 diff --git a/config/hal/3-maho-inputs.hal b/config/hal/05-maho-inputs.hal similarity index 100% rename from config/hal/3-maho-inputs.hal rename to config/hal/05-maho-inputs.hal diff --git a/config/hal/2-maho-outputs.hal b/config/hal/05-maho-outputs.hal similarity index 93% rename from config/hal/2-maho-outputs.hal rename to config/hal/05-maho-outputs.hal index d48c930..e7e71e2 100644 --- a/config/hal/2-maho-outputs.hal +++ b/config/hal/05-maho-outputs.hal @@ -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 diff --git a/config/hal/1-axis-x.hal b/config/hal/07-axis-x.hal similarity index 96% rename from config/hal/1-axis-x.hal rename to config/hal/07-axis-x.hal index 8db7798..9dc456e 100644 --- a/config/hal/1-axis-x.hal +++ b/config/hal/07-axis-x.hal @@ -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) diff --git a/config/hal/1-axis-y.hal b/config/hal/07-axis-y.hal similarity index 96% rename from config/hal/1-axis-y.hal rename to config/hal/07-axis-y.hal index 9847f6d..fa670eb 100644 --- a/config/hal/1-axis-y.hal +++ b/config/hal/07-axis-y.hal @@ -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) diff --git a/config/hal/1-axis-z.hal b/config/hal/07-axis-z.hal similarity index 96% rename from config/hal/1-axis-z.hal rename to config/hal/07-axis-z.hal index db84c78..7d651d1 100644 --- a/config/hal/1-axis-z.hal +++ b/config/hal/07-axis-z.hal @@ -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) diff --git a/config/hal/5-limits.hal b/config/hal/08-limits.hal similarity index 100% rename from config/hal/5-limits.hal rename to config/hal/08-limits.hal diff --git a/config/hal/09-tool-change.hal b/config/hal/09-tool-change.hal new file mode 100644 index 0000000..f088c0c --- /dev/null +++ b/config/hal/09-tool-change.hal @@ -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 diff --git a/config/hal/10-coolant.hal b/config/hal/16-coolant.hal similarity index 100% rename from config/hal/10-coolant.hal rename to config/hal/16-coolant.hal diff --git a/config/hal/7-lube.hal b/config/hal/19-lube.hal similarity index 100% rename from config/hal/7-lube.hal rename to config/hal/19-lube.hal diff --git a/config/hal/13-spindle.hal b/config/hal/20-spindle.hal similarity index 65% rename from config/hal/13-spindle.hal rename to config/hal/20-spindle.hal index 3534052..7854d4b 100644 --- a/config/hal/13-spindle.hal +++ b/config/hal/20-spindle.hal @@ -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 diff --git a/config/hal/12-panel-feed-override.hal b/config/hal/30-panel-feed-override.hal similarity index 100% rename from config/hal/12-panel-feed-override.hal rename to config/hal/30-panel-feed-override.hal diff --git a/config/hal/12-panel-jog-speed.hal b/config/hal/30-panel-jog-speed.hal similarity index 100% rename from config/hal/12-panel-jog-speed.hal rename to config/hal/30-panel-jog-speed.hal diff --git a/config/hal/12-panel-spindle-speed.hal b/config/hal/30-panel-spindle-speed.hal similarity index 100% rename from config/hal/12-panel-spindle-speed.hal rename to config/hal/30-panel-spindle-speed.hal diff --git a/config/hal/20-xhc-whb04b-6.hal b/config/hal/50-xhc-whb04b-6.hal similarity index 100% rename from config/hal/20-xhc-whb04b-6.hal rename to config/hal/50-xhc-whb04b-6.hal diff --git a/config/hal/21-xhc-whb04b-6-axis-x.hal b/config/hal/51-xhc-whb04b-6-axis-x.hal similarity index 100% rename from config/hal/21-xhc-whb04b-6-axis-x.hal rename to config/hal/51-xhc-whb04b-6-axis-x.hal diff --git a/config/hal/22-xhc-whb04b-6-axis-y.hal b/config/hal/52-xhc-whb04b-6-axis-y.hal similarity index 100% rename from config/hal/22-xhc-whb04b-6-axis-y.hal rename to config/hal/52-xhc-whb04b-6-axis-y.hal diff --git a/config/hal/23-xhc-whb04b-6-axis-z.hal b/config/hal/53-xhc-whb04b-6-axis-z.hal similarity index 100% rename from config/hal/23-xhc-whb04b-6-axis-z.hal rename to config/hal/53-xhc-whb04b-6-axis-z.hal diff --git a/config/hal/24-xhc-whb04b-6-mdi.hal b/config/hal/54-xhc-whb04b-6-mdi.hal similarity index 100% rename from config/hal/24-xhc-whb04b-6-mdi.hal rename to config/hal/54-xhc-whb04b-6-mdi.hal diff --git a/config/hal/9-tool-change.hal b/config/hal/9-tool-change.hal deleted file mode 100644 index 35eb7a6..0000000 --- a/config/hal/9-tool-change.hal +++ /dev/null @@ -1,24 +0,0 @@ -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 - -net spindle-on <= spindle.0.on -net spindle-on => tool-change.not.in => whb.halui.spindle.is-on - -net spindle-off <= tool-change.not.out => tool-change.and.in1 - -net buttons.tool-change => tool-change.and.in0 - -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 - -# TODO: to control the LED i propably need a flipflop diff --git a/config/maho.ini b/config/maho.ini index 4d540e3..fcc5af2 100644 --- a/config/maho.ini +++ b/config/maho.ini @@ -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