Skip to content

bus_monitor: fix the blank line after 8-byte payloads in the data columns - #145

Merged
joshanne merged 1 commit into
dronecan:masterfrom
joshanne:pr/fix-bus-monitor-blank-data-line
Oct 23, 2026
Merged

joshanne merged 1 commit into
dronecan:masterfrom
joshanne:pr/fix-bus-monitor-blank-data-line

Conversation

@joshanne

@joshanne joshanne commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The bus monitor's Data Hex and Data ASCII columns show 8 bytes per line, but computed the number of lines as data_len / 8 + 1, one too many whenever the length is a multiple of 8. Every full classic CAN frame got an empty second line, doubling the height of its row.

 formatted_data(frame)        # Data Hex
 formatted_ascii(frame)       # Data ASCII
-  for i in range(int(data_len/8)+1):
+  for i in range(max(1, (data_len + 7) // 8)):    # 8-byte groups, rounded up; at least one line
Payload length Lines before Lines after
0–7 bytes 1 1
8 bytes (every full classic CAN frame) 2 (second empty) 1
12 bytes (CAN FD) 2 2
16 bytes (CAN FD) 3 (third empty) 2
64 bytes (CAN FD) 9 (last empty) 8

Evidence

The same DroneCAN traffic in the bus monitor: NodeStatus, actuator.Status, GetNodeInfo and LogMessage frames, then CAN FD frames of 12, 16 and 64 bytes.

  • Before (master): each 8-byte frame has an empty line under its data, so only part of the traffic fits.

    ![Bus monitor before the fix]

image

After (this PR): one line per 8 bytes.

![Bus monitor after the fix]
image

  • Row heights of those 11 rows, in pixels:

    before: [28, 28, 18, 18, 28, 28, 28, 28, 28, 42, 126]
    after:  [18, 18, 18, 18, 18, 18, 18, 18, 28, 28, 112]
    

Merge Danger

Door: two-way

Revert the commit to bring the empty line back.

Blast Radius: bus-monitor

Display only: the text of the two data columns of the bus monitor. Decoding a selected transfer reads the hex text back, and splitting it on whitespace gives the same bytes with or without the empty line.

🤖 Generated with Claude Code

…umns

The Data Hex and Data ASCII columns show 8 bytes per line, but computed
the number of lines as data_len / 8 + 1, which gives one line too many
when the length is a multiple of 8. Every full classic CAN frame was
therefore shown with an empty second line, doubling the height of its
row, and CAN FD frames of 16, 24, ... 64 bytes got an empty last line.

The number of lines is now the number of 8-byte groups, rounded up, and
at least one, so that empty frames still get a line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@joshanne

Copy link
Copy Markdown
Collaborator Author

Just a nice cleanup the clanker found while adding other things.

@joshanne
joshanne merged commit 6022129 into dronecan:master Oct 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant