diff --git a/wled00/FX.cpp b/wled00/FX.cpp index 61ee2daf8..8b308416a 100644 --- a/wled00/FX.cpp +++ b/wled00/FX.cpp @@ -3836,7 +3836,7 @@ uint16_t phased_base(uint8_t moder) { // We're making sine wave for (int i = 0; i < SEGLEN; i++) { if (moder == 1) modVal = (inoise8(i*10 + i*10) /16); // Let's randomize our mod length with some Perlin noise. - uint16_t val = (i+1) * allfreq; // This sets the frequency of the waves. The +1 makes sure that leds[0] is used. + uint16_t val = (i+1) * allfreq; // This sets the frequency of the waves. The +1 makes sure that led 0 is used. if (modVal == 0) modVal = 1; val += *phase * (i % modVal +1) /2; // This sets the varying phase change of the waves. By Andrew Tuline. uint8_t b = cubicwave8(val); // Now we make an 8 bit sinewave. @@ -4888,7 +4888,7 @@ uint16_t mode_2Dgameoflife(void) { // Written by Ewoud Wijma, inspired by https: // else do nothing! } //x,y - // calculate CRC16 of leds[] + // calculate CRC16 of leds uint16_t crc = crc16((const unsigned char*)prevLeds, dataSize-1); //ewowi: prevLeds instead of leds work as well, tbd: compare more patterns, see SR! // check if we had same CRC and reset if needed @@ -6243,9 +6243,6 @@ static const char *_data_FX_MODE_JUGGLES PROGMEM = "Juggles ♪@!,# of balls;,!; ////////////////////// uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline. // even with 1D effect we have to take logic for 2D segments for allocation as fill_solid() fills whole segment - const uint16_t dataSize = sizeof(CRGB) * SEGMENT.length(); // using width*height prevents reallocation if mirroring is enabled - if (!SEGENV.allocateData(dataSize)) return mode_static(); //allocation failed - CRGB *leds = reinterpret_cast(SEGENV.data); um_data_t *um_data; if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) { @@ -6254,7 +6251,7 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline. } int16_t volumeRaw = *(int16_t*)um_data->u_data[1]; - if (SEGENV.call == 0) SEGMENT.fill_solid(leds, CRGB::Black); + if (SEGENV.call == 0) SEGMENT.fill_solid(nullptr, CRGB::Black); uint8_t secondHand = micros()/(256-SEGMENT.speed)/500 % 16; if(SEGENV.aux0 != secondHand) { @@ -6264,7 +6261,6 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline. for (uint16_t i=0; i(SEGENV.data); um_data_t *um_data; if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) { @@ -6663,23 +6649,22 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline. if (!fftResult) return mode_static(); if (SEGENV.call == 0) { - SEGMENT.fill_solid(leds, CRGB::Black); + SEGMENT.fill_solid(nullptr, CRGB::Black); SEGMENT.fill(BLACK); // clear canvas SEGENV.aux0 = 0; } - SEGMENT.fade_out(SEGMENT.speed); // do not fade leds[] but only canvas + SEGMENT.fade_out(SEGMENT.speed); SEGENV.step += FRAMETIME; if (SEGENV.step > SPEED_FORMULA_L) { uint16_t segLoc = random16(SEGLEN); - leds[segLoc] = color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(2*fftResult[SEGENV.aux0%16]*240/(SEGLEN-1), false, PALETTE_SOLID_WRAP, 0), 2*fftResult[SEGENV.aux0%16]); + SEGMENT.setPixelColor(segLoc, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette(2*fftResult[SEGENV.aux0%16]*240/(SEGLEN-1), false, PALETTE_SOLID_WRAP, 0), 2*fftResult[SEGENV.aux0%16])); ++(SEGENV.aux0) %= 16; // make sure it doesn't cross 16 SEGENV.step = 1; - if (SEGMENT.is2D()) SEGMENT.blur2d(leds, SEGMENT.intensity); - else SEGMENT.blur1d(leds, SEGMENT.intensity); - for (int i=0; i mid; i--) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i-1)); //move to the left for (int i = 0; i < mid; i++) SEGMENT.setPixelColor(i, SEGMENT.getPixelColor(i+1)); // move to the right } - for (int i=0; i(SEGENV.data); um_data_t *um_data; if (!usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) { @@ -7003,7 +6976,7 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac float FFT_MajorPeak = *(float*) um_data->u_data[4]; float my_magnitude = *(float*) um_data->u_data[5] / 16.0f; - SEGMENT.fadeToBlackBy(leds, 64); // Just in case something doesn't get faded. + SEGMENT.fadeToBlackBy(nullptr, 64); // Just in case something doesn't get faded. float frTemp = FFT_MajorPeak; uint8_t octCount = 0; // Octave counter. @@ -7019,10 +6992,9 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac frTemp -=132; // This should give us a base musical note of C3 frTemp = fabs(frTemp * 2.1); // Fudge factors to compress octave range starting at 0 and going to 255; -// leds[beatsin8(8+octCount*4,0,SEGLEN-1,0,octCount*8)] += CHSV((uint8_t)frTemp,255,volTemp); // Back and forth with different frequencies and phase shift depending on current octave. +// SEGMENT.addPixelColor(beatsin8(8+octCount*4,0,SEGLEN-1,0,octCount*8), CHSV((uint8_t)frTemp,255,volTemp)); // Back and forth with different frequencies and phase shift depending on current octave. uint16_t i = map(beatsin8(8+octCount*4, 0, 255, 0, octCount*8), 0, 255, 0, SEGLEN-1); - leds[i] += color_blend(SEGCOLOR(1), SEGMENT.color_from_palette((uint8_t)frTemp, false, PALETTE_SOLID_WRAP, 0), volTemp); - for (int x = 0; x < SEGLEN; x++) SEGMENT.setPixelColor(x, leds[x]); + SEGMENT.addPixelColor(i, color_blend(SEGCOLOR(1), SEGMENT.color_from_palette((uint8_t)frTemp, false, PALETTE_SOLID_WRAP, 0), volTemp)); return FRAMETIME; } // mode_rocktaves() diff --git a/wled00/FX_2Dfcn.cpp b/wled00/FX_2Dfcn.cpp index b1a5d2cfa..fff677e5d 100644 --- a/wled00/FX_2Dfcn.cpp +++ b/wled00/FX_2Dfcn.cpp @@ -157,8 +157,7 @@ void IRAM_ATTR Segment::setPixelColorXY(int x, int y, uint32_t col) if (strip.useLedsArray) strip.leds[XY(x, y)] = col; - uint8_t _bri_t = strip._bri_t; - //uint8_t _bri_t = currentBri(getOption(SEG_OPTION_ON) ? opacity : 0); + uint8_t _bri_t = currentBri(getOption(SEG_OPTION_ON) ? opacity : 0); if (_bri_t < 255) { byte r = scale8(R(col), _bri_t); byte g = scale8(G(col), _bri_t);