Skip to content

Commit

Permalink
Modified syntax for command_prefixes. Now specified as a boolean for …
Browse files Browse the repository at this point in the history
…whether all commands are prefixed with a ':'.
  • Loading branch information
zds-dev committed Nov 29, 2024
1 parent ef61a18 commit 36a9125
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions easy_scpi/scpi_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def __init__(
backend = '',
handshake = False,
arg_separator = ',',
cmd_prefix = '',
prefix_cmds = False,
**resource_params
):
"""
Expand All @@ -185,7 +185,7 @@ def __init__(
:param backend: The pyvisa backend to use for communication. [Defualt: '']
:param handshake: Handshake mode. [Default: False]
:param arg_separator: Separator to use between arguments. [Default: ',']
:param cmd_prefix: Optional prefix for commands. [Default: '']
:param prefix_cmds: Option to prefix all commands with a colon. [Default: False]
:param resource_params: Arguments sent to the resource upon connection.
https://pyvisa.readthedocs.io/en/latest/api/resources.html
:returns: An Instrument communicator.
Expand All @@ -204,7 +204,7 @@ def __init__(

# init command parameters
self.arg_separator = arg_separator
self.cmd_prefix = cmd_prefix
self.prefix_cmds = prefix_cmds

if handshake is True:
handshake = 'OK'
Expand All @@ -224,7 +224,7 @@ def __del__( self ):


def __getattr__( self, name ):
resp = Property( self, self.cmd_prefix+name, arg_separator = self.arg_separator )
resp = Property( self, self.prefix_cmds*":"+name, arg_separator = self.arg_separator )
return resp


Expand Down

0 comments on commit 36a9125

Please sign in to comment.