From e08fb97ba9c5bfad1eef9e0460f72db8b671588e Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Thu, 26 May 2022 19:30:14 +0200 Subject: Fixed minor issue with oscilloscope query --- lab_control/sds1000xe.py | 7 +++---- lab_control/test/sds1000xe_test.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'lab_control') 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) -- cgit v1.2.3