summaryrefslogtreecommitdiffstats
path: root/lab_control/test/mock_jds6600_device.py
diff options
context:
space:
mode:
authorEddy Pedroni <eddy@0xf7.com>2022-05-30 19:32:07 +0200
committerEddy Pedroni <eddy@0xf7.com>2022-05-30 19:32:07 +0200
commit2972db9ee49ae0c20351afd64c04b5cfac9fca72 (patch)
tree5226b0fa9304a4d37d8cc6c1b2d210597234d23a /lab_control/test/mock_jds6600_device.py
parentc8bbb344987917b3c4de89c577461d078537627a (diff)
Refactored JDS6600 tests, added amplitude implementation
Diffstat (limited to 'lab_control/test/mock_jds6600_device.py')
-rw-r--r--lab_control/test/mock_jds6600_device.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lab_control/test/mock_jds6600_device.py b/lab_control/test/mock_jds6600_device.py
index a8f755b..c8025dd 100644
--- a/lab_control/test/mock_jds6600_device.py
+++ b/lab_control/test/mock_jds6600_device.py
@@ -9,6 +9,7 @@ class MockJDS6600Device():
def __init__(self):
self.on = False
self.frequency = 0.0
+ self.amplitude = 0.0
def __init__(self):
self._master, self._slave = pty.openpty()
@@ -49,11 +50,18 @@ class MockJDS6600Device():
self._channels[1].on = args[1] == "1"
# channel frequency
+ # TODO implement correct behaviour
elif function == 23 or function == 24:
ch = function - 23
frequency = float(args[0])
self._channels[ch].frequency = frequency
+ # channel amplitude
+ elif function == 25 or function == 26:
+ ch = function - 25
+ amplitude = float(args[0]) / 1000.0
+ self._channels[ch].amplitude = amplitude
+
elif opcode == "r":
if function == 20:
return f":r20={int(self._channels[0].on)},{int(self._channels[1].on)}.\r\n"
@@ -85,3 +93,6 @@ class MockJDS6600Device():
def getFrequency(self, ch: int) -> float:
return self._channels[ch - 1].frequency
+ def getAmplitude(self, ch: int) -> float:
+ return self._channels[ch - 1].amplitude
+