Skip to content

Fix simple-receiver example for short frames and row layout - #89

Open
stewartadam wants to merge 1 commit into
mainfrom
claude/project-thread-0t11p6-6-simple-receiver-example
Open

stewartadam wants to merge 1 commit into
mainfrom
claude/project-thread-0t11p6-6-simple-receiver-example

Conversation

@stewartadam

@stewartadam stewartadam commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

The simple-receiver example had two display bugs:

  • It indexed data.values[...] directly, so it panicked with index out of bounds as soon as a source sent fewer than 273 slots. E1.31 allows short frames, and DMXData documents missing trailing slots as 0.
  • It drew 16 rows of 32 columns but used y * 16 + x as the index. The rows overlapped, and only slots 1 to 272 were ever shown.

The example now uses y * 32 + x + 1, so the grid shows all 512 slots, and reads values with .get(..).unwrap_or(0).

Checked by sending five 3-slot frames by unicast to 127.0.0.1:5568. On main the example panics at examples/simple-receiver.rs:89. With this change it displays all five.

The example indexed data.values directly, so it panicked as soon as a
source sent fewer than 273 slots. It also used a row stride of 16 with 32
columns, so rows overlapped and only slots 1 to 272 were shown. Show all
512 slots in 16 rows of 32, treating missing trailing slots as 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KzaQVPkrkczgX2g7wGkip5
@stewartadam stewartadam self-assigned this Nov 12, 2026
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.

2 participants