Skip to content

Conversation

brianm92
Copy link
Contributor

@brianm92 brianm92 commented Sep 3, 2025

This PR fixes a bug in xa_shared_types.py where enums were being constructed directly from ctypes scalers like c_int16. This caused errors such as:

ValueError: c_ushort(2) is not a valid TLMC_HardLimitOperatingModes

when calling something like:

KDC101.get_limit_switch_params(...)

as the code tried to do:

TLMC_HardLimitOperatingModes(c_uint16(...)).value

This caused an issue as enum classes only accept standard integer values, not ctypes.

Fix:

Updated xa_shared_types.py within the zip folder so that the enums are constructed from int(...), e.g., inside the LimitSwitchParams class we now have:

self._clockwise_limit_mode = TLMC_HardLimitOperatingModes(
                int(tlmc_limit_switch_params.clockwiseHardLimitOperatingMode))

I've made the change to other similar classes in the xa_shared_types.py file where I think they are appropriate, but I haven't been able to test every single one as I only have a KDC101 on hand.

…ypes.py (e.g., any 'Mode' parameters inside LimitSwitchParams and similar classes). Updated xa_sdk_setup.zip with patched xa_shared_types.py)
@TrumanMetz
Copy link
Contributor

Hi Brian,
Thanks again for checking our work. I'll try to find time this week to test this myself and see what other settings parameters are affected.

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.

2 participants