waveform: fixes

This commit is contained in:
Simon Renblad 2024-01-15 10:58:25 +08:00
parent fa5d7fe877
commit 56660d6da2

View File

@ -516,6 +516,7 @@ class WaveformArea(QtWidgets.QWidget):
cw.update_x_max()
maximum = self._state["stopped_x"]
self._ref_axis.setLimits(xMax=maximum)
if maximum is not None:
self._ref_axis.setRange(xRange=(0, maximum))
def on_cursor_move(self, 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)