Add mapping12 and soundsim defaults to effects and apply in segment ui

index.js: rename setSliderAndColorControl to setEffectParameters, rename extras to effectPars, add segment variable update code
FX.cpp: add map12 and ssim defaults to data_FX_MODE variables (WIP)
FX_fcn.cpp: add return in setPixelColor for 2D
This commit is contained in:
ewowi 2022-07-13 12:41:33 +02:00
parent 6799a3bd35
commit 9bec394d7f
6 changed files with 771 additions and 763 deletions

View File

@ -600,7 +600,7 @@ uint16_t mode_twinkle(void) {
return FRAMETIME; return FRAMETIME;
} }
static const char *_data_FX_MODE_TWINKLE PROGMEM = "Twinkle@!,;!,!,;!"; static const char *_data_FX_MODE_TWINKLE PROGMEM = "Twinkle@!,;!,!,;!;map12=0"; //pixels
/* /*
@ -807,7 +807,7 @@ uint16_t mode_android(void) {
return 3 + ((8 * (uint32_t)(255 - SEGMENT.speed)) / SEGLEN); return 3 + ((8 * (uint32_t)(255 - SEGMENT.speed)) / SEGLEN);
} }
static const char *_data_FX_MODE_ANDROID PROGMEM = "Android@!,Width;!,!,;!"; static const char *_data_FX_MODE_ANDROID PROGMEM = "Android@!,Width;!,!,;!;map12=1"; //vertical
/* /*
@ -1503,7 +1503,7 @@ uint16_t mode_fairytwinkle() {
} }
return FRAMETIME; return FRAMETIME;
} }
static const char *_data_FX_MODE_FAIRYTWINKLE PROGMEM = "Fairy Twinkle"; static const char *_data_FX_MODE_FAIRYTWINKLE PROGMEM = "Fairy Twinkle;;;map12=0"; //pixels
/* /*
@ -2271,7 +2271,7 @@ uint16_t mode_colortwinkle()
} }
return FRAMETIME_FIXED; return FRAMETIME_FIXED;
} }
static const char *_data_FX_MODE_COLORTWINKLE PROGMEM = "Colortwinkles@Fade speed,Spawn speed;1,2,3;!"; static const char *_data_FX_MODE_COLORTWINKLE PROGMEM = "Colortwinkles@Fade speed,Spawn speed;1,2,3;!;map12=0"; //pixels
//Calm effect, like a lake at night //Calm effect, like a lake at night
@ -2867,7 +2867,7 @@ uint16_t mode_bouncing_balls(void) {
return FRAMETIME; return FRAMETIME;
} }
static const char *_data_FX_MODE_BOUNCINGBALLS PROGMEM = "Bouncing Balls@Gravity,# of balls;!,!,;!"; static const char *_data_FX_MODE_BOUNCINGBALLS PROGMEM = "Bouncing Balls@Gravity,# of balls;!,!,;!;map12=2"; //circle
/* /*
@ -2941,7 +2941,7 @@ uint16_t mode_glitter()
return FRAMETIME; return FRAMETIME;
} }
static const char *_data_FX_MODE_GLITTER PROGMEM = "Glitter@,!;!,!,!;!=11"; static const char *_data_FX_MODE_GLITTER PROGMEM = "Glitter@,!;!,!,!;!=11;map12=0"; //pixels
//each needs 19 bytes //each needs 19 bytes
@ -3241,7 +3241,7 @@ uint16_t mode_starburst(void) {
return FRAMETIME; return FRAMETIME;
} }
#undef STARBURST_MAX_FRAG #undef STARBURST_MAX_FRAG
static const char *_data_FX_MODE_STARBURST PROGMEM = "Fireworks Starburst"; static const char *_data_FX_MODE_STARBURST PROGMEM = "Fireworks Starburst;;;map12=0"; //pixels
/* /*
@ -3525,7 +3525,7 @@ uint16_t mode_tetrix(void) {
} }
return FRAMETIME; return FRAMETIME;
} }
static const char *_data_FX_MODE_TETRIX PROGMEM = "Tetrix@!=224,Width=0;!,!,;!=11"; static const char *_data_FX_MODE_TETRIX PROGMEM = "Tetrix@!=224,Width=0;!,!,;!=11;map12=1"; //vertical
/* /*
@ -3979,7 +3979,7 @@ uint16_t mode_flow(void)
return FRAMETIME; return FRAMETIME;
} }
static const char *_data_FX_MODE_FLOW PROGMEM = "Flow@!,!;!,!,!;!=6"; static const char *_data_FX_MODE_FLOW PROGMEM = "Flow@!,!;!,!,!;!=6;map12=1"; //vertical
/* /*
@ -6254,7 +6254,7 @@ uint16_t mode_ripplepeak(void) { // * Ripple peak. By Andrew Tuli
return FRAMETIME; return FRAMETIME;
} // mode_ripplepeak() } // mode_ripplepeak()
static const char *_data_FX_MODE_RIPPLEPEAK PROGMEM = " ♪ Ripple Peak@Fade rate,Max # of ripples,,Select bin,Volume (minimum);!,!;!"; static const char *_data_FX_MODE_RIPPLEPEAK PROGMEM = " ♪ Ripple Peak@Fade rate,Max # of ripples,,Select bin,Volume (minimum)=0;!,!;!;mp12=0;ssim=0"; // Pixel, Beatsin
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D
@ -6308,7 +6308,7 @@ uint16_t mode_2DSwirl(void) {
SEGMENT.setPixels(leds); SEGMENT.setPixels(leds);
return FRAMETIME; return FRAMETIME;
} // mode_2DSwirl() } // mode_2DSwirl()
static const char *_data_FX_MODE_2DSWIRL PROGMEM = " ♪ 2D Swirl@!,Sensitivity=64,Blur;,Bg Swirl;!"; static const char *_data_FX_MODE_2DSWIRL PROGMEM = " ♪ 2D Swirl@!,Sensitivity=64,Blur;,Bg Swirl;!;ssim=0"; // Beatsin
///////////////////////// /////////////////////////
@ -6360,7 +6360,7 @@ uint16_t mode_2DWaverly(void) {
SEGMENT.setPixels(leds); SEGMENT.setPixels(leds);
return FRAMETIME; return FRAMETIME;
} // mode_2DWaverly() } // mode_2DWaverly()
static const char *_data_FX_MODE_2DWAVERLY PROGMEM = " ♪ 2D Waverly@Amplification,Sensitivity=64;;!"; static const char *_data_FX_MODE_2DWAVERLY PROGMEM = " ♪ 2D Waverly@Amplification,Sensitivity=64;;!;ssim=0"; // Beatsin
#endif // WLED_DISABLE_2D #endif // WLED_DISABLE_2D
@ -6423,7 +6423,7 @@ uint16_t mode_gravcenter(void) { // Gravcenter. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_gravcenter() } // mode_gravcenter()
static const char *_data_FX_MODE_GRAVCENTER PROGMEM = " ♪ Gravcenter@Rate of fall,Sensitivity=128;,!;!"; static const char *_data_FX_MODE_GRAVCENTER PROGMEM = " ♪ Gravcenter@Rate of fall,Sensitivity=128;,!;!;mp12=2;ssim=0"; // Circle, Beatsin
/////////////////////// ///////////////////////
@ -6477,7 +6477,7 @@ uint16_t mode_gravcentric(void) { // Gravcentric. By Andrew
return FRAMETIME; return FRAMETIME;
} // mode_gravcentric() } // mode_gravcentric()
static const char *_data_FX_MODE_GRAVCENTRIC PROGMEM = " ♪ Gravcentric@Rate of fall,Sensitivity=128;!;!"; static const char *_data_FX_MODE_GRAVCENTRIC PROGMEM = " ♪ Gravcentric@Rate of fall,Sensitivity=128;!;!;mp12=2;ssim=0"; // Circle, Beatsin
/////////////////////// ///////////////////////
@ -6527,7 +6527,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_gravimeter() } // mode_gravimeter()
static const char *_data_FX_MODE_GRAVIMETER PROGMEM = " ♪ Gravimeter@Rate of fall,Sensitivity=128;,!;!"; static const char *_data_FX_MODE_GRAVIMETER PROGMEM = " ♪ Gravimeter@Rate of fall,Sensitivity=128;,!;!;mp12=2;ssim=0"; // Circle, Beatsin
#else #else
// This an abuse of the gravimeter effect for AGC debugging // This an abuse of the gravimeter effect for AGC debugging
// instead of sound volume, it uses the AGC gain multiplier as input // instead of sound volume, it uses the AGC gain multiplier as input
@ -6593,7 +6593,7 @@ uint16_t mode_gravimeter(void) { // Gravmeter. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_gravimeter() } // mode_gravimeter()
static const char *_data_FX_MODE_GRAVIMETER PROGMEM = " ♪ Gravimeter@Rate of fall,Sensitivity=128,Input level=128;,!;!"; static const char *_data_FX_MODE_GRAVIMETER PROGMEM = " ♪ Gravimeter@Rate of fall,Sensitivity=128,Input level=128;,!;!;mp12=2;ssim=0"; // Circle, Beatsin
#endif #endif
@ -6617,7 +6617,7 @@ uint16_t mode_juggles(void) { // Juggles. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_juggles() } // mode_juggles()
static const char *_data_FX_MODE_JUGGLES PROGMEM = " ♪ Juggles@!,# of balls;,!;!"; static const char *_data_FX_MODE_JUGGLES PROGMEM = " ♪ Juggles@!,# of balls;,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
////////////////////// //////////////////////
@ -6647,7 +6647,7 @@ uint16_t mode_matripix(void) { // Matripix. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_matripix() } // mode_matripix()
static const char *_data_FX_MODE_MATRIPIX PROGMEM = " ♪ Matripix@!,Brightness=64;,!;!"; static const char *_data_FX_MODE_MATRIPIX PROGMEM = " ♪ Matripix@!,Brightness=64;,!;!;mp12=0;ssim=0;rev=1"; // Pixel, Beatsin, reverseX
////////////////////// //////////////////////
@ -6685,7 +6685,7 @@ uint16_t mode_midnoise(void) { // Midnoise. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_midnoise() } // mode_midnoise()
static const char *_data_FX_MODE_MIDNOISE PROGMEM = " ♪ Midnoise@Fade rate,Maximum length=128;,!;!"; static const char *_data_FX_MODE_MIDNOISE PROGMEM = " ♪ Midnoise@Fade rate,Maximum length=128;,!;!;mp12=2;ssim=0"; // Circle, Beatsin
////////////////////// //////////////////////
@ -6719,7 +6719,7 @@ uint16_t mode_noisefire(void) { // Noisefire. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_noisefire() } // mode_noisefire()
static const char *_data_FX_MODE_NOISEFIRE PROGMEM = " ♪ Noisefire@!,!;;"; static const char *_data_FX_MODE_NOISEFIRE PROGMEM = " ♪ Noisefire@!,!;;mp12=2;ssim=0"; // Circle, Beatsin
/////////////////////// ///////////////////////
@ -6757,7 +6757,7 @@ uint16_t mode_noisemeter(void) { // Noisemeter. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_noisemeter() } // mode_noisemeter()
static const char *_data_FX_MODE_NOISEMETER PROGMEM = " ♪ Noisemeter@Fade rate,Width=128;!,!;!"; static const char *_data_FX_MODE_NOISEMETER PROGMEM = " ♪ Noisemeter@Fade rate,Width=128;!,!;!;mp12=2;ssim=0"; // Circle, Beatsin
////////////////////// //////////////////////
@ -6790,7 +6790,7 @@ uint16_t mode_pixelwave(void) { // Pixelwave. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_pixelwave() } // mode_pixelwave()
static const char *_data_FX_MODE_PIXELWAVE PROGMEM = " ♪ Pixelwave@!,Sensitivity=64;!,!;!"; static const char *_data_FX_MODE_PIXELWAVE PROGMEM = " ♪ Pixelwave@!,Sensitivity=64;!,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
////////////////////// //////////////////////
@ -6834,7 +6834,7 @@ uint16_t mode_plasmoid(void) { // Plasmoid. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_plasmoid() } // mode_plasmoid()
static const char *_data_FX_MODE_PLASMOID PROGMEM = " ♪ Plasmoid@Phase=128,# of pixels=128;,!;!"; static const char *_data_FX_MODE_PLASMOID PROGMEM = " ♪ Plasmoid@Phase=128,# of pixels=128;,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
/////////////////////// ///////////////////////
@ -6878,7 +6878,7 @@ uint16_t mode_puddlepeak(void) { // Puddlepeak. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_puddlepeak() } // mode_puddlepeak()
static const char *_data_FX_MODE_PUDDLEPEAK PROGMEM = " ♪ Puddlepeak@Fade rate,Puddle size,,Select bin,Volume (minimum);!,!;!"; static const char *_data_FX_MODE_PUDDLEPEAK PROGMEM = " ♪ Puddlepeak@Fade rate,Puddle size,,Select bin,Volume (minimum)=0;!,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
////////////////////// //////////////////////
@ -6913,7 +6913,7 @@ uint16_t mode_puddles(void) { // Puddles. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_puddles() } // mode_puddles()
static const char *_data_FX_MODE_PUDDLES PROGMEM = " ♪ Puddles@Fade rate,Puddle size;!,!;!"; static const char *_data_FX_MODE_PUDDLES PROGMEM = " ♪ Puddles@Fade rate,Puddle size;!,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -6943,7 +6943,7 @@ uint16_t mode_pixels(void) { // Pixels. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_pixels() } // mode_pixels()
static const char *_data_FX_MODE_PIXELS PROGMEM = " ♪ Pixels@Fade rate,# of pixels;,!;!"; static const char *_data_FX_MODE_PIXELS PROGMEM = " ♪ Pixels@Fade rate,# of pixels;,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
/////////////////////////////// ///////////////////////////////
@ -7025,9 +7025,9 @@ uint16_t mode_binmap(void) {
return FRAMETIME; return FRAMETIME;
} // mode_binmap() } // mode_binmap()
#ifdef SR_DEBUG #ifdef SR_DEBUG
static const char *_data_FX_MODE_BINMAP PROGMEM = " ♫ Binmap@,,Input level=128,,Max vol;!,!;!"; static const char *_data_FX_MODE_BINMAP PROGMEM = " ♫ Binmap@,,Input level=128,,Max vol;!,!;!;mp12=0;ssim=0;rY=true"; // Pixels, Beatsin, ReverseY
#else #else
static const char *_data_FX_MODE_BINMAP PROGMEM = " ♫ Binmap@,,Input level=128;!,!;!"; static const char *_data_FX_MODE_BINMAP PROGMEM = " ♫ Binmap@,,Input level=128;!,!;!;mp12=0;ssim=0;rY=true"; // Pixels, Beatsin, ReverseY
#endif #endif
////////////////////// //////////////////////
@ -7057,7 +7057,7 @@ uint16_t mode_blurz(void) { // Blurz. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_blurz() } // mode_blurz()
static const char *_data_FX_MODE_BLURZ PROGMEM = " ♫ Blurz@Fade rate,Blur amount;!,Color mix;!"; static const char *_data_FX_MODE_BLURZ PROGMEM = " ♫ Blurz@Fade rate,Blur amount;!,Color mix;!;mp12=0;ssim=0"; // Pixels, Beatsin
///////////////////////// /////////////////////////
@ -7094,7 +7094,7 @@ uint16_t mode_DJLight(void) { // Written by ??? Adapted by Wil
return FRAMETIME; return FRAMETIME;
} // mode_DJLight() } // mode_DJLight()
static const char *_data_FX_MODE_DJLIGHT PROGMEM = " ♫ DJ Light@Speed;;"; static const char *_data_FX_MODE_DJLIGHT PROGMEM = " ♫ DJ Light@Speed;;;mp12=2;ssim=0"; // Circle, Beatsin
//////////////////// ////////////////////
@ -7131,7 +7131,7 @@ uint16_t mode_freqmap(void) { // Map FFT_MajorPeak to SEGLEN.
return FRAMETIME; return FRAMETIME;
} // mode_freqmap() } // mode_freqmap()
static const char *_data_FX_MODE_FREQMAP PROGMEM = " ♫ Freqmap@Fade rate,Starting color;,!;!"; static const char *_data_FX_MODE_FREQMAP PROGMEM = " ♫ Freqmap@Fade rate,Starting color;,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
/////////////////////// ///////////////////////
@ -7181,7 +7181,7 @@ uint16_t mode_freqmatrix(void) { // Freqmatrix. By Andreas Plesch
return FRAMETIME; return FRAMETIME;
} // mode_freqmatrix() } // mode_freqmatrix()
static const char *_data_FX_MODE_FREQMATRIX PROGMEM = " ♫ Freqmatrix@Time delay,Sound effect,Low bin,High bin,Sensivity;;"; static const char *_data_FX_MODE_FREQMATRIX PROGMEM = " ♫ Freqmatrix@Time delay,Sound effect,Low bin,High bin,Sensivity;;;mp12=0;ssim=0"; // Pixels, Beatsin
////////////////////// //////////////////////
@ -7217,7 +7217,7 @@ uint16_t mode_freqpixels(void) { // Freqpixel. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_freqpixels() } // mode_freqpixels()
static const char *_data_FX_MODE_FREQPIXELS PROGMEM = " ♫ Freqpixels@Fade rate,Starting colour and # of pixels;;"; static const char *_data_FX_MODE_FREQPIXELS PROGMEM = " ♫ Freqpixels@Fade rate,Starting colour and # of pixels;;;mp12=0;ssim=0"; // Pixels, Beatsin
////////////////////// //////////////////////
@ -7288,7 +7288,7 @@ uint16_t mode_freqwave(void) { // Freqwave. By Andreas Pleschun
return FRAMETIME; return FRAMETIME;
} // mode_freqwave() } // mode_freqwave()
static const char *_data_FX_MODE_FREQWAVE PROGMEM = " ♫ Freqwave@Time delay,Sound effect,Low bin,High bin,Pre-amp;;"; static const char *_data_FX_MODE_FREQWAVE PROGMEM = " ♫ Freqwave@Time delay,Sound effect,Low bin,High bin,Pre-amp;;;mp12=0;ssim=0"; // Pixels, Beatsin
/////////////////////// ///////////////////////
@ -7341,7 +7341,7 @@ uint16_t mode_gravfreq(void) { // Gravfreq. By Andrew Tuline.
return FRAMETIME; return FRAMETIME;
} // mode_gravfreq() } // mode_gravfreq()
static const char *_data_FX_MODE_GRAVFREQ PROGMEM = " ♫ Gravfreq@Rate of fall,Sensivity=128;,!;!"; static const char *_data_FX_MODE_GRAVFREQ PROGMEM = " ♫ Gravfreq@Rate of fall,Sensivity=128;,!;!;mp12=2;ssim=0"; // Circle, Beatsin
////////////////////// //////////////////////
@ -7367,7 +7367,7 @@ uint16_t mode_noisemove(void) { // Noisemove. By: Andrew Tuli
return FRAMETIME; return FRAMETIME;
} // mode_noisemove() } // mode_noisemove()
static const char *_data_FX_MODE_NOISEMOVE PROGMEM = " ♫ Noisemove@Speed of perlin movement,Fade rate;,!;!"; static const char *_data_FX_MODE_NOISEMOVE PROGMEM = " ♫ Noisemove@Speed of perlin movement,Fade rate;,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
////////////////////// //////////////////////
@ -7411,7 +7411,7 @@ uint16_t mode_rocktaves(void) { // Rocktaves. Same note from eac
return FRAMETIME; return FRAMETIME;
} // mode_rocktaves() } // mode_rocktaves()
static const char *_data_FX_MODE_ROCKTAVES PROGMEM = " ♫ Rocktaves@;,!;!"; static const char *_data_FX_MODE_ROCKTAVES PROGMEM = " ♫ Rocktaves@;,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
/////////////////////// ///////////////////////
@ -7464,7 +7464,7 @@ uint16_t mode_waterfall(void) { // Waterfall. By: Andrew Tulin
return FRAMETIME; return FRAMETIME;
} // mode_waterfall() } // mode_waterfall()
static const char *_data_FX_MODE_WATERFALL PROGMEM = " ♫ Waterfall@!,Adjust color,,Select bin, Volume (minimum);!,!;!"; static const char *_data_FX_MODE_WATERFALL PROGMEM = " ♫ Waterfall@!,Adjust color,,Select bin, Volume (minimum)=0;!,!;!;mp12=0;ssim=0"; // Pixels, Beatsin
#ifndef WLED_DISABLE_2D #ifndef WLED_DISABLE_2D
@ -7521,7 +7521,7 @@ uint16_t mode_2DGEQ(void) { // By Will Tatam. Code reduction by Ewoud Wijma.
return FRAMETIME; return FRAMETIME;
} // mode_2DGEQ() } // mode_2DGEQ()
static const char *_data_FX_MODE_2DGEQ PROGMEM = " ♫ 2D GEQ@Fade speed,Ripple decay,# of bands=255,Color bars=64;!,,Peak Color;!=11"; static const char *_data_FX_MODE_2DGEQ PROGMEM = " ♫ 2D GEQ@Fade speed,Ripple decay,# of bands=255,Color bars=64;!,,Peak Color;!=11;ssim=0"; // Beatsin
///////////////////////// /////////////////////////
@ -7581,7 +7581,7 @@ uint16_t mode_2DFunkyPlank(void) { // Written by ??? Adapted by Wil
SEGMENT.setPixels(leds); SEGMENT.setPixels(leds);
return FRAMETIME; return FRAMETIME;
} // mode_2DFunkyPlank } // mode_2DFunkyPlank
static const char *_data_FX_MODE_2DFUNKYPLANK PROGMEM = " ♫ 2D Funky Plank@Scroll speed,,# of bands;;"; static const char *_data_FX_MODE_2DFUNKYPLANK PROGMEM = " ♫ 2D Funky Plank@Scroll speed,,# of bands;;ssim=0"; // Beatsin
#endif // WLED_DISABLE_2D #endif // WLED_DISABLE_2D
@ -7691,7 +7691,7 @@ uint16_t mode_2DAkemi(void) {
return FRAMETIME; return FRAMETIME;
} // mode_2DAkemi } // mode_2DAkemi
static const char *_data_FX_MODE_2DAKEMI PROGMEM = "2D Akemi@Color speed,Dance;Head palette,Arms & Legs,Eyes & Mouth;Face palette"; static const char *_data_FX_MODE_2DAKEMI PROGMEM = "2D Akemi@Color speed,Dance;Head palette,Arms & Legs,Eyes & Mouth;Face palette;ssim=0"; //beatsin
#endif // WLED_DISABLE_2D #endif // WLED_DISABLE_2D

View File

@ -504,8 +504,8 @@ typedef struct Segment { // 40 (44 in memory) bytes
typedef enum mapping1D2D { typedef enum mapping1D2D {
M12_Pixels = 0, M12_Pixels = 0,
M12_VerticalBar = 1, M12_VerticalBar = 1,
M12_CenterCircle = 2, M12_Circle = 2,
M12_CenterBlock = 3 M12_Block = 3
} mapping1D2D_t; } mapping1D2D_t;
// main "strip" class // main "strip" class

View File

@ -246,10 +246,10 @@ uint16_t IRAM_ATTR WS2812FX::getMappingLength() {
case M12_VerticalBar: case M12_VerticalBar:
return SEGMENT.virtualWidth(); return SEGMENT.virtualWidth();
break; break;
case M12_CenterCircle: case M12_Circle:
return (SEGMENT.virtualWidth() + SEGMENT.virtualHeight()) / 4; // take half of the average width return (SEGMENT.virtualWidth() + SEGMENT.virtualHeight()) / 4; // take half of the average width
break; break;
case M12_CenterBlock: case M12_Block:
return (SEGMENT.virtualWidth() + SEGMENT.virtualHeight()) / 4; // take half of the average width return (SEGMENT.virtualWidth() + SEGMENT.virtualHeight()) / 4; // take half of the average width
break; break;
} }

View File

@ -186,17 +186,14 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
setPixelColorXY(i, y * groupLength(), col); setPixelColorXY(i, y * groupLength(), col);
} }
break; break;
case M12_CenterCircle: case M12_Circle:
for (int degrees = 0; degrees <= 360; degrees += 180 / (i+1)) { for (int degrees = 0; degrees <= 360; degrees += 180 / (i+1)) {
// int x = sinf(degrees*DEG_TO_RAD * i);
// int y = cosf(degrees*DEG_TO_RAD * i);
// strip.setPixelColorXY(x + SEGMENT.virtualWidth() / 2 - 1, y + SEGMENT.virtualHeight() / 2 - 1, r, g, b, w);
int x = roundf(roundf((sinf(degrees*DEG_TO_RAD) * i + SEGMENT.virtualWidth() / 2) * 10)/10); int x = roundf(roundf((sinf(degrees*DEG_TO_RAD) * i + SEGMENT.virtualWidth() / 2) * 10)/10);
int y = roundf(roundf((cosf(degrees*DEG_TO_RAD) * i + SEGMENT.virtualHeight() / 2) * 10)/10); int y = roundf(roundf((cosf(degrees*DEG_TO_RAD) * i + SEGMENT.virtualHeight() / 2) * 10)/10);
setPixelColorXY(x, y, col); setPixelColorXY(x, y, col);
} }
break; break;
case M12_CenterBlock: case M12_Block:
for (int x = SEGMENT.virtualWidth() / 2 - i - 1; x <= SEGMENT.virtualWidth() / 2 + i; x++) { for (int x = SEGMENT.virtualWidth() / 2 - i - 1; x <= SEGMENT.virtualWidth() / 2 + i; x++) {
setPixelColorXY(x, SEGMENT.virtualHeight() / 2 - i - 1, col); setPixelColorXY(x, SEGMENT.virtualHeight() / 2 - i - 1, col);
setPixelColorXY(x, SEGMENT.virtualHeight() / 2 + i , col); setPixelColorXY(x, SEGMENT.virtualHeight() / 2 + i , col);
@ -207,6 +204,7 @@ void IRAM_ATTR Segment::setPixelColor(int i, uint32_t col)
} }
break; break;
} }
return;
} }
uint16_t len = length(); uint16_t len = length();
@ -1459,7 +1457,7 @@ uint8_t Bus::_gAWM = 255;
// Technical notes // Technical notes
// =============== // ===============
// If an effect name is followed by an @, slider and color control is effective. // If an effect name is followed by an @, slider and color control is effective.
// See setSliderAndColorControl in index.js for implementation // See setEffectParameters in index.js for implementation
// If not effective then: // If not effective then:
// - For AC effects (id<128) 2 sliders and 3 colors and the palette will be shown // - For AC effects (id<128) 2 sliders and 3 colors and the palette will be shown
// - For SR effects (id>128) 5 sliders and 3 colors and the palette will be shown // - For SR effects (id>128) 5 sliders and 3 colors and the palette will be shown

View File

@ -751,8 +751,8 @@ function populateSegments(s)
<select id="seg${i}mp12" onchange="setMp12(${i})"> <select id="seg${i}mp12" onchange="setMp12(${i})">
<option value="0" ${inst.mp12==0?' selected':''}>Pixel</option> <option value="0" ${inst.mp12==0?' selected':''}>Pixel</option>
<option value="1" ${inst.mp12==1?' selected':''}>Vertical Bar</option> <option value="1" ${inst.mp12==1?' selected':''}>Vertical Bar</option>
<option value="2" ${inst.mp12==2?' selected':''}>Centre Circle</option> <option value="2" ${inst.mp12==2?' selected':''}>Circle</option>
<option value="3" ${inst.mp12==3?' selected':''}>Center block</option> <option value="3" ${inst.mp12==3?' selected':''}>Block</option>
</select><br> </select><br>
</label> </label>
<label class="check revchkl"> <label class="check revchkl">
@ -913,9 +913,9 @@ function genPalPrevCss(id)
return `background: linear-gradient(to right,${gradient.join()});`; return `background: linear-gradient(to right,${gradient.join()});`;
} }
function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', extraPar = '') function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', effectPar = '')
{ {
return `<div class="lstI${id==0?' sticky':''}" data-id="${id}" data-opt="${extraPar}" onClick="${clickAction}(${id})"> return `<div class="lstI${id==0?' sticky':''}" data-id="${id}" data-opt="${effectPar}" onClick="${clickAction}(${id})">
<label class="radio schkl" onclick="event.preventDefault()"> <label class="radio schkl" onclick="event.preventDefault()">
<input type="radio" value="${id}" name="${listName}"> <input type="radio" value="${id}" name="${listName}">
<span class="radiomark schk"></span> <span class="radiomark schk"></span>
@ -1135,7 +1135,7 @@ function updateSelectedFx()
var fx = (selectedFx != prevFx) && currentPreset==-1; // effect changed & preset==none var fx = (selectedFx != prevFx) && currentPreset==-1; // effect changed & preset==none
var ps = (prevPS != currentPreset) && currentPreset==-1; // preset changed & preset==none var ps = (prevPS != currentPreset) && currentPreset==-1; // preset changed & preset==none
// WLEDSR: extract the Slider and color control string from the HTML element and set it. // WLEDSR: extract the Slider and color control string from the HTML element and set it.
setSliderAndColorControl(selectedFx, (fx || ps)); setEffectParameters(selectedFx, (fx || ps));
} }
} }
@ -1312,16 +1312,23 @@ function readState(s,command=false)
// Note: Effects can override default pattern behaviour // Note: Effects can override default pattern behaviour
// - FadeToBlack can override the background setting // - FadeToBlack can override the background setting
// - Defining SEGCOL(<i>) can override a specific palette using these values (e.g. Color Gradient) // - Defining SEGCOL(<i>) can override a specific palette using these values (e.g. Color Gradient)
function setSliderAndColorControl(idx, applyDef=false) function setEffectParameters(idx, applyDef=false)
{ {
if (!(Array.isArray(fxdata) && fxdata.length>idx)) return; if (!(Array.isArray(fxdata) && fxdata.length>idx)) return;
var controlDefined = (fxdata[idx].substr(0,1) == "@"); var controlDefined = (fxdata[idx].substr(0,1) == "@");
var extra = fxdata[idx].substr(1); var effectPar = fxdata[idx].substr(1);
var extras = (extra == '')?[]:extra.split(";"); var effectPars = (effectPar == '')?[]:effectPar.split(";");
var slOnOff = (extras.length==0 || extras[0]=='')?[]:extras[0].split(","); var slOnOff = (effectPars.length==0 || effectPars[0]=='')?[]:effectPars[0].split(",");
var coOnOff = (extras.length<2 || extras[1]=='')?[]:extras[1].split(","); var coOnOff = (effectPars.length<2 || effectPars[1]=='')?[]:effectPars[1].split(",");
var paOnOff = (extras.length<3 || extras[2]=='')?[]:extras[2].split(","); var paOnOff = (effectPars.length<3 || effectPars[2]=='')?[]:effectPars[2].split(",");
var obj = {"seg":{}}; // var obj = {"seg":{}};
var obj = {"seg": {"rev": false, "rY": false}};
//assign extra parameters to segment
for (let i=3;i<effectPars.length;i++) {
let keyval = effectPars[i].split("=");
obj.seg[keyval[0]] = keyval[1]=="true"?true:keyval[1]=="false"?false:keyval[1];
}
// set html slider items on/off // set html slider items on/off
var nSliders = Math.min(5,Math.floor(gId("sliders").children.length)); // div for each slider var nSliders = Math.min(5,Math.floor(gId("sliders").children.length)); // div for each slider

File diff suppressed because it is too large Load Diff