Skip to content

Commit

Permalink
Add readSetup
Browse files Browse the repository at this point in the history
Added function to read the setup.
  • Loading branch information
maxkrapp1 committed Jun 26, 2023
1 parent e73ae15 commit a244155
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 4 deletions.
1 change: 1 addition & 0 deletions Examples/jupyter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def notebookCodeToPython(jupyterNotebookName):
f.write(notebookText.encode(encoding="UTF-8"))

os.system(f"python -m black {jupyterName}")
os.system(f"python -m black {jupyterNotebookName}")
return


Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Zahner-elektrik
Copyright (c) 2023 Zahner-Elektrik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ In the examples only one method is explained and parameterized at a time for bet
* Remote control of the BC-MUX
* Class which realizes the remote control

# 📧 Haveing a question?
# 📧 Having a question?

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

Expand Down
2 changes: 1 addition & 1 deletion thales_remote/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def connectToTerm(
payload_length = len(connection_name)

registration_packet = bytearray()
registration_packet += bytearray(struct.pack("<H", payload_length))
registration_packet += bytearray(struct.pack(">H", payload_length))
registration_packet += bytearray([0x12, 0xD0, 0xFF, 0xFF, 0xFF, 0xFF])
registration_packet += bytearray(connection_name, "ASCII")

Expand Down
23 changes: 22 additions & 1 deletion thales_remote/script_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def getPotential(self) -> float:
return self._requestValueAndParseUsingRegexp(
"POTENTIAL", "potential=\s*(.*?)V?[\r\n]{0,2}$"
)

def getVoltage(self) -> float:
"""
fead the measured potential from the device
Expand Down Expand Up @@ -376,6 +376,27 @@ def getDeviceName(self) -> str:
match = re.search("(.*);(.*);([a-zA-Z]*)", reply)
return match.group(3)

def readSetup(self) -> str:
"""
read the currently set parameters
A string containing the configuration is returned.
For Example:
.. code-block::
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
:returns: reponse string from the device
"""
reply = self.executeRemoteCommand("SENDSETUP")
if reply.find("ERROR") >= 0:
raise ThalesRemoteError(
reply.rstrip("\r")
+ ThalesRemoteScriptWrapper.undefindedStandardErrorString
)
return reply

def calibrateOffsets(self) -> str:
"""
perform offset calibration on the device
Expand Down

0 comments on commit a244155

Please sign in to comment.