Looking at the output of building NoisePlusPalette in 3.1:
- 512 bytes are used by the 8 palettes (cloud, forest, heat, etc…)
- 138 bytes used by setMaxRefreshRate (new to 3.1)
- 154 bytes used by countFPS (used to disable dithering if fps is below 100fps)
- the noise functions themselves are fairly large at 350 bytes for fillnoise8 and 890 bytes for inoise8_raw
- the ws2812 output function is 982 bytes
- 257 bytes are used by the noise lookup table
- The compiler is insisting on including nscale8x3_video twice, which is 160ish bytes instead of 80ish
Here’s a list of the largest space using things, sorted, with sizes in bytes in hex:
00000032 init
0000003c ClocklessController<(unsigned char)3, 6, 6, 11, (EOrder)66, 0, false, 10>::clearLeds(int)
00000040 CloudColors_p
00000040 ForestColors_p
00000040 HeatColors_p
00000040 LavaColors_p
00000040 OceanColors_p
00000040 PartyColors_p
00000040 RainbowColors_p
00000040 RainbowStripeColors_p
00000044 .hidden __udivmodsi4
00000048 delay
00000048 micros
0000005a nscale8x3_video(unsigned char&, unsigned char&, unsigned char&, unsigned char)
0000005a nscale8x3_video(unsigned char&, unsigned char&, unsigned char&, unsigned char)
00000060 SetupBlackAndWhiteStripedPalette()
00000084 PixelController<(EOrder)66>::init_binary_dithering()
0000008a CFastLED::addLeds(CLEDController*, CRGB*, int, int)
0000008a CFastLED::setMaxRefreshRate(unsigned int, bool)
0000008e __vector_4
0000009a CFastLED::countFPS(int)
000000b2 ClocklessController<(unsigned char)3, 6, 6, 11, (EOrder)66, 0, false, 10>::showAdjTime(unsigned char const*, int, CRGB&, bool, int)
000000d0 SetupPurpleAndGreenPalette()
000000de SetupRandomPalette()
000000ec mapNoiseToLEDsUsingPalette()
000000f2 CFastLED::show(unsigned char)
000000f8 ColorFromPalette(CRGBPalette16 const&, unsigned char, unsigned char, TBlendType)
00000101 p
00000108 setup
0000014c hsv2rgb_rainbow(CHSV const&, CRGB&)
00000158 ChangePaletteAndSettingsPeriodically()
0000015e fillnoise8()
000001d0 void fill_gradient(CRGB*, unsigned int, CHSV, unsigned int, CHSV, TGradientDirectionCode)
0000037a inoise8_raw(unsigned int, unsigned int, unsigned int)
000003d6 ClocklessController<(unsigned char)3, 6, 6, 11, (EOrder)66, 0, false, 10>::showRGBInternal(PixelController<(EOrder)66>&)
Anyway - noise and palettes both want to use a bunch of program memory (and the code to use/manipulate them, even more). You could probably save some program space by using the controller directly and not using the FastLED object, e.g.
#include<FastLED.h>
#define PIN 4
#define NUM_LEDS 20
CRGB leds[NUM_LEDS];
WS2812<PIN, GRB> ledController;
void setup() { ledController.init(); }
void loop() {
// lblah blah blah
ledController.show(leds, NUM_LEDS,255);
}