FastLED 3.9.15
Loading...
Searching...
No Matches

◆ drawFireEffect()

void drawFireEffect ( float peak)

Definition at line 398 of file advanced.h.

398 {
399 // Simple fire effect without buffer
400 clearDisplay();
401
402 // Add heat at bottom based on audio
403 int heat = 100 + (peak * 155 * audioGain.value() * autoGainValue);
404 heat = MIN(heat, 255);
405
406 for (int x = 0; x < WIDTH; x++) {
407 for (int y = 0; y < HEIGHT; y++) {
408 // Simple gradient from bottom to top
409 int heatLevel = heat * (HEIGHT - y) / HEIGHT;
410 heatLevel = heatLevel * random(80, 120) / 100; // Add randomness
411 heatLevel = MIN(heatLevel, 255);
412
413 int ledIndex = xyMap(x, y);
414 if (ledIndex >= 0 && ledIndex < NUM_LEDS) {
415 leds[ledIndex] = HeatColor(heatLevel);
416 }
417 }
418 }
419}
CRGB leds[NUM_LEDS]
#define NUM_LEDS
int y
Definition simple.h:93
int x
Definition simple.h:92
fl::XYMap xyMap
Definition ColorBoost.h:61
uint8_t heat[NUM_LEDS]
Definition Fire2023.h:101
#define WIDTH
Definition advanced.h:36
float autoGainValue
Definition advanced.h:91
UISlider audioGain("Audio Gain", 1.0f, 0.1f, 5.0f, 0.1f)
#define HEIGHT
Definition advanced.h:37
void clearDisplay()
Definition advanced.h:167
CRGB HeatColor(fl::u8 temperature)
#define MIN(a, b)
Definition math_macros.h:41

References audioGain(), autoGainValue, clearDisplay(), heat, HeatColor(), HEIGHT, leds, MIN, NUM_LEDS, WIDTH, x, xyMap, and y.

Referenced by loop().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: