-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support of USB bind identification for iseq power supplies #235
base: master
Are you sure you want to change the base?
Conversation
if read_after_query: | ||
return inst.read() | ||
else: | ||
return reply |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the SHQ 122m returns as query response the command string as check if the command was executed successfully. To get the return value of an command (or in this case the identification string) one has to additionally perform a read operation.
@@ -9,7 +9,7 @@ | |||
import ruamel.yaml | |||
|
|||
|
|||
def query_identification(rm, resource, baud_rate, read_termination=None, write_termination=None, timeout=1000 * 5): | |||
def query_identification(rm, resource, baud_rate, read_termination=None, write_termination=None, timeout=1000 * 5, indentifer_cmd="*IDN?", read_after_query=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in indentifier
@@ -105,7 +109,10 @@ def find_usb_binds(rm, log, | |||
log.debug(f"Found memorized bind {res}") | |||
result = memorized_binds[res] | |||
else: | |||
result = query_identification(rm, res, instrument['baud_rate'], instrument['read_termination'], instrument['write_termination'], timeout=timeout) | |||
if instrument["type"].lower() == "iseg_hv": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make a global "devices_with_non_default_values" dict, so that it is easier to potentially add more devices there instead of blowing up an if
clause?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, will do!
@@ -105,7 +109,10 @@ def find_usb_binds(rm, log, | |||
log.debug(f"Found memorized bind {res}") | |||
result = memorized_binds[res] | |||
else: | |||
result = query_identification(rm, res, instrument['baud_rate'], instrument['read_termination'], instrument['write_termination'], timeout=timeout) | |||
if instrument["type"].lower() == "iseg_hv": | |||
result = query_identification(rm, res, instrument['baud_rate'], instrument['read_termination'], instrument['write_termination'], timeout=timeout, indentifer_cmd="#", read_after_query=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same typo as above
basil/utils/USBBinds.py
Outdated
"name": tf["name"], | ||
"type": "", # Standard instruments with *IQN? command |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is happening here exactly? Is this a way to define different devices with non-*IDN?
identifier commands?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is done to identify serial transfer layers which uses implemented non-*IDN?
devices. Without the addition of "name" and "type" in this temporary instrument dictionary the linking in the code block below would not work and thus also not the logic which you commented in your third comment.
TL;DR: The serial transfer layer does not know if it is used for e.g. an SHQ 122M. Therefore this part is needed to identify an instrument correctly.
The iseq SHQ 122M does not support the standard
*IDN?
query. Therefore this PR adds the functionality to query/read the identifier of the SHQ 122M via the#
command. Additionally included is a small fix for an bug with memorized_binds.