From 3e6f35592ae6a8b2f242c28e5f20ec7dc079ad87 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Mon, 30 May 2022 19:52:31 +0200 Subject: Added function setter to JDS6600 --- lab_control/test/mock_jds6600_device.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lab_control/test/mock_jds6600_device.py') diff --git a/lab_control/test/mock_jds6600_device.py b/lab_control/test/mock_jds6600_device.py index c8025dd..a37d8a8 100644 --- a/lab_control/test/mock_jds6600_device.py +++ b/lab_control/test/mock_jds6600_device.py @@ -8,8 +8,9 @@ class MockJDS6600Device(): class ChannelState: def __init__(self): self.on = False - self.frequency = 0.0 - self.amplitude = 0.0 + self.frequency = None + self.amplitude = None + self.function = None def __init__(self): self._master, self._slave = pty.openpty() @@ -62,6 +63,12 @@ class MockJDS6600Device(): amplitude = float(args[0]) / 1000.0 self._channels[ch].amplitude = amplitude + # channel function shape + elif function == 21 or function == 22: + ch = function - 21 + shape = int(args[0]) + self._channels[ch].function = shape + elif opcode == "r": if function == 20: return f":r20={int(self._channels[0].on)},{int(self._channels[1].on)}.\r\n" @@ -96,3 +103,6 @@ class MockJDS6600Device(): def getAmplitude(self, ch: int) -> float: return self._channels[ch - 1].amplitude + def getFunction(self, ch: int) -> int: + return self._channels[ch - 1].function + -- cgit v1.2.3