From fec5516da9b8daf9ae1566a1317157b0e3954547 Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sat, 21 Jan 2023 15:39:59 +0100 Subject: [PATCH 1/2] Fire 2012 boost. --- wled00/FX.cpp | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 8f0b2d849d..a5918a413e 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1964,41 +1964,41 @@ static const char _data_FX_MODE_PALETTE[] PROGMEM = "Palette@Cycle speed;;!;;c3= // feel of your fire: COOLING (used in step 1 above) (Speed = COOLING), and SPARKING (used // in step 3 above) (Effect Intensity = Sparking). uint16_t mode_fire_2012() { - uint16_t strips = SEGMENT.nrOfVStrips(); + const uint16_t strips = SEGMENT.nrOfVStrips(); if (!SEGENV.allocateData(strips * SEGLEN)) return mode_static(); //allocation failed byte* heat = SEGENV.data; - uint32_t it = strip.now >> 5; //div 32 + const uint32_t it = strip.now >> 6; //div 64 struct virtualStrip { static void runStrip(uint16_t stripNr, byte* heat, uint32_t it) { - if (it != SEGENV.step) - { - uint8_t ignition = max(3,SEGLEN/10); // ignition area: 10% of segment length or minimum 3 pixels - - // Step 1. Cool down every cell a little - for (int i = 0; i < SEGLEN; i++) { - uint8_t cool = random8((((20 + SEGMENT.speed/3) * 16) / SEGLEN)+2); - uint8_t minTemp = 0; - if (i 1; k--) { heat[k] = (heat[k - 1] + (heat[k - 2]<<1) ) / 3; // heat[k-2] multiplied by 2 } + } - // Step 3. Randomly ignite new 'sparks' of heat near the bottom - if (random8() <= SEGMENT.intensity) { - uint8_t y = random8(ignition); - heat[y] = qadd8(heat[y], random8(160,255)); - } + // Step 3. Randomly ignite new 'sparks' of heat near the bottom + if (random8() <= SEGMENT.intensity) { + uint8_t y = random8(ignition); + uint8_t boost = (32+SEGMENT.custom3) * (3*ignition-y) / (3*ignition); + heat[y] = qadd8(heat[y], random8(64+boost,128+boost)); } // Step 4. Map from heat cells to LED colors @@ -2011,12 +2011,14 @@ uint16_t mode_fire_2012() { for (int stripNr=0; stripNr Date: Sat, 21 Jan 2023 22:38:04 +0100 Subject: [PATCH 2/2] Boost tweaking. --- wled00/FX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index a5918a413e..f1ff40175b 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1997,7 +1997,7 @@ uint16_t mode_fire_2012() { // Step 3. Randomly ignite new 'sparks' of heat near the bottom if (random8() <= SEGMENT.intensity) { uint8_t y = random8(ignition); - uint8_t boost = (32+SEGMENT.custom3) * (3*ignition-y) / (3*ignition); + uint8_t boost = (32+SEGMENT.custom3*2) * (2*ignition-y) / (2*ignition); heat[y] = qadd8(heat[y], random8(64+boost,128+boost)); }