Adding support for optional axes
The typical way to do this is to have two separate INI files which use a set of common HAL files where there is commonality, and different ones where there is not.
For example my milling machine has 4 different configs, that can set it up as a vertical mill, horizontal mill, 5 axis mill (manual B axis) or gear hobber.
What can be done, for a removable rotary, is to switch the feedback with a mux component between the commanded position and the actual position from the encoder. This prevents following errors if an attempt is made to operate the axis, but still leaves the DRO entries etc for that axis.
But the source is large and spread across many files, and I have no idea where homing is implemented.
cmorley wrote: Could you explain - in detail how you want this to work?
My use case is this: I have a removable 4th-axis. If I remove it from my router table, homing never completes, because the servo and limit switch aren't connected. I want to be able to indicate to LinuxCNC that it should ignore that axis for the purposes of homing (or really, ignore its existence for anything, e.g. path planning, etc. Ideally it would complain if gcode tried to move that axis).
The way to signal the presence or absence of the axis should be flexible (e.g. a UI button, or maybe the hardware detects its presence and asserts a pin on the IO card).
The flag is set at the end of joint initialization. It is never cleared, as far as I can tell. I'm tempted to try to wrap it in a joint pin.
andypugh wrote: The typical way to do this is to have two separate INI files which use a set of common HAL files where there is commonality, and different ones where there is not.
This seems quite onerous. I tried to do this, but I don't see how not to duplicate config. If I don't include the stuff for my joint 4 in the INI, then the HAL config fails (it tries to configure stuff based on Joint 4 parameters specified in the INI file). I can't add subsequent [HAL] sections in later .inc files (doesn't work; I tried it). I really don't want to have duplicated config, that's asking for trouble next time I change something.