diff --git a/Examples/jupyter_utils.py b/Examples/jupyter_utils.py index a827fcf..757d711 100644 --- a/Examples/jupyter_utils.py +++ b/Examples/jupyter_utils.py @@ -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 diff --git a/LICENSE b/LICENSE index d095a5e..4d6c018 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index b3de273..ba3d176 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/thales_remote/connection.py b/thales_remote/connection.py index d998435..0a35084 100644 --- a/thales_remote/connection.py +++ b/thales_remote/connection.py @@ -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([0x12, 0xD0, 0xFF, 0xFF, 0xFF, 0xFF]) registration_packet += bytearray(connection_name, "ASCII") diff --git a/thales_remote/script_wrapper.py b/thales_remote/script_wrapper.py index a234bef..ec17a61 100644 --- a/thales_remote/script_wrapper.py +++ b/thales_remote/script_wrapper.py @@ -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 @@ -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