Skip to content

fix(ledmatrix): prevent redundant I2C redraws during commands to get much higher FPS on grayscale draws#147

Open
AndrooFrowns wants to merge 1 commit into
FrameworkComputer:mainfrom
AndrooFrowns:ledmatrix-fps-fix
Open

fix(ledmatrix): prevent redundant I2C redraws during commands to get much higher FPS on grayscale draws#147
AndrooFrowns wants to merge 1 commit into
FrameworkComputer:mainfrom
AndrooFrowns:ledmatrix-fps-fix

Conversation

@AndrooFrowns

Copy link
Copy Markdown

The tl;dr here is that on every command the matrix was being written to with I2c drastically slowing it down.

I considered fixing that with just a match on which commands need redraws, but decided that it's easier to tinker with or add commands if the draw requests check if they need to write to the matrix for themselves. I'm open to rewriting it in whatever patterns make sense though.

Overall I just wanted smooth animations for fun and ran into the same 6FPS limit that #96 did. This should fix it by removing redundant I2C commands to the display. In my testing it could draw a little over 100FPS with this working. On the grayscale commands the host sends 9 StageGreyCol and 1 DrawGreyColBuffer all of which were causing I2C communication, so it was 10x chattier than required.

To do this I split out the MatrixSync from Patterns since it has very little to do with drawing patterns.

I also got rid of set_brightness because it had a draw call inside it. That mattered more when I was trying out the allowlist of draw commands, but I kept it since it's more clear imo. Like I said though happy to use whatever patterns you prefer.

@AndrooFrowns AndrooFrowns changed the title fix(ledmatrix): prevent redundant I2C redraws during commands fix(ledmatrix): prevent redundant I2C redraws during commands to get much higher FPS on grayscale draws Jul 17, 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.

1 participant