Skip to content

qtvcp: make HAL pin type enums resolvable by uic again - #4846

Open
grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:qtvcp-pintype-enum
Open

grandixximo wants to merge 1 commit into
LinuxCNC:masterfrom
grandixximo:qtvcp-pintype-enum

Conversation

@grandixximo

Copy link
Copy Markdown
Contributor

Fixes #4843.

uic resolves <enum>HalBar::REAL</enum> with getattr(HalBar, 'REAL'). Since the HAL API break those class attributes are hal.Type members, which the HALPinType property rejects, so HalBar, PushButton and HALPad always come up with their default pin type. On qtdragon_lathe the load bars become SINT and lathe_postgui.hal fails to link them to joint.N.vel-cmd, so the config does not start.

I now copy the HALPinType members onto each class instead of keeping a second hand-written list, and declare the current names first, so BOOL, SINT and REAL are the member names and BIT, S32 and FLOAT their aliases. Otherwise Designer writes the old names back when it saves a .ui.

I ran sim.qtdragon_lathe.basic_xz_lathe before and after: before it stops after loading the postgui file, after it starts with both load pins real and linked. Loading a .ui by uic gives REAL for both HalBar::REAL and HalBar::FLOAT.

@BsAtHome, this touches the type names from the API break, could you have a look?

uic resolves `<enum>HalBar::REAL</enum>` with getattr(HalBar, 'REAL'). Since the HAL API break those class attributes were hal.Type members, which the HALPinType property rejects, so HalBar, PushButton and HALPad always came up with their default pin type. On qtdragon_lathe the load bars became SINT and lathe_postgui.hal failed to link them to joint.N.vel-cmd.

Copy the HALPinType members onto each class instead of keeping a second hand-written list, and declare the current names first so that BOOL, SINT and REAL are the member names and BIT, S32 and FLOAT their aliases.

Fixes LinuxCNC#4843
@grandixximo
grandixximo requested a review from BsAtHome November 14, 2026 12:55
@BsAtHome

Copy link
Copy Markdown
Contributor

Wondering,... how long do we need to keep the old names?
This fix correctly ensures types and write-back. The only real issue is reading old ui files, I think. Isn't it then possible to do the same getattr trick and "fix" it there instead of having the old values still defined? The fix could also warn that the ui file needs upgrading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

qtdragon_lathe -> basic_xz_lathe fails to start

2 participants