Fixed two small bugs in the analyzeTcpDump utility

This commit is contained in:
2025-01-17 10:47:58 +01:00
parent 83051e10c3
commit df7bc07259
2 changed files with 8 additions and 7 deletions

View File

@ -79,7 +79,7 @@ def parse(fileAndPath):
value = int(response)
lastLayer = lastPacket.getlayer(Raw)
lastTime = int(lastPacket.time)
lastTime = float(lastPacket.time)
data = {
'command': {
'hex': [format(value, '02x') for value in lastLayer.load],
@ -180,10 +180,11 @@ After a successfull parse run, the resulting JSON data looks like this:
<Timestamp in Epoch>
<Set command type> (e.g. Q0100= to set the position of axis 1)
<Event timestamp>
<Raw ASCII string>
<Actual command (e.g. P0100)
<Set value>
<Timestamp in Epoch>
Command
<Raw ASCII string>
<Actual command (e.g. P0100)
<Set value>
<Timestamp in Epoch>
<IP Adress MCU2>
""")

View File

@ -70,8 +70,8 @@ if __name__ == "__main__":
position_target.append(position_target[-1])
plt.plot(dates_target, position_target, "k--", label="Target position")
plt.plot(dates_all, position_all, "r", label="All responses")
plt.plot(dates_valid, position_valid, "b", label="Valid responses")
plt.plot(dates_all, position_all, "r-", label="All responses")
plt.plot(dates_valid, position_valid, "b-", label="Valid responses")
plt.xlabel("Time (ISO 8601)")
plt.ylabel("Axis position in degree")
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter("%Y-%m-%dT%H:%M:%S"))