PyMoDAQ / pymodaq_plugins_physik_instrumente

Set of PyMoDAQ plugins for Actuators from Physik Instumente (All the ones compatible with the GCS2 commands as well as the old 32bits MMC controller...)
MIT License
2 stars 5 forks source link

daq_move_PI doesn't work if more than one actuator share a DLL #7

Closed rgeneaux closed 11 months ago

rgeneaux commented 12 months ago

Hi,

This line: https://github.com/PyMoDAQ/pymodaq_plugins_physik_instrumente/blob/47fb69ce17341cd95d53ed756d59435411665b98/src/pymodaq_plugins_physik_instrumente/daq_move_plugins/daq_move_PI.py#L180

causes bugs because several actuators can share the same DLL (which is the value of the self.settings.child('devices') dictionary). It's quite bad on my lab computer, for which the dictionary is as follows:

Out[1]: 
{'SmarAct MCS-I SN 16005895189': 'PI_GCS2_DLL_x64.dll',
 'SmarAct MCS2 SN 22946022432': 'PI_GCS2_DLL_x64.dll',
 'APT DC Motor Controller SN 7590742086': 'PI_GCS2_DLL_x64.dll',
 'UMFT234XF SN 15975080603': 'PI_GCS2_DLL_x64.dll',
 'C-891.130300 SN 119064035': 'PI_GCS2_DLL_x64.dll',
 'COM1': 'serial',
 'COM13': 'serial',
 'COM10': 'serial',
 'COM6': 'serial',
 'COM9': 'serial',
 'COM8': 'serial',
 'COM5': 'serial',
 'COM7': 'serial'}

(yes the PI DLL is not very good at filtering what is actually from PI, there's only one here... I guess that's another topic)

so using the find_keys_from_val method won't work, we need the actual selected key from the dictionary. I couldn't find an easy way to get that, other than perhaps findign the widget and getting its currentText, but that doesn't feel right!

seb5g commented 12 months ago

They are having it in the dict but never really used it so how come it causes a bug.I don't quite understand.

seb5g commented 12 months ago

Sorry actually I got it...

seb5g commented 12 months ago

We just have to actually address an ID to each device (integer). And create a dict with these Id and the corresponding dll. Finally just a list where the index would be the I'd would work