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

◆ drawFireEffect()

void drawFireEffect ( float peak)

Definition at line 396 of file advanced.h.

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

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: