Fire2012 (Seg Line) - AlbertGBarber/PixelSpork GitHub Wiki

See the Documentation Guide for help understanding each page section.

Effect looks like this sample, but drawn along segment lines
Effect Sample Gif

Description:

A classic, traditional fire loop, most useful for strips with a diffuser Code modified from https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#fire. Similar to Fire2012 (Seg), but draws a a random fire along each Segment Line rather than along each segment. Each Segment Line has its own fire, but the settings are shared across the set to keep the fires consistent. See Segment Basics for notes on Segment Lines and Segments.

Fires can be configured to start either at the first or last segment for the segment lines.

The fire colors are based on a palette and background color. The palette should be ordered from the coldest to the hottest color, ie, the first color in the palette will be used for the coldest parts of the fire while the last color will be used for the hottest. Palettes can be of any length, although 3 - 4 colors seems to work best for normal fires. There are several built-in palettes that work well: try firePal_PS for a traditional fire, firePalPink_PS for a pink/purple fire, and firePalBlue_PS for a green/blue fire.

The background color is separate from the palette colors and will be treated as the coldest color, filling most of the strip. Usually it is left as blank. Keeping the background color outside of the palette allows you to use multiple pre-built palettes while keeping the background constant.

To produce a smoother fire, the palette colors can be blended together based on temperature. This does require processing power, and can be turned off using the blend setting.

The cooling and sparking settings largely shape your fire, they will probably be the main things you adjust.

  • cooling: Indicates how fast a flame cools down. More cooling means shorter flames, recommended values are between 20 and 100. 50 seems the nicest.

  • sparking: Indicates the chance (out of 255) that a spark will ignite. A higher value makes the fire more active. Suggested values lay between 50 and 200. 90 & 120 work well.

Does not support color modes.

Note that the effect stores a uint8_t heat value for each point in your segment lines (total number of points is <> * <>). This heat array is allocated dynamically, so, make sure you have enough memory for it. Likewise, if you change your segment set mid-effect, you'll need to create a new array. This may cause memory fragmentation issues. See Memory Management for more details.

Example Calls:

Fire2012SL fire2012SL(mainSegments, firePal_PS, 0, 50, 90, true, true, 70);
/* Does a fire using the built-in firePal_PS palette with a blank background
   cooling is set to 50 and sparking is set to 90
   The fire colors will be blended
   Fire will start at the first segment and end at the last segment
   The fire updates at 70ms */

Constructor Definitions:

Fire2012SL(SegmentSetPS &SegSet, palettePS &Palette, CRGB BgColor, uint8_t Cooling, uint8_t Sparking, 
           bool Blend, bool Direct, uint16_t Rate);

Constructor Inputs:

  • SegmentSetPS* segSet -- The Segment Set the effect will draw on. See common vars segSet entry for more details.

  • palettePS* palette (optional, see constructors) -- The set of colors the effect will use. See palettes. It is a pointer. See common vars palette entry for more details.

  • CRGB* bgColor -- The color used for background pixels. Is a pointer, allowing you to bind it to an external color. By default it's bound the effect's local, bgColorOrig color. See common vars bgColor entry for more details.

  • uint8_t cooling -- Indicates how fast a flame cools down. More cooling means shorter flames. Recommended values are between 20 and 100. 50 seems the nicest.

  • uint8_t sparking -- Indicates the chance (out of 255) that a spark will ignite. A higher value makes the fire more active. Suggested values lay between 50 and 200. 90 & 120 work well.

  • bool blend -- Determines if the fire colors will be blended together according to temperature. Blended fires are smoother, but need more processing power.

  • bool direct -- The direction of the fire along segment lines: true starts the fire at the first segment, false, at the last.

  • uint16_t* rate -- Update rate (ms). Is a pointer, allowing you to bind it to an external variable. By default it's bound the effect's local variable, rateOrig. See common vars rate entry for more.

Class Functions:

  • void reset();

    Restarts the effect from its initial state. Make sure you call this if you change your segment set.

  • void update();

    Updates the effect.

⚠️ **GitHub.com Fallback** ⚠️