led matrix fps limited to 60hz and no way to send all pixels in 1 frame.
shanecranor opened this issue · 1 comments
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
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?