kitesurfer1404 / WS2812FX

WS2812 FX Library for Arduino and ESP8266
MIT License
1.58k stars 344 forks source link

Increase chasing effects speed on LED count increment #298

Closed aleksandravojinovic-htec closed 2 years ago

aleksandravojinovic-htec commented 2 years ago

Hi, I was wondering whether it is possible (and how) to increase the speed on the chasing effects (scan, dual scan, Larson scanner, comment). What's happening right now is that on the LED count increment the effect speed decreases.

For example, when the number of LEDs is 144, the speed is fine, but the speed decreases significantly when the number of LEDs is incremented to 1440.

moose4lord commented 2 years ago

I'm not sure I understand. Are you dynamically changing the number of LEDs? If so, and you want to maintain a constant animation speed, you'll need to use the setSpeed() function to change the speed parameter when you change the number of LEDs.

ws2812fx.setSpeed(1000); // set the speed parameter

The scan and Larson effects use this function to calculate the animation speed:

_animation_speed = speed_parameter / (numleds * 2)

So if num_leds=144 and speed_parameter=1000, then animation_speed = 3.47 ms/frame To get the same animation_speed with 1440 LEDs, you would need to set the speed_parameter to 3.47 (1440 2) = 10000

Make sense?

aleksandravojinovic-htec commented 2 years ago

Do you mean this function? IMG-1c8958785e33617e8bb0f5b20a0338e3-V

moose4lord commented 2 years ago

Yes, that's it.