Add this to your hal and edit some link name to match your config : (in red)
#####################################################################
# Spindle orient mode
#####################################################################
loadrt orientv2 names=orient.orient-spindle
loadrt pid names=pid.orient-spindle
addf orient.orient-spindle servo-thread
addf pid.orient-spindle.do-pid-calcs servo-thread
# setup Orient Spindle PID
setp pid.orient-spindle.Pgain [ORIENT]P
setp pid.orient-spindle.Igain [ORIENT]I
setp pid.orient-spindle.Dgain [ORIENT]D
setp pid.orient-spindle.FF0 [ORIENT]FF0
setp pid.orient-spindle.FF1 [ORIENT]FF1
setp pid.orient-spindle.FF2 [ORIENT]FF2
setp pid.orient-spindle.bias [ORIENT]BIAS
setp pid.orient-spindle.deadband [ORIENT]DEADBAND
setp pid.orient-spindle.maxerror [ORIENT]MAX_ERROR
setp pid.orient-spindle.maxerrorI [ORIENT]MAX_ERROR_I
setp pid.orient-spindle.maxoutput [ORIENT]MAX_OUTPUT
# Set the spindle Orient speed and the angular accepted tolerance
setp orient.orient-spindle.vel-speed [ORIENT]VEL_SPEED
setp orient.orient-spindle.tolerance [ORIENT]AT_ANGLE_TOL
setp orient.orient-spindle.vel-max-for-direna [ORIENT]SPEED_MAX_DIRCHANGE
# encoder full rev connections feedback + orient feedback cmd and position
net spindle-pos => orient.orient-spindle.position # from encoder.00.position to spindle.0.revs to orient 1 per rev
net spindle-pos-deg <= orient.orient-spindle.angle-scaled-out # USED FOR VCP DISPLAY allways 0 to 360 to 0
net spindle-pos-cmd <= orient.orient-spindle.angle-asked-out # USED FOR VCP DISPLAY muxed from spindle.0.orient-angle and orient.orient-spindle.counts-from-jog
# Index connection
net spindle-index-enable <=> orient.orient-spindle.index-enable
net spindle-index-enable => pid.orient-spindle.index-enable
# Optionnal Spindle homing link for homing spindle with machine homing immediatly after Z homed
net machinehomed <= joint.2.homed
net machinehomed => orient.orient-spindle.machine-is-homed
net machine.is-on => orient.orient-spindle.machine-is-on
# If spindle is not homed report msg to user
net spindle-orient-error <= orient.orient-spindle.error
net spindle-orient-error => spindle.0.orient-fault
net spindle-orient-msg1 <= orient.orient-spindle.mdi-msg-unhomed1
net spindle-orient-msg1 => halui.mdi-command-xx #(MSG, !!! Orient Homing before asked angle, MOVES TWO TIME !!!)
net spindle-orient-msg2 <= orient.orient-spindle.mdi-msg-unhomed2
net spindle-orient-msg2 => halui.mdi-command-xx #(MSG, !!! Orient Spindle Auto Homing !!!)
net spindle-orient-msg3 <= orient.orient-spindle.mdi-msg-unhomed3
net spindle-orient-msg3 => halui.mdi-command-xx #(MSG, !!! Reverse Spindle do forward Auto Homing before run reverse !!!)
# Spindle orient enable control signals
net spindle-orient-enable <= spindle.0.orient
net spindle-orient-enable => orient.orient-spindle.enable
# Pid enable from orient component used for homing spindle from component
net spindle-orient-pid-ena <= orient.orient-spindle.ena-to-pid-orient
net spindle-orient-pid-ena => pid.orient-spindle.enable
# enable out for controler from regular spindle or orient mode
net spindle-enable => orient.orient-spindle.ena-from-velocity # link from spindle setup enable control
net spindle-orient-enable-out <= orient.orient-spindle.ena-out-muxed
net spindle-orient-enable-out => [HMOT](CARD0).7i76.0.0.spinena # moved in the orient input/output but initially in spindle setup
# direction out for controler from regular spindle or orient mode
#comment out unused signal if not use direction management exemple : +-10V drive does not need this or some drive need only one for reverse
net spindle-ccw-management => orient.orient-spindle.spindir-ccw-from-velocity # link from spindle setup direction control
net spindle-ccw-orient-out <= orient.orient-spindle.spindir-ccw-out-muxed
net spindle-ccw-orient-out => [HMOT](CARD0).7i76.0.0.output-xx # moved in the orient input/output but initially in spindle setup
net spindle-cw-management => orient.orient-spindle.spindir-cw-from-velocity # link from spindle setup direction control
net spindle-cw-orient-out <= orient.orient-spindle.spindir-cw-out-muxed
net spindle-cw-orient-out => [HMOT](CARD0).7i76.0.0.output-xx # moved in the orient input/output but initially in spindle setup
# Set asked mode from M19 P0/1/2
net spindle-orient-mode <= spindle.0.orient-mode
net spindle-orient-mode => orient.orient-spindle.mode
# Is oriented near signal + link position asked to component
net spindle-orient-degree-cmd <= spindle.0.orient-angle
net spindle-orient-degree-cmd => orient.orient-spindle.angle
net spindle-is-oriented <= orient.orient-spindle.is-oriented
net spindle-is-oriented => spindle.0.is-oriented
# # Command from component velocity to PID + velocity feedback from encoder to component need change according to your setup Abs or REL
#net spindle-orient-vel <= orient.orient-spindle.cmd-to-pid-orient # RELATIVE only for controler using +-10v for direction with positive/negative PID
net spindle-orient-vel <= orient.orient-spindle.cmd-to-pid-orient-abs # ABSOLUE IF USE WITH RELAY FOR DIRECTION or if DRIVE NEED INPUT = PID allways positive
net spindle-orient-vel => pid.orient-spindle.command
#net spindle-vel-rpm => pid.orient-spindle.feedback # RELATIVE only for controler using +-10v for direction with positive/negative PID
#net spindle-vel-rpm => orient.orient-spindle.vel-feedback # RELATIVE only for controler using +-10v for direction with positive/negative PID
net spindle-vel-rpm-abs => pid.orient-spindle.feedback # ABSOLUE IF USE WITH RELAY FOR DIRECTION or if DRIVE NEED INPUT = PID allways positive
net spindle-vel-rpm-abs => orient.orient-spindle.vel-feedback # ABSOLUE IF USE WITH RELAY FOR DIRECTION or if DRIVE NEED INPUT = PID allways positive
# Input speed velocity from normal mode inside component, the component passthru the spindle velocity to the Card signal generator or send orient velocity
net spindle-orient-pid-in-out <= pid.orient-spindle.output
net spindle-orient-pid-in-out => orient.orient-spindle.cmd-from-pid-orient
net spindle-vel-cmd-out => orient.orient-spindle.cmd-from-pid-velocity # link from spindle setup speed out from pid
net spindle-orient-ctrl-out <= orient.orient-spindle.cmd-out-muxed
net spindle-orient-ctrl-out => [HMOT](CARD0).7i76.0.0.spinout # moved in the orient input/output but initially in spindle setup
# Jog dedicated signal for pendant
net pdnt.axis.c.jog-scale => orient.orient-spindle.counts-scale-jog # whb.axis.c.jog-scale
net pdnt.axis.c.jog-counts => orient.orient-spindle.counts-from-jog # whb.axis.c.jog-counts
net pdnt.axis.c.jog-enable => orient.orient-spindle.enable-from-jog # whb.axis.c.jog-enable