forked from M-Labs/artiq
waveform: fix to easier protocol
This commit is contained in:
parent
082962df2f
commit
fed15816c4
@ -751,29 +751,14 @@ class WaveformDock(QtWidgets.QDockWidget):
|
|||||||
"value": (0, "log")
|
"value": (0, "log")
|
||||||
})
|
})
|
||||||
|
|
||||||
def on_dump_receive(self, *args):
|
def on_dump_receive(self, data):
|
||||||
header = comm_analyzer.decode_header_from_receiver(*args)
|
decoded_dump = comm_analyzer.decode_dump(data)
|
||||||
decoded_dump = comm_analyzer.decode_dump_loop(*header)
|
|
||||||
ddb = self._ddb
|
ddb = self._ddb
|
||||||
trace = comm_analyzer.decoded_dump_to_waveform_data(ddb, decoded_dump)
|
trace = comm_analyzer.decoded_dump_to_waveform_data(ddb, decoded_dump)
|
||||||
self._state.update(trace)
|
self._state.update(trace)
|
||||||
self._dump = args
|
self._dump = args
|
||||||
self.traceDataChanged.emit()
|
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):
|
def _decode_dump(self):
|
||||||
dump = self._dump
|
dump = self._dump
|
||||||
header = comm_analyzer.decode_header_from_receiver(*dump)
|
header = comm_analyzer.decode_header_from_receiver(*dump)
|
||||||
@ -800,7 +785,7 @@ class WaveformDock(QtWidgets.QDockWidget):
|
|||||||
try:
|
try:
|
||||||
with open(filename, 'rb') as f:
|
with open(filename, 'rb') as f:
|
||||||
dump = f.read()
|
dump = f.read()
|
||||||
self.on_dump_read(dump)
|
self.on_dump_receive(dump)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Failed to open analyzer trace: %s", e)
|
logger.error("Failed to open analyzer trace: %s", e)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user