swinburne-sensing / pylinkam

Python module to interface to Linkam's official SDK
GNU General Public License v3.0
4 stars 5 forks source link

Change ctype of flags in interface.ControllerProgramStatusFlags #1

Closed Jordi-aguilar closed 11 months ago

Jordi-aguilar commented 1 year ago

Hi team!

Fist of all thanks for this repo. We are taking profit of it at ALBA Synchrotron in Spain and it is proving really useful.

I open this issue to report a small bug that we found. In interface.py: the _fields_ of ControllerProgramStatusFlags are declared as ctypes.c_uint64, however this will cause that calling sdk.SDKWrapper.Connection.get_program_state() always returns these flags as 0. Changing the ctype to ctypes.c_uint32 fixed it for us and now we get the true value of the flags.

We are using SDK Version 3.0.12.13 in linux and with the device connected via Serial RS-232.

Thanks again for the work done here!

Jordi

ravngr commented 11 months ago

Hi @Jordi-aguilar. Sorry didn't see this pop up, must have notifications off somewhere. Glad to hear the library is useful to you.

Just curious, are you on 1.2.2 or 1.2.3 (not released but the current master)? I only added Linux support recently so good to hear it at least somewhat works!

I don't think we use ControllerProgramStatusFlags internally so it could have been missed on my end. I'll double check the sizes of the vars in the SDK docs.

ravngr commented 11 months ago

I double checked and the docs do confirm it's supposed to be a 32-bit field, I've updated the code and created a pre-release of 1.2.4 including the fix. If it looks good I'll push it to PyPI. Thanks again!

Jordi-aguilar commented 11 months ago

Thanks @ravngr for applying the fix!

I was using 1.2.2 because I started tweaking it before your linux release (although I'm doing very similar things ;)). I will try to eventually use to the most recent one.