Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

led matrix fps limited to 60hz and no way to send all pixels in 1 frame. #96

Open
shanecranor opened this issue Feb 21, 2024 · 1 comment

Comments

@shanecranor
Copy link

shanecranor commented Feb 21, 2024

I was trying to create some animations for the led matrix, however I noticed that the commands are only received every frame (at 60fps) even at high baud rate. This means updating all 9 columns at once results in a maximum of 60fps. Black and white animations can be run at 60fps sending everything in the 39 bytes, but this is impossible for grayscale animations at the moment. Would it be possible to add a command for sending all 306 bytes of grayscale image data?

An easier improvement would be to reduce the delay time for sending the whole column and not clear the column buffer by default.
Here is a code example of what I am trying to accomplish, note the FPS counter

import serial
import time
import random
FLUSH_BUFFER = 0x08
SEND_COL = 0x07
def send_command(s, command_id, parameters, with_response=False):
      s.write([0x32, 0xAC, command_id] + parameters)
      if with_response:
          res = s.read(32)
          return res

s = serial.Serial("COM3", 115200)

while(1):
    start = time.time()
    # loop 10 times to get a good avg fps
    for _ in range(10):
        for i in range(9):
            arr = [i]+[random.randint(0, 255) for q in range(34)]
            send_command(s, SEND_COL, arr, with_response=False)
        send_command(s, FLUSH_BUFFER, [], with_response=False)
    end = time.time()
    print("FPS: ", 1/((end-start)/10))

Output:
FPS: 5.92586648213136
FPS: 5.925065363114918
FPS: 5.88382407939697
FPS: 5.9254545945151
FPS: 5.927377226756621
FPS: 5.880792332361544
FPS: 5.923988337622522
FPS: 5.926013000679308
FPS: 5.881560904169057

@JohnAZoidberg
Copy link
Member

Would it be possible to add a command for sending all 306 bytes of grayscale image data?

Yes that is absolutely possible, but not right now. The buffer in the firmware is not large enough to fit it all.

An easier improvement would be to reduce the delay time for sending the whole column

Which delay is that? On the host side or the module side?

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

No branches or pull requests

2 participants