rpi-ws281x-matrix-python icon indicating copy to clipboard operation
rpi-ws281x-matrix-python copied to clipboard

Slow beginning animation

Open Vnaf opened this issue 4 years ago • 2 comments

Hi

I'm using your code in a rpi3 to run 1200 LEDs in a strip.

My plan is run a 1200x1px GIF on the script. it will be 990 frames, at 30fps

Right now, I'm trying with a 660 frames sample I did and it's working almost great

The thing is, when the GIF starts it takes a few seconds to start running at aimed fps, it's like if everytime the loop starts it takes some time to process it or something.

Sorry if I'm asking a silly question, I'm quite noob at python.

My setup is a Rpi3 with raspbian strech, I thought to switch to lite version of the OS and see if it helps.

I have plenty of power for LEDS (70 AMP) and I'm using a logic level converter between Pi and 2812's.

Maybe is a way to optimize this? Code wise I'm just using your demo, deleting everything before the animation.

Thanks

Vnaf avatar Aug 27 '19 17:08 Vnaf

Hi

Looking further I've seen there a 100% usage of the CPU when the script is running.

Maybe is any point in the code where I can add a sleep function or something similar?

Thanks

Vnaf avatar Aug 28 '19 09:08 Vnaf

@Vnaf I missed your issue in other chatter, sorry about that. Can you share the sample?

What I feel is happening, is the time taken to fill the buffer is very large. It's taking a while to convert the initial frames that's why it is slow, once the entire gif is buffered, it just replays it. This behaviour totally makes sense.

However I feel, you can add a flag to render everything first which will make it faster or you can provide an interface to manually populate the buffer.

Let me see, what can be done. Again apologies for the delays.

whizzzkid avatar Nov 12 '19 17:11 whizzzkid