I have a ton of little costume bits and projects that use gemma or trinket and while FastLED will load onto them, there’s not actually space to make it DO anything.
Is it possible to create a smaller FastLED library that just contains the basic functions (fill.gradient, fill.rainbow, etc) without all the fabulous bells and whistles, so I can use these little ATtiny chips? Has anyone done this?
I just don’t know what I can comment out and not break the whole shebang.
I’ll second what Dan said: the compiler automatically only includes the code and data that you actually use, so commenting out code or data that you aren’t using anyway has no effect.
Are you running out of flash program storage space or RAM?
void add_glitter()
{
int chance_of_glitter = 5; // percent of the time that we add glitter
int number_of_glitters = 3; // number of glitter sparkles to add
int r = random8(100);
if( r < chance_of_glitter ) {
for( int j = 0; j < number_of_glitters; j++) {
int pos = random16( NUM_LEDS);
leds[pos] = CRGB::White; // very bright glitter
}
}
}
Ouch - I don’t even need to compile/disassmble this to suspect where the problem is - the issue here is the using 3 pins for leds - because of optimizations I do in the code and the way that it is arranged, that means that there’s three full copies of the WS2812 code in there, one for each pin. I’ve been wanting to re-organize that code so that instead of there being one copy for each pin there’s only one copy for each port (each port has up to 8 pins on it (32 on arm chips)) but haven’t gotten to it yet.
However, if all three strips are going to be showing the same content, for now you can connect all three strips to one data pin.
(Also, it doesn’t help that the code for writing WS2812s is unrolled, and it does a lot - so it’s pretty big to begin with - which is part of why I wanted to make that code specialize on the port, not the pin)
Yikes, I was going to post and say that I under the attiny’s all the time (so much simpler than the teensy for little stuff), but so far I’ve been using one pin…