From 56660d6da27e248a8c344242e8f22b2c0f5126c6 Mon Sep 17 00:00:00 2001 From: Simon Renblad Date: Mon, 15 Jan 2024 10:58:25 +0800 Subject: [PATCH] waveform: fixes --- artiq/dashboard/waveform.py | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/artiq/dashboard/waveform.py b/artiq/dashboard/waveform.py index 10b56ddb1..3db366e6a 100644 --- a/artiq/dashboard/waveform.py +++ b/artiq/dashboard/waveform.py @@ -516,7 +516,8 @@ class WaveformArea(QtWidgets.QWidget): cw.update_x_max() maximum = self._state["stopped_x"] self._ref_axis.setLimits(xMax=maximum) - self._ref_axis.setRange(xRange=(0, maximum)) + if maximum is not None: + self._ref_axis.setRange(xRange=(0, maximum)) def on_cursor_move(self, x): self._cursor_x_pos = x @@ -680,7 +681,7 @@ class WaveformDock(QtWidgets.QDockWidget): "data": dict(), } - self._current_dir = "c://" + self._current_dir = os.getcwd() self.proxy_client = WaveformProxyClient(self._state, loop) devices_sub = Subscriber("devices", self.init_ddb, self.update_ddb) @@ -756,22 +757,9 @@ class WaveformDock(QtWidgets.QDockWidget): ddb = self._ddb trace = comm_analyzer.decoded_dump_to_waveform_data(ddb, decoded_dump) self._state.update(trace) - self._dump = args + self._dump = data self.traceDataChanged.emit() - def _decode_dump(self): - dump = self._dump - header = comm_analyzer.decode_header_from_receiver(*dump) - return comm_analyzer.decode_dump_loop(*header) - - def _dump_header(self, endian, payload_length): - payload_length_word = struct.pack(endian + "I", payload_length) - if endian == ">": - endian_byte = b"E" - else: - endian_byte = b"e" - return endian_byte + payload_length_word - async def load_trace(self): try: filename = await get_open_file_name( @@ -802,8 +790,7 @@ class WaveformDock(QtWidgets.QDockWidget): self._current_dir = os.path.dirname(filename) try: with open(filename, 'wb') as f: - f.write(self._dump_header(dump[0], dump[1])) - f.write(dump[2]) + f.write(self._dump) except Exception as e: logger.error("Failed to save analyzer trace: %s", e)