diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-05-26 19:30:14 +0200 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-05-26 19:30:14 +0200 |
commit | e08fb97ba9c5bfad1eef9e0460f72db8b671588e (patch) | |
tree | f7fc209d1cb92dee7973a6695846842f3aec4661 /lab_control | |
parent | 6431b8b3380d77eb8a59f8b4ff5fcc4f6fc2f7d0 (diff) |
Fixed minor issue with oscilloscope query
Diffstat (limited to 'lab_control')
-rw-r--r-- | lab_control/sds1000xe.py | 7 | ||||
-rw-r--r-- | lab_control/test/sds1000xe_test.py | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/lab_control/sds1000xe.py b/lab_control/sds1000xe.py index c0654e0..a3ffe9c 100644 --- a/lab_control/sds1000xe.py +++ b/lab_control/sds1000xe.py @@ -5,12 +5,11 @@ from lab_control.oscilloscope import Oscilloscope class SDS1000XE(Oscilloscope): PORT = 5025 TIMEOUT = 0.2 - AVAILABLE_CHANNELS = range(1, 5) - def __init__(self, ip): + def __init__(self, address): self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self._socket.connect((ip, SDS1000XE.PORT)) + self._socket.connect((address, SDS1000XE.PORT)) self._socket.settimeout(SDS1000XE.TIMEOUT) def measureAmplitude(self, channel: int) -> float: @@ -28,7 +27,7 @@ class SDS1000XE(Oscilloscope): def _measure(self, channel: int, code: str) -> float: assert channel in SDS1000XE.AVAILABLE_CHANNELS - query = f"C{channel}:PAVA? {code}" + query = f"C{channel}:PAVA? {code}\r\n" self._socket.sendall(query.encode()) try: diff --git a/lab_control/test/sds1000xe_test.py b/lab_control/test/sds1000xe_test.py index 0112c9f..c7ec252 100644 --- a/lab_control/test/sds1000xe_test.py +++ b/lab_control/test/sds1000xe_test.py @@ -33,7 +33,7 @@ def test_RMSMeasurement(uut, mockServer): testCases = [(1, 16.23987), (2, 0.0), (3, -0.0164), (4, 10.1)] checkFloatMeasurement(testCases, mockServer.setRMS, uut.measureRMS) -def test_FrequencyMeasurement(uut, mockServer): +def test_frequencyMeasurement(uut, mockServer): testCases = [(1, 16.23987), (2, 0.0), (3, -0.0164), (4, 93489.15)] checkFloatMeasurement(testCases, mockServer.setFrequency, uut.measureFrequency) |