From c4a261f2d2a3c5aff92839812784f62ab7d1d3bf Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Fri, 2 Sep 2022 21:21:53 +0200 Subject: [PATCH] Minor tweaks. --- wled00/FX.cpp | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 055af4ff..6558ff17 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -30,7 +30,7 @@ #define IBN 5100 #define PALETTE_SOLID_WRAP (strip.paletteBlend == 1 || strip.paletteBlend == 3) -#define indexToVStrip(index, stripNr) (index) | int((stripNr+1)<<16) +#define indexToVStrip(index, stripNr) ((index) | (int((stripNr)+1)<<16)) // effect utility functions uint8_t sin_gap(uint16_t in) { @@ -1967,7 +1967,8 @@ static const char _data_FX_MODE_PALETTE[] PROGMEM = "Palette@Cycle speed,;1,2,3; // in step 3 above) (Effect Intensity = Sparking). uint16_t mode_fire_2012() { - if (!SEGENV.allocateData(SEGMENT.nrOfVStrips()*SEGLEN)) return mode_static(); //allocation failed + 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 @@ -1982,13 +1983,6 @@ uint16_t mode_fire_2012() // Step 1. Cool down every cell a little for (int i = 0; i < SEGLEN; i++) { uint8_t cool = (((20 + SEGMENT.speed/3) * 16) / SEGLEN); - /* - // 2D enhancement: cool sides of the flame a bit more - if (cols>5) { - if (f < q) cool = qadd8(cool, 2*(uint16_t)((cool * (q-f))/cols)); // cool segment sides a bit more - if (f > 3*q) cool = qadd8(cool, 2*(uint16_t)((cool * (cols-f))/cols)); // cool segment sides a bit more - } - */ uint8_t temp = qsub8(heat[i], random8(0, cool + 2)); heat[i] = (temp==0 && i(SEGENV.data); @@ -2999,7 +2994,7 @@ uint16_t mode_popcorn(void) { } }; - for (int stripNr=0; stripNr