From e46639ee60710eef79479165c319976e6a9bafb3 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 19 May 2020 00:46:10 +0200 Subject: [PATCH] fifth adjustment to tracelog --- client/src/cmdtrace.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index 1cf8c054e..5cb61fdf0 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -297,9 +297,14 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr //1 CRC-command, CRC ok //2 Not crc-command - //--- Draw the data column + //--- Draw the data column char line[18][120] = {{0}}; + if (data_len == 0) { + sprintf(line[0], ""); + return tracepos; + } + for (int j = 0; j < data_len && j / 18 < 18; j++) { uint8_t parityBits = parityBytes[j >> 3]; @@ -345,11 +350,6 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr } } - if (data_len == 0) { - sprintf(line[0], ""); - return tracepos; - } - // Draw the CRC column const char *crc = (crcStatus == 0 ? "!crc" : (crcStatus == 1 ? " ok " : " ")); @@ -442,7 +442,9 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr if (showWaitCycles && !isResponse && next_record_is_response(tracepos, trace)) { - uint32_t next_timestamp = *((uint32_t *)(trace + tracepos)); + tracelog_hdr_t *next_hdr = (tracelog_hdr_t *)(trace + tracepos); + + uint32_t next_timestamp = next_hdr->timestamp; PrintAndLogEx(NORMAL, " %10u | %10u | %s |fdt (Frame Delay Time): %d", (EndOfTransmissionTimestamp - first_timestamp), (next_timestamp - first_timestamp),