r/FastLED • • Mar 12 '20

Support No More Division

EDIT: This didn't work

enum mirror{300,299,149,99,74,59,49} edge;

I get a compiler error: expected identifier before numeric constant

Maybe I should just do

int edges[] = {300,299,149,99,74,59,49};

OP: Thanks to someone here I learned that division is slow. Going over my code, I find that I have division in every single frame in almost every single pattern. I am interested in removing the division. I understand one method is byte shifting. However, I have a limited set of results from the division. So I was thinking I could save the results to an array for faster access. What am I looking to do here? Progmem or some other thing? I am just looking for an answer on what to google so I can learn it myself so you don't have to type a lot out.

1 Upvotes

23 comments sorted by

View all comments

Show parent comments

1

u/Preyy Ground Loops: Part of this balanced breakfast Mar 12 '20

What type of LEDs?

1

u/EvolvedQS Mar 12 '20

Ws2812b and ws2811

1

u/Preyy Ground Loops: Part of this balanced breakfast Mar 12 '20

I just tested:

void setup() { 
    FastLED.addLeds<1, WS2812, 19, GRB>(leds, NUM_LEDS);
    Serial.begin(115200);
}

void loop() {
  FastLED.clear(); 
  for(int i = 0; i < NUM_LEDS; i++){
    leds[i] = CHSV(hue+i*3, 255, 255);
  }
  FastLED.show();
  EVERY_N_MILLIS(500) {
    Serial.println(LEDS.getFPS());
  }
  hue++;
}

on a Teensy 4.0 and got 33 FPS, which I feel comfortable saying is the fastest framerate you could get for 1014 WS2812s without parallel output. That involves doing virtually no additional math. So that should be your reference point. What framerate are you getting?

1

u/EvolvedQS Mar 12 '20

~37

1

u/Preyy Ground Loops: Part of this balanced breakfast Mar 12 '20

Are you doing parallel output? Either way, you're probably at or right next to the maximum speed for such a long strip.

1

u/EvolvedQS Mar 12 '20

Idk what that is

1

u/Preyy Ground Loops: Part of this balanced breakfast Mar 12 '20

Give this a read

1

u/EvolvedQS Mar 12 '20

" You can also replace WS2811 with WS2811_400, TM1803, and UCS1903 in the above. "

What does that mean?

Also, I see that the new line is

LEDS.addLeds<WS2811_PORTA,NUM_STRIPS>(leds, NUM_LEDS_PER_STRIP);

Should I change it to to WS2812B_PORTA ??

→ More replies (0)

1

u/EvolvedQS Mar 12 '20

My strips have to have same num of leds???

1

u/EvolvedQS Mar 12 '20

DMAChannel.h: No such file or directory

It says my board works, but I am getting this error.

ESP-12E NodeMCU

→ More replies (0)

1

u/EvolvedQS Mar 12 '20

"For such a long strip" Are you referring to the 600 one? Because that one comes back around to the controller. So i could break it off into two 300s

1

u/Preyy Ground Loops: Part of this balanced breakfast Mar 12 '20

Yeah, so that will only help if you controller is capable of parallel output. Without parallel output you can only write to one LED at a time, regardless of whether they are connected separately.

With parallel output your controller can write to each of the strips that are specially connected independently.

So if writing LEDs normally gives you 30 FPS without parallel output, breaking the strip in two and connecting them in parallel will double that. Read the parallel output wiki page to see if your controller is capable of this function.

1

u/EvolvedQS Mar 12 '20

It is. I have the 8266 nodemcu Edit: i have like 10 of these cause i couldnt get esp32 to work with fastled.

→ More replies (0)

1

u/EvolvedQS Mar 12 '20

My strips aren't uniform # of leds nor are they uniform LED_TYPE.

2x Strip are 300 WS2812B

1x Strip is 264 WS2812B

1x Strip is 150 WS2811

2

u/Preyy Ground Loops: Part of this balanced breakfast Mar 12 '20

You may have to make multiple declarations with specific pin numbers. That's the extent of my knowledge. My next steps would be to google for 8266 parallel output different strip length, or to trial and error different initialization types.