From 26654e6a3a04d4d2816f7e92b6ba76d9685d1c8c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 27 Feb 2017 11:45:04 +0800 Subject: [PATCH] moninj: Python-side fixes --- artiq/coredevice/moninj.py | 10 +++++----- artiq/dashboard/moninj.py | 12 +++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/artiq/coredevice/moninj.py b/artiq/coredevice/moninj.py index 4032029a7..a2b0ae921 100644 --- a/artiq/coredevice/moninj.py +++ b/artiq/coredevice/moninj.py @@ -51,15 +51,15 @@ class MonInjComm: async def _receive_cr(self): try: while True: - ty = await self.reader.read(1) + ty = await self._reader.read(1) if not ty: return - if ty == "\x00": - payload = await self.reader.read(9) + if ty == b"\x00": + payload = await self._reader.read(9) channel, probe, value = struct.unpack(">lbl", payload) self.monitor_cb(channel, probe, value) - elif ty == "\x01": - payload = await self.reader.read(6) + elif ty == b"\x01": + payload = await self._reader.read(6) channel, override, value = struct.unpack(">lbb", payload) self.injection_status_cb(channel, override, value) else: diff --git a/artiq/dashboard/moninj.py b/artiq/dashboard/moninj.py index 17c692eec..5fa222d09 100644 --- a/artiq/dashboard/moninj.py +++ b/artiq/dashboard/moninj.py @@ -70,7 +70,7 @@ class _TTLWidget(QtWidgets.QFrame): self.override.clicked.connect(self.override_toggled) self.level.clicked.connect(self.level_toggled) - self.cur_value = False + self.cur_level = False self.cur_oe = False self.cur_override = False self.refresh_display() @@ -105,7 +105,7 @@ class _TTLWidget(QtWidgets.QFrame): self.set_mode(self.channel, "0") def refresh_display(self): - value_s = "1" if self.cur_value else "0" + value_s = "1" if self.cur_level else "0" if self.cur_override: value_s = "" + value_s + "" color = " color=\"red\"" @@ -122,7 +122,7 @@ class _TTLWidget(QtWidgets.QFrame): self.override.setChecked(self.cur_override) if self.cur_override: self.stack.setCurrentIndex(1) - self.level.setChecked(self.cur_value) + self.level.setChecked(self.cur_level) finally: self.programmatic_change = False @@ -173,7 +173,7 @@ class _DDSWidget(QtWidgets.QFrame): TTL_PROBE_LEVEL = 0 TTL_PROBE_OE = 1 -TTL_OVERRIDE_ENABLE = 0 +TTL_OVERRIDE_EN = 0 TTL_OVERRIDE_LEVEL = 1 TTL_OVERRIDE_OE = 2 @@ -272,6 +272,8 @@ class _DeviceManager: if self.core_connection is not None: self.core_connection.monitor(enable, channel, TTL_PROBE_LEVEL) self.core_connection.monitor(enable, channel, TTL_PROBE_OE) + if enable: + self.core_connection.get_injection_status(channel, TTL_OVERRIDE_EN) def setup_dds_monitoring(self, enable, bus_channel, channel): if self.core_connection is not None: @@ -285,7 +287,7 @@ class _DeviceManager: elif probe == TTL_PROBE_OE: widget.cur_oe = bool(value) widget.refresh_display() - if (bus_channel, channel) in self.dds_widgets_by_channel: + if (channel, probe) in self.dds_widgets_by_channel: widget = self.dds_widgets_by_channel[(channel, probe)] widget.cur_frequency = value*self.dds_sysclk/2**32 widget.refresh_display()