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

Help with Animating a virtual CRGBArray #7

Open
mozzhead164 opened this issue Oct 6, 2017 · 3 comments
Open

Help with Animating a virtual CRGBArray #7

mozzhead164 opened this issue Oct 6, 2017 · 3 comments

Comments

@mozzhead164
Copy link

Hi, Nice work on the library!

I need help with setting up a custom array of LEDs

I have set up an XY matrix with a lookup table for my LEDs XY positions.
When i run MatrixExample1 using;
leds.SetLEDArray(&leds_real[0]); in setup,
which compiles and runs fine but is not mapped to my custom XY map layout,

I have tried setting up a virtual CRGBArray and then using
leds.SetLEDArray(&leds_virt[0]);

to map the matrix/sprites to a this array first, and then map that virtual to my 'real' LEDs using;

for (int y = 0; y < kMatrixHeight - 1; y++) {
for (int x = 0; x < kMatrixWidth; x++) {
uint16_t XYPos = suitLookUpTable[ (y * kMatrixWidth) + x];
if(XYPos > 0) { leds_real[XYPos-1] = leds_virt(x,y); }
}
}

But can't seem to get it working...
Is there anything obvious im missing here?
Should I SetLEDArray to my real LEDs and do the LookUpTable somewhere else?

Many Thanks for your time mate, really appreciate it.

@AaronLiddiment
Copy link
Owner

Why do you need to use a look up table?
Is your matrix not a full XY one or does it have a strange shape/holes?
If this is the case then I would declare another array of CRGB's that you use with the Fastled calls and is your live array, then after using my routines, run your lookup routine to transfer the CRGB's from my Matrix array to your actual Fastled one.

@mozzhead164
Copy link
Author

mozzhead164 commented Oct 7, 2017

Well, my project is a Flyboard Suit for a friend so my LEDs are stitched into a wetsuit.
https://www.youtube.com/watch?v=E5uf7tjy0NI
You can see the arrangement has requirements of its own :) its took me a while put it that way

It would be sick to have some sprites and text flying across while he's in the air.

I'm gonna see what i can get done tonight, just thought there was a better way to set up my LEDs (pointers maybe?) so that i didn't have to waste cycles in a for loop iterating one array into another.

Cheers Aaron

@AaronLiddiment
Copy link
Owner

I presume you just have an 'int' array that translates from an X/Y to your actual LED with say 0's or -1 for LED's that don't exist?
If so then you could just modify the mXY() function to return the translated LED number.
You could an an extra CRGB to the end of the LED array and return this index when the LED does no exist on your suit.

I did do a mask version of the library that allowed you to pass a bit mask of the valid leds in the matrix. So you could have irregular cutouts but the leds still had to be wired in sequence of the X/Y matrix but could have holes where leds were missed out. I never posted it though as I wasn't happy with the code/method and ended up surpassing it with the multiple matrix version.

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