From 9547eeb7afe7ff87f5fc3c8c159b9d526ea0fc95 Mon Sep 17 00:00:00 2001 From: Pete Bachant Date: Wed, 13 Nov 2024 04:43:27 -0800 Subject: [PATCH 1/2] Add acsc.command function --- acspy/acsc.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/acspy/acsc.py b/acspy/acsc.py index 0347833..294cc67 100644 --- a/acspy/acsc.py +++ b/acspy/acsc.py @@ -795,6 +795,14 @@ def setOutput(hcomm, port: int, bit: int, val: int, wait=SYNCHRONOUS): call_acsc(acs.acsc_SetOutput, hcomm, port, bit, val, wait) +def command(hcomm, command: str, wait=SYNCHRONOUS): + """Send a command to the ACS controller.""" + cmd_with_return = (command + "\r").encode() + cmd_len = len(cmd_with_return) + cmd_buffer = ctypes.create_string_buffer(cmd_with_return) + return call_acsc(acs.acsc_Command, hcomm, cmd_buffer, cmd_len, wait) + + def call_acsc(func, *args, **kwargs): """Wraps ACS library to handle errors.""" rv = func(*args, **kwargs) From 27033b46eb5ce4f23ade90e0538043d014bb4bf9 Mon Sep 17 00:00:00 2001 From: Pete Bachant Date: Wed, 13 Nov 2024 04:44:47 -0800 Subject: [PATCH 2/2] Increment patch version no --- acspy/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/acspy/__init__.py b/acspy/__init__.py index 3a62121..a566fa1 100644 --- a/acspy/__init__.py +++ b/acspy/__init__.py @@ -1,3 +1,3 @@ """A package for working with ACS motion controllers in Python.""" -__version__ = "0.0.7" +__version__ = "0.0.8"