From f5f58f8f232fbaa250cb63f4f292bcf5124256ef Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 15 Jan 2024 14:36:37 +0800 Subject: [PATCH] waveform: change ddb processing --- artiq/dashboard/waveform.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/artiq/dashboard/waveform.py b/artiq/dashboard/waveform.py index e27ea0f10..ded240f8f 100644 --- a/artiq/dashboard/waveform.py +++ b/artiq/dashboard/waveform.py @@ -678,7 +678,7 @@ class WaveformDock(QtWidgets.QDockWidget): self._current_dir = os.getcwd() self.proxy_client = WaveformProxyClient(self._state, loop) - devices_sub = Subscriber("devices", self.init_ddb) + devices_sub = Subscriber("devices", self.init_ddb, self.update_ddb) proxy_receiver = comm_analyzer.AnalyzerProxyReceiver( self.on_dump_receive) @@ -838,19 +838,25 @@ class WaveformDock(QtWidgets.QDockWidget): except Exception as e: logger.error("Failed to open analyzer trace: %s", e) - # DeviceDB subscriber callbacks - def init_ddb(self, ddb): - self._ddb = ddb + def _process_ddb(self): addr = None - channel_list = comm_analyzer.get_channel_list(ddb) - for k, v in channel_list.items(): - self._channels_mgr[k] = v - for name, desc in ddb.items(): - if isinstance(desc, dict): - if desc["type"] == "controller" and name == "core_analyzer": - addr = desc["host"] - port = desc.get("port_proxy", 1385) - port_control = desc.get("port_proxy_control", 1386) + #for k, v in comm_analyzer.get_channel_list(self._ddb).items(): + # self._channel_model[k] = v + for name, desc in self._ddb.items(): + if name == "core_analyzer": + logger.info("coreanalyzer exists") + addr = desc["host"] + port = desc.get("port_proxy", 1385) + port_control = desc.get("port_proxy_control", 1386) if addr is not None: self.proxy_client.update_address(addr, port, port_control) + + def init_ddb(self, ddb): + logger.info("init ddb") + self._ddb = ddb + self._process_ddb() return ddb + + def update_ddb(self, mod): + logger.info("update ddb") + self._process_ddb()