halcompile: support names= for count_function components - #4313
halcompile: support names= for count_function components#4313grandixximo wants to merge 1 commit into
Conversation
|
But isn't the problem that with count_function you have a user-supplied count function? You actually do not know what you are supposed to have in names because you are not counting names. The user is counting and you have no control over that. |
d233823 to
0c619b1
Compare
|
@BsAtHome You are right. With I updated the patch to do exactly that:
Tested on carousel, multiswitch, bldc, and serport with matching names, mismatching names, and default loads. The PR branch is force-pushed with the revised commit. |
0c619b1 to
051f53a
Compare
|
I can definitely see an application for multiple instances of "thermistor" (and possibly hal_input but that isn't a .comp). |
|
But thermistor does a |
|
@andypugh Before this PR, userspace components without This PR only affects userspace components that also set |
|
@BsAtHome @andypugh You are right, thermistor already supports multiple instances via Corrected framing:
|
|
@BsAtHome @andypugh Rethinking the userspace + count_function path: it does not cleanly mirror either existing pattern. Userspace without Options are:
I lean toward option 3. The actual issue #4303 is about RT components like |
051f53a to
e104fb3
Compare
Components using option count_function declared no names= module param, so loadrt names=... failed with "Unknown parameter". Declare names and parse it; use supplied names when given, otherwise fall back to get_count(). Fixes LinuxCNC#4303.
e104fb3 to
a1124f6
Compare
|
Removed the userspace @BsAtHome was correct all along, I just didn't see it... |
Fixes #4303.
Components that use
option count_functionget their instance count fromget_count()instead of acount=module parameter. The code generator also omitted thenames=module parameter and parsing for these components, soloadrt ... names=...failed with:Affected components: carousel, multiswitch, bldc, serport, pcl720, mesa_7i65.
Change
src/hal/utils/halcompile.gsocount_functioncomponents still declare and parsenames=. If names are supplied, use them as instance prefixes; otherwise fall back toget_count()and the usual numeric names.Tested:
loadrt carousel names=carloadrt carousel names=ca,cb pockets=8,12loadrt multiswitch names=ms cfg=4loadrt bldc names=bl cfg=hloadrt serport names=sp io=0x3f8loadrt carousel,loadrt multiswitch cfg=4,loadrt bldc cfg=h