@@ -6776,12 +6776,13 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
67766776 uint16_t my_sampleAgc = fmax (fmin (volumeSmth, 255.0 ), 0 );
67776777
67786778 for (size_t i=0 ; i<SEGMENT.intensity /32 +1U ; i++) {
6779+ // if SEGLEN equals 1, we will always set color to the first and only pixel, but the effect is still good looking
67796780 SEGMENT.setPixelColor (beatsin16 (SEGMENT.speed /4 +i*2 ,0 ,SEGLEN-1 ), color_blend (SEGCOLOR (1 ), SEGMENT.color_from_palette (strip.now /4 +i*2 , false , PALETTE_SOLID_WRAP, 0 ), my_sampleAgc));
67806781 }
67816782
67826783 return FRAMETIME;
67836784} // mode_juggles()
6784- static const char _data_FX_MODE_JUGGLES[] PROGMEM = " Juggles@!,# of balls;!,!;!;1v ;m12=0,si=0" ; // Pixels, Beatsin
6785+ static const char _data_FX_MODE_JUGGLES[] PROGMEM = " Juggles@!,# of balls;!,!;!;01v ;m12=0,si=0" ; // Pixels, Beatsin
67856786
67866787
67876788// ////////////////////
@@ -6909,7 +6910,7 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline.
69096910
69106911 return FRAMETIME;
69116912} // mode_noisefire()
6912- static const char _data_FX_MODE_NOISEFIRE[] PROGMEM = " Noisefire@!,!;;;1v ;m12=2,si=0" ; // Arc, Beatsin
6913+ static const char _data_FX_MODE_NOISEFIRE[] PROGMEM = " Noisefire@!,!;;;01v ;m12=2,si=0" ; // Arc, Beatsin
69136914
69146915
69156916// /////////////////////
@@ -6981,7 +6982,7 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline.
69816982
69826983 return FRAMETIME;
69836984} // mode_pixelwave()
6984- static const char _data_FX_MODE_PIXELWAVE[] PROGMEM = " Pixelwave@!,Sensitivity;!,!;!;1v ;ix=64,m12=2,si=0" ; // Arc, Beatsin
6985+ static const char _data_FX_MODE_PIXELWAVE[] PROGMEM = " Pixelwave@!,Sensitivity;!,!;!;01v ;ix=64,m12=2,si=0" ; // Arc, Beatsin
69856986
69866987
69876988// ////////////////////
@@ -7027,7 +7028,7 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline.
70277028
70287029 return FRAMETIME;
70297030} // mode_plasmoid()
7030- static const char _data_FX_MODE_PLASMOID[] PROGMEM = " Plasmoid@Phase,# of pixels;!,!;!;1v ;sx=128,ix=80,pal=8,m12=0,si=0" ; // Pixels, Beatsin, Lava Palette
7031+ static const char _data_FX_MODE_PLASMOID[] PROGMEM = " Plasmoid@Phase,# of pixels;!,!;!;01v ;sx=128,ix=80,pal=8,m12=0,si=0" ; // Pixels, Beatsin, Lava Palette
70317032
70327033
70337034// /////////////////////
@@ -7182,7 +7183,7 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
71827183
71837184 return FRAMETIME;
71847185} // mode_blurz()
7185- static const char _data_FX_MODE_BLURZ[] PROGMEM = "Blurz@Fade rate,Blur;!,Color mix;!;1f ;m12=0,si=0"; // Pixels, Beatsin
7186+ static const char _data_FX_MODE_BLURZ[] PROGMEM = "Blurz@Fade rate,Blur;!,Color mix;!;01f ;m12=0,si=0"; // Pixels, Beatsin
71867187
71877188#else // original version from SR 0.13, with some enhancements by @softhack007
71887189uint16_t mode_blurz (void ) { // Blurz. By Andrew Tuline.
@@ -7213,6 +7214,7 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
72137214 if ((SEGENV.aux1 < SEGLEN) && (volumeSmth > 1 .0f )) SEGMENT.setPixelColor (SEGENV.aux1 ,SEGENV.step ); // "repaint" last pixel after blur
72147215
72157216 uint16_t segLoc = random16 (SEGLEN);
7217+ if (SEGLEN < 2 ) segLoc = 0 ; // WLEDMM just to be sure
72167218 unsigned pixColor = (2 *fftResult[SEGENV.aux0 %16 ]*240 )/max (1 , SEGLEN-1 ); // WLEDMM avoid uint8 overflow, and preserve pixel parameters for redraw
72177219 unsigned pixIntensity = min ((unsigned )(2 .0f *fftResult[SEGENV.aux0 %16 ]), 255U );
72187220
@@ -7229,13 +7231,14 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
72297231
72307232 return FRAMETIME_FIXED;
72317233} // mode_blurz()
7232- static const char _data_FX_MODE_BLURZ[] PROGMEM = " Blurz ☾@Fade rate,Blur;!,Color mix;!;1f ;sx=48,ix=127,m12=0,si=0" ; // Pixels, Beatsin
7234+ static const char _data_FX_MODE_BLURZ[] PROGMEM = " Blurz ☾@Fade rate,Blur;!,Color mix;!;01f ;sx=48,ix=127,m12=0,si=0" ; // Pixels, Beatsin
72337235#endif
72347236
72357237// ///////////////////////
72367238// ** DJLight //
72377239// ///////////////////////
72387240uint16_t mode_DJLight (void ) { // Written by Stefan Petrick, Adapted by Will Tatam.
7241+ // No need to prevent from executing on single led strips, only mid will be set (mid = 0)
72397242 const int mid = SEGLEN / 2 ;
72407243
72417244 um_data_t *um_data;
@@ -7291,13 +7294,14 @@ uint16_t mode_DJLight(void) { // Written by Stefan Petrick, Ad
72917294 if (SEGENV.check1 ) fadeVal = constrain (fadeVal, 0 , 176 ); // "candy factory" mode - avoid complete fade-out
72927295 SEGMENT.setPixelColor (mid, color.fadeToBlackBy (fadeVal));
72937296
7297+ // if SEGLEN equals 1 these loops won't execute
72947298 for (int i = SEGLEN - 1 ; i > mid; i--) SEGMENT.setPixelColor (i, SEGMENT.getPixelColor (i-1 )); // move to the left
72957299 for (int i = 0 ; i < mid; i++) SEGMENT.setPixelColor (i, SEGMENT.getPixelColor (i+1 )); // move to the right
72967300 }
72977301
72987302 return FRAMETIME;
72997303} // mode_DJLight()
7300- static const char _data_FX_MODE_DJLIGHT[] PROGMEM = " DJ Light@Speed,,,,,Candy Factory;;;1f ;m12=2,si=0" ; // Arc, Beatsin
7304+ static const char _data_FX_MODE_DJLIGHT[] PROGMEM = " DJ Light@Speed,,,,,Candy Factory;;;01f ;m12=2,si=0" ; // Arc, Beatsin
73017305
73027306
73037307// //////////////////
@@ -7351,6 +7355,7 @@ static const char _data_FX_MODE_FREQMAP[] PROGMEM = "Freqmap@Fade rate,Starting
73517355// ** Freqmatrix //
73527356// /////////////////////
73537357uint16_t mode_freqmatrix (void ) { // Freqmatrix. By Andreas Pleschung.
7358+ // No need to prevent from executing on single led strips, we simply change pixel 0 each time and avoid the shift
73547359 um_data_t *um_data;
73557360 if (!usermods.getUMData (&um_data, USERMOD_ID_AUDIOREACTIVE)) {
73567361 // add support for no audio
@@ -7393,12 +7398,13 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch
73937398
73947399 // shift the pixels one pixel up
73957400 SEGMENT.setPixelColor (0 , color);
7401+ // if SEGLEN equals 1 this loop won't execute
73967402 for (int i = SEGLEN - 1 ; i > 0 ; i--) SEGMENT.setPixelColor (i, SEGMENT.getPixelColor (i-1 )); // move to the left
73977403 }
73987404
73997405 return FRAMETIME;
74007406} // mode_freqmatrix()
7401- static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = " Freqmatrix@Speed,Sound effect,Low bin,High bin,Sensitivity;;;1f ;c1=18,c2=48,c3=6,m12=3,si=0" ; // Corner, Beatsin; notes range C3 to C7
7407+ static const char _data_FX_MODE_FREQMATRIX[] PROGMEM = " Freqmatrix@Speed,Sound effect,Low bin,High bin,Sensitivity;;;01f ;c1=18,c2=48,c3=6,m12=3,si=0" ; // Corner, Beatsin; notes range C3 to C7
74027408
74037409
74047410// ////////////////////
@@ -7455,6 +7461,7 @@ static const char _data_FX_MODE_FREQPIXELS[] PROGMEM = "Freqpixels@Fade rate,Sta
74557461// As a compromise between speed and accuracy we are currently sampling with 10240Hz, from which we can then determine with a 512bin FFT our max frequency is 5120Hz.
74567462// Depending on the music stream you have you might find it useful to change the frequency mapping.
74577463uint16_t mode_freqwave (void ) { // Freqwave. By Andreas Pleschung. With some enhancements by @softhack007
7464+ // As before, this effect can also work on single pixels, we just lose the shifting effect
74587465 um_data_t *um_data;
74597466 if (!usermods.getUMData (&um_data, USERMOD_ID_AUDIOREACTIVE)) {
74607467 // add support for no audio
@@ -7510,13 +7517,14 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
75107517 SEGMENT.setPixelColor (SEGLEN/2 , color);
75117518
75127519 // shift the pixels one pixel outwards
7520+ // if SEGLEN equals 1 these loops won't execute
75137521 for (int i = SEGLEN - 1 ; i > SEGLEN/2 ; i--) SEGMENT.setPixelColor (i, SEGMENT.getPixelColor (i-1 )); // move to the left
75147522 for (int i = 0 ; i < SEGLEN/2 ; i++) SEGMENT.setPixelColor (i, SEGMENT.getPixelColor (i+1 )); // move to the right
75157523 }
75167524
75177525 return FRAMETIME;
75187526} // mode_freqwave()
7519- static const char _data_FX_MODE_FREQWAVE[] PROGMEM = " Freqwave@Speed,Sound effect,Low bin,High bin,Pre-amp,Musical Scale ☾;;;1f ;c1=18,c2=48,m12=2,si=0" ; // notes range C3 to C7, Arc, Beatsin
7527+ static const char _data_FX_MODE_FREQWAVE[] PROGMEM = " Freqwave@Speed,Sound effect,Low bin,High bin,Pre-amp,Musical Scale ☾;;;01f ;c1=18,c2=48,m12=2,si=0" ; // notes range C3 to C7, Arc, Beatsin
75207528
75217529
75227530// /////////////////////
@@ -7599,13 +7607,14 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli
75997607 uint8_t numBins = map (SEGMENT.intensity ,0 ,255 ,0 ,16 ); // Map slider to fftResult bins.
76007608 for (int i=0 ; i<numBins; i++) { // How many active bins are we using.
76017609 uint16_t locn = inoise16 (strip.now *SEGMENT.speed +i*50000 , strip.now *SEGMENT.speed ); // Get a new pixel location from moving noise.
7610+ // if SEGLEN equals 1 locn will be always 0, hence we set the first pixel only
76027611 locn = map (locn, 7500 , 58000 , 0 , SEGLEN-1 ); // Map that to the length of the strand, and ensure we don't go over.
76037612 SEGMENT.setPixelColor (locn, color_blend (SEGCOLOR (1 ), SEGMENT.color_from_palette (i*64 , false , PALETTE_SOLID_WRAP, 0 ), fftResult[i % 16 ]*4 ));
76047613 }
76057614
76067615 return FRAMETIME;
76077616} // mode_noisemove()
7608- static const char _data_FX_MODE_NOISEMOVE[] PROGMEM = " Noisemove@Speed of perlin movement,Fade rate;!,!;!;1f ;m12=0,si=0" ; // Pixels, Beatsin
7617+ static const char _data_FX_MODE_NOISEMOVE[] PROGMEM = " Noisemove@Speed of perlin movement,Fade rate;!,!;!;01f ;m12=0,si=0" ; // Pixels, Beatsin
76097618
76107619
76117620// ////////////////////
@@ -7643,21 +7652,23 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac
76437652 frTemp = fabsf (frTemp * 2 .1f ); // Fudge factors to compress octave range starting at 0 and going to 255;
76447653
76457654 uint16_t i = map (beatsin8 (8 +octCount*4 , 0 , 255 , 0 , octCount*8 ), 0 , 255 , 0 , SEGLEN-1 );
7655+ // i will be always constrained between 0 and 0 if SEGLEN equals 1
76467656 i = constrain (i, 0 , SEGLEN-1 );
76477657 SEGMENT.addPixelColor (i, color_blend (SEGCOLOR (1 ), SEGMENT.color_from_palette ((uint8_t )frTemp, false , PALETTE_SOLID_WRAP, 0 ), volTemp));
76487658
76497659 return FRAMETIME;
76507660} // mode_rocktaves()
7651- static const char _data_FX_MODE_ROCKTAVES[] PROGMEM = " Rocktaves@;!,!;!;1f ;m12=1,si=0" ; // Bar, Beatsin
7661+ static const char _data_FX_MODE_ROCKTAVES[] PROGMEM = " Rocktaves@;!,!;!;01f ;m12=1,si=0" ; // Bar, Beatsin
76527662
76537663
76547664// /////////////////////
76557665// ** Waterfall //
76567666// /////////////////////
76577667// Combines peak detection with FFT_MajorPeak and FFT_Magnitude.
76587668uint16_t mode_waterfall (void ) { // Waterfall. By: Andrew Tuline
7659- if (SEGENV. call == 0 ) SEGMENT. fill (BLACK);
7669+ // effect can work on single pixels, we just lose the shifting effect
76607670
7671+ if (SEGENV.call == 0 ) SEGMENT.fill (BLACK);
76617672 um_data_t *um_data;
76627673 if (!usermods.getUMData (&um_data, USERMOD_ID_AUDIOREACTIVE)) {
76637674 // add support for no audio
@@ -7698,12 +7709,13 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
76987709 } else {
76997710 SEGMENT.setPixelColor (SEGLEN-1 , color_blend (SEGCOLOR (1 ), SEGMENT.color_from_palette (pixCol+SEGMENT.intensity , false , PALETTE_SOLID_WRAP, 0 ), (int )my_magnitude));
77007711 }
7712+ // loop will not execute if SEGLEN equals 1
77017713 for (int i = 0 ; i < SEGLEN-1 ; i++) SEGMENT.setPixelColor (i, SEGMENT.getPixelColor (i+1 )); // shift left
77027714 }
77037715
77047716 return FRAMETIME;
77057717} // mode_waterfall()
7706- static const char _data_FX_MODE_WATERFALL[] PROGMEM = " Waterfall@!,Adjust color,Select bin,Volume (min);!,!;!;1f ;c1=8,c2=48,m12=2,si=0" ; // Arc, Beatsin
7718+ static const char _data_FX_MODE_WATERFALL[] PROGMEM = " Waterfall@!,Adjust color,Select bin,Volume (min);!,!;!;01f ;c1=8,c2=48,m12=2,si=0" ; // Arc, Beatsin
77077719
77087720
77097721#ifndef WLED_DISABLE_2D
0 commit comments