From 51a2fa47c911f5c049cb4dfc87e498071c54a46a Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Mon, 12 Sep 2022 22:31:55 +0200 Subject: [PATCH] Meteor palette fix. Akemi optimisation. Fire2012 remove cooling adjustment. --- wled00/FX.cpp | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 284ca1330..4ddb67f89 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -1982,7 +1982,7 @@ uint16_t mode_fire_2012() uint8_t cool = random8((((20 + SEGMENT.speed/3) * 16) / SEGLEN)+2); uint8_t minTemp = 0; if (i= SEGLEN) { - index = (in + j - SEGLEN); + if (index >= SEGLEN) { + index -= SEGLEN; } - trail[index] = 240; - SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(trail[index], false, true, 255)); + SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0, 255)); } return FRAMETIME; } -static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail length;!,!,;!;1d"; +static const char _data_FX_MODE_METEOR[] PROGMEM = "Meteor@!,Trail length;!,,;!;1d"; // smooth meteor effect @@ -2329,24 +2328,24 @@ uint16_t mode_meteor_smooth() { trail[i] += change; if (trail[i] > 245) trail[i] = 0; if (trail[i] > 240) trail[i] = 240; - SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(trail[i], false, true, 255)); + SEGMENT.setPixelColor(i, SEGMENT.color_from_palette(i, true, false, 0, trail[i])); } } // draw meteor - for (int j = 0; j < meteorSize; j++) { - uint16_t index = in + j; - if(in + j >= SEGLEN) { - index = (in + j - SEGLEN); + for (int j = 0; j < meteorSize; j++) { + uint16_t index = in + j; + if (index >= SEGLEN) { + index -= SEGLEN; } - SEGMENT.setPixelColor(index, color_blend(SEGMENT.getPixelColor(index), SEGMENT.color_from_palette(240, false, true, 255), 48)); trail[index] = 240; + SEGMENT.setPixelColor(index, SEGMENT.color_from_palette(index, true, false, 0, 255)); } SEGENV.step += SEGMENT.speed +1; return FRAMETIME; } -static const char _data_FX_MODE_METEOR_SMOOTH[] PROGMEM = "Meteor Smooth@!,Trail length;!,!,;!;1d"; +static const char _data_FX_MODE_METEOR_SMOOTH[] PROGMEM = "Meteor Smooth@!,Trail length;!,,;!;1d"; //Railway Crossing / Christmas Fairy lights @@ -7259,7 +7258,6 @@ uint16_t mode_2DAkemi(void) { CRGB armsAndLegsColor = SEGCOLOR(1) > 0 ? SEGCOLOR(1) : 0xFFE0A0; //default warmish white 0xABA8FF; //0xFF52e5;// uint8_t ak = pgm_read_byte_near(akemi + ((y * 32)/rows) * 32 + (x * 32)/cols); // akemi[(y * 32)/rows][(x * 32)/cols] switch (ak) { - case 0: color = BLACK; break; case 3: armsAndLegsColor.r *= lightFactor; armsAndLegsColor.g *= lightFactor; armsAndLegsColor.b *= lightFactor; color = armsAndLegsColor; break; //light arms and legs 0x9B9B9B case 2: armsAndLegsColor.r *= normalFactor; armsAndLegsColor.g *= normalFactor; armsAndLegsColor.b *= normalFactor; color = armsAndLegsColor; break; //normal arms and legs 0x888888 case 1: color = armsAndLegsColor; break; //dark arms and legs 0x686868 @@ -7268,7 +7266,7 @@ uint16_t mode_2DAkemi(void) { case 4: color = faceColor; break; //dark face 0x007DC6 case 7: color = SEGCOLOR(2) > 0 ? SEGCOLOR(2) : 0xFFFFFF; break; //eyes and mouth default white case 8: if (base > 0.4) {soundColor.r *= base; soundColor.g *= base; soundColor.b *= base; color=soundColor;} else color = armsAndLegsColor; break; - default: color = BLACK; + default: color = BLACK; break; } if (SEGMENT.intensity > 128 && fftResult && fftResult[0] > 128) { //dance if base is high