From fed15816c4840d80560cfed0ec7b0e00f2e20dc4 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Thu, 11 Jan 2024 13:13:05 +0800 Subject: [PATCH] waveform: fix to easier protocol --- artiq/dashboard/waveform.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/artiq/dashboard/waveform.py b/artiq/dashboard/waveform.py index 141e4908d..10b56ddb1 100644 --- a/artiq/dashboard/waveform.py +++ b/artiq/dashboard/waveform.py @@ -751,29 +751,14 @@ class WaveformDock(QtWidgets.QDockWidget): "value": (0, "log") }) - def on_dump_receive(self, *args): - header = comm_analyzer.decode_header_from_receiver(*args) - decoded_dump = comm_analyzer.decode_dump_loop(*header) + def on_dump_receive(self, data): + decoded_dump = comm_analyzer.decode_dump(data) ddb = self._ddb trace = comm_analyzer.decoded_dump_to_waveform_data(ddb, decoded_dump) self._state.update(trace) self._dump = args self.traceDataChanged.emit() - def on_dump_read(self, dump): - endian_byte = dump[0] - if endian_byte == ord("E"): - endian = '>' - elif endian_byte == ord("e"): - endian = '<' - else: - logger.warning("first byte is not endian") - raise ValueError - payload_length_word = dump[1:5] - payload_length = struct.unpack(endian + "I", payload_length_word)[0] - data = dump[5:] - self.on_dump_receive(endian, payload_length, data) - def _decode_dump(self): dump = self._dump header = comm_analyzer.decode_header_from_receiver(*dump) @@ -800,7 +785,7 @@ class WaveformDock(QtWidgets.QDockWidget): try: with open(filename, 'rb') as f: dump = f.read() - self.on_dump_read(dump) + self.on_dump_receive(dump) except Exception as e: logger.error("Failed to open analyzer trace: %s", e)