No expert, but I too break things up in to multiple files. Also name the files in a logical (to me) way:
Code:
01_main.hal
02_spindle.hal
03_io.hal
04_atc.hal
ad nauseum.
Any signals that span files are commented at both ends of the span.
Code:
[01_io.hal]
net BTN-BLA-BLA <= some.button.01-in #connected in mpg.hal
[06_mpg.hal]
net BTN-BLA-BLA => some.indicator.02 #connected in io.hal
ALL 'loadrt' and 'addf' statements go in the first/main hal file, and all the 'addf' statements are commented with the function they support.
Code:
addf or2.1 servo-thread #FRO
addf or2.2 servo-thread #ORIENT
I tend not to rename components, but leave the 'stock' name with sequential numbering. I've had to dig through many user hal examples in the the past year or two while learning LCNC and it's really annoying to try to figure out what a component does when it's been renamed from 'mux16.0' to 'cuppa-joe' by the author. If I do (rarely) rename something, the underlying comp name remains:
Code:
pid.x
pid.atc
mux2.rro
mux16.jog
Finally, I don't put multiple pin & signals on the same line. I simply can't read/follow this - likely a personal failing. All net command lines get one signal and one pin:
Code:
net SIGNAL <= pin.0.in
net SIGNAL => pin.1.out
Only exception is when a signal is going to two pins in the same direction and it's easy to follow:
Code:
net JOG-SPEED <= knob.something.out
net JOG-SPEED => halui.axis.jog-speed => halui.joint.jog-speed
Hope this helps a bit.