diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05ebddba..b0e2ef4e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -143,8 +143,9 @@ repos: - id: ruff args: [--fix, --exit-non-zero-on-fix] - id: ruff-format - - repo: https://github.com/PyCQA/docformatter - rev: dfefe062799848234b4cd60b04aa633c0608025e # frozen: v1.7.5 - hooks: - - id: docformatter - additional_dependencies: [tomli] + # TODO: Re-enable this once https://github.com/PyCQA/docformatter/issues/293 is resolved + # - repo: https://github.com/PyCQA/docformatter + # rev: dfefe062799848234b4cd60b04aa633c0608025e # frozen: v1.7.5 + # hooks: + # - id: docformatter + # additional_dependencies: [tomli] diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c9e8de7..05874a0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,10 @@ Things to be included in the next release go here. --- +### Added + +- Added USB Support for AFG31K and MDO3 models. + ## v2.4.0 (2024-09-19) ### Merged Pull Requests diff --git a/src/tm_devices/helpers/constants_and_dataclasses.py b/src/tm_devices/helpers/constants_and_dataclasses.py index 8fe69b3d..edda8fe7 100644 --- a/src/tm_devices/helpers/constants_and_dataclasses.py +++ b/src/tm_devices/helpers/constants_and_dataclasses.py @@ -587,6 +587,9 @@ def __str__(self) -> str: """The USBTMC Vendor ID for Keithley devices.""" USB_MODEL_ID_LOOKUP: Final[Mapping[SupportedModels, USBTMCConfiguration]] = MappingProxyType( { + SupportedModels.MDO3: USBTMCConfiguration( + vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x052C" + ), SupportedModels.MDO3K: USBTMCConfiguration( vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x0408" ), @@ -623,6 +626,9 @@ def __str__(self) -> str: SupportedModels.AFG3K: USBTMCConfiguration( vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x0345" ), + SupportedModels.AFG31K: USBTMCConfiguration( + vendor_id=TEKTRONIX_USBTMC_VENDOR_ID, model_id="0x035E" + ), SupportedModels.SMU2450: USBTMCConfiguration( vendor_id=KEITHLEY_USBTMC_VENDOR_ID, model_id="0x2450" ), diff --git a/src/tm_devices/helpers/functions.py b/src/tm_devices/helpers/functions.py index 0fe81691..f3f9859e 100644 --- a/src/tm_devices/helpers/functions.py +++ b/src/tm_devices/helpers/functions.py @@ -398,7 +398,8 @@ def detect_visa_resource_expression(input_str: str) -> Optional[Tuple[str, str]] filtered_usb_model_keys = [ key for key, value in model_id_lookup.items() - if value.model_id == match_groups_list[1].lower() + # Model id also has an alpha character which needs to be converted to lowercase + if value.model_id.lower() == match_groups_list[1].lower() ] if filtered_usb_model_keys: # SMU and PSU need to be removed from the string to prevent issues diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 3c07442b..e7b8f252 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -424,6 +424,7 @@ def test_get_visa_backend() -> None: ("USB::0x05E6::0x2450::01419964::INSTR", ("USB", "2450-01419964")), ("USB::0x05E6::0x2450::01419964::inst0::INSTR", ("USB", "2450-01419964")), ("USB::0x05E6::0x2450::01419964::inst::INSTR", ("USB", "2450-01419964")), + ("USB0::0x0699::0x035e::01419964::INSTR", ("USB", "AFG31K-01419964")), ("TCPIP0::SMU2450-HOSTNAME::INSTR", ("TCPIP", "SMU2450-HOSTNAME")), ("TCPIP::SMU2450-HOSTNAME::INSTR", ("TCPIP", "SMU2450-HOSTNAME")), ("TCPIP0::SMU2450-HOSTNAME::inst0::INSTR", ("TCPIP", "SMU2450-HOSTNAME")),