Skip to content

Commit a244155

Browse files
committed
Add readSetup
Added function to read the setup.
1 parent e73ae15 commit a244155

5 files changed

Lines changed: 26 additions & 4 deletions

File tree

Examples/jupyter_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def notebookCodeToPython(jupyterNotebookName):
6565
f.write(notebookText.encode(encoding="UTF-8"))
6666

6767
os.system(f"python -m black {jupyterName}")
68+
os.system(f"python -m black {jupyterNotebookName}")
6869
return
6970

7071

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2023 Zahner-elektrik
3+
Copyright (c) 2023 Zahner-Elektrik
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ In the examples only one method is explained and parameterized at a time for bet
187187
* Remote control of the BC-MUX
188188
* Class which realizes the remote control
189189

190-
# 📧 Haveing a question?
190+
# 📧 Having a question?
191191

192192
Send a [mail](mailto:support@zahner.de?subject=Thales-Remote-Python%20Question&body=Your%20Message) to our support team.
193193

thales_remote/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def connectToTerm(
102102
payload_length = len(connection_name)
103103

104104
registration_packet = bytearray()
105-
registration_packet += bytearray(struct.pack("<H", payload_length))
105+
registration_packet += bytearray(struct.pack(">H", payload_length))
106106
registration_packet += bytearray([0x12, 0xD0, 0xFF, 0xFF, 0xFF, 0xFF])
107107
registration_packet += bytearray(connection_name, "ASCII")
108108

thales_remote/script_wrapper.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def getPotential(self) -> float:
186186
return self._requestValueAndParseUsingRegexp(
187187
"POTENTIAL", "potential=\s*(.*?)V?[\r\n]{0,2}$"
188188
)
189-
189+
190190
def getVoltage(self) -> float:
191191
"""
192192
fead the measured potential from the device
@@ -376,6 +376,27 @@ def getDeviceName(self) -> str:
376376
match = re.search("(.*);(.*);([a-zA-Z]*)", reply)
377377
return match.group(3)
378378

379+
def readSetup(self) -> str:
380+
"""
381+
read the currently set parameters
382+
383+
A string containing the configuration is returned.
384+
For Example:
385+
386+
.. code-block::
387+
388+
OK;SETUP;Pset=1.0000e-05;Cset=1.0000e-06;Frq=1.0000e+03;Ampl=0.0000e+00;Nw=1;Pot=0;Gal=0;GAL=0;Cmin=-3.0000e+00;Cmax=3.0000e+00;Pmin=-5.2377e+00;Pmax=5.2377e+00;DEV=0;EPC=0;MAXDEV=4;ENDSETUP
389+
390+
:returns: reponse string from the device
391+
"""
392+
reply = self.executeRemoteCommand("SENDSETUP")
393+
if reply.find("ERROR") >= 0:
394+
raise ThalesRemoteError(
395+
reply.rstrip("\r")
396+
+ ThalesRemoteScriptWrapper.undefindedStandardErrorString
397+
)
398+
return reply
399+
379400
def calibrateOffsets(self) -> str:
380401
"""
381402
perform offset calibration on the device

0 commit comments

Comments
 (0)