51 Fire2012(uint16_t num_leds, uint8_t cooling = 55, uint8_t sparking = 120,
52 bool reverse_direction =
false,
54 :
Fx1d(num_leds), cooling(cooling), sparking(sparking),
55 reverse_direction(reverse_direction), palette(palette) {
56 heat.reset(
new uint8_t[num_leds]());
62 CRGB *leds = context.leds;
63 if (leds ==
nullptr) {
68 for (uint16_t i = 0; i < mNumLeds; i++) {
70 qsub8(heat[i],
random8(0, ((cooling * 10) / mNumLeds) + 2));
74 for (uint16_t k = mNumLeds - 1; k >= 2; k--) {
75 heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2]) / 3;
85 for (uint16_t j = 0; j < mNumLeds; j++) {
88 uint8_t colorindex =
scale8(heat[j], 240);
91 if (reverse_direction) {
92 pixelnumber = (mNumLeds - 1) - j;
96 leds[pixelnumber] = color;
100 fl::Str fxName()
const override {
return "Fire2012"; }
106 bool reverse_direction;
central include file for FastLED, defines the CFastLED class/object
RGB color palette with 16 discrete values.
void draw(DrawContext context) override
LIB8STATIC_ALWAYS_INLINE uint8_t qadd8(uint8_t i, uint8_t j)
Add one byte to another, saturating at 0xFF.
LIB8STATIC_ALWAYS_INLINE uint8_t qsub8(uint8_t i, uint8_t j)
Subtract one byte from another, saturating at 0x00.
CRGB ColorFromPalette(const CRGBPalette16 &pal, uint8_t index, uint8_t brightness, TBlendType blendType)
Get a color from a palette.
const TProgmemRGBPalette16 HeatColors_p
Approximate "black body radiation" palette, akin to the FastLED HeatColor() function.
LIB8STATIC uint8_t random8()
Generate an 8-bit random number.
LIB8STATIC_ALWAYS_INLINE uint8_t scale8(uint8_t i, fract8 scale)
Scale one byte by a second one, which is treated as the numerator of a fraction whose denominator is ...
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
Representation of an RGB pixel (Red, Green, Blue)