diff options
author | Eddy Pedroni <eddy@0xf7.com> | 2022-05-30 19:52:31 +0200 |
---|---|---|
committer | Eddy Pedroni <eddy@0xf7.com> | 2022-05-30 19:55:31 +0200 |
commit | 3e6f35592ae6a8b2f242c28e5f20ec7dc079ad87 (patch) | |
tree | 9a9adc05b8c3eb02a43200ca6b5ead09c3db7f0d /lab_control/test/mock_jds6600_device.py | |
parent | 2972db9ee49ae0c20351afd64c04b5cfac9fca72 (diff) |
Added function setter to JDS6600
Diffstat (limited to 'lab_control/test/mock_jds6600_device.py')
-rw-r--r-- | lab_control/test/mock_jds6600_device.py | 14 |
1 files changed, 12 insertions, 2 deletions
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 + |