Default values for effects.
Moved mode names to FX_fcn.cpp
This commit is contained in:
parent
78006855ee
commit
5a3d3b0324
17
wled00/FX.h
17
wled00/FX.h
@ -927,6 +927,11 @@ class WS2812FX {
|
||||
transitionProgress(uint8_t tNr);
|
||||
};
|
||||
|
||||
extern const char JSON_mode_names[];
|
||||
extern const char JSON_palette_names[];
|
||||
|
||||
// the following has been moved to FX_fcn.cpp instead
|
||||
/*
|
||||
// WLEDSR: extensions
|
||||
// Technical notes
|
||||
// ===============
|
||||
@ -1014,9 +1019,9 @@ const char JSON_mode_names[] PROGMEM = R"=====([
|
||||
"Stream 2",
|
||||
"Oscillate",
|
||||
"Pride 2015",
|
||||
"Juggle@!,Trail;!,!,;!",
|
||||
"Juggle@!=16,Trail=240;!,!,;!",
|
||||
"Palette@!,;;!",
|
||||
"Fire 2012@Spark rate,Decay;;!",
|
||||
"Fire 2012@Spark rate=120,Decay=64;;!",
|
||||
"Colorwaves",
|
||||
"Bpm",
|
||||
"Fill Noise",
|
||||
@ -1038,7 +1043,7 @@ const char JSON_mode_names[] PROGMEM = R"=====([
|
||||
"Spots@Spread,Width;!,!,;!",
|
||||
"Spots Fade@Spread,Width;!,!,;!",
|
||||
"Glitter",
|
||||
"Candle@Flicker rate,Flicker intensity;!,!,;0",
|
||||
"Candle@Flicker rate=96,Flicker intensity=224;!,!,;0",
|
||||
"Fireworks Starburst",
|
||||
"Fireworks 1D@Gravity,Firing side;!,!,;!",
|
||||
"Bouncing Balls@Gravity,# of balls;!,!,;!",
|
||||
@ -1052,9 +1057,9 @@ const char JSON_mode_names[] PROGMEM = R"=====([
|
||||
"Ripple Rainbow",
|
||||
"Heartbeat",
|
||||
"Pacifica",
|
||||
"Candle Multi@Flicker rate,Flicker intensity;!,!,;0",
|
||||
"Candle Multi@Flicker rate=96,Flicker intensity=224;!,!,;0",
|
||||
"Solid Glitter@,!;!,,;0",
|
||||
"Sunrise@Time [min],;;0",
|
||||
"Sunrise@Time [min]=60,;;0",
|
||||
"Phased",
|
||||
"Twinkleup@!,Intensity;!,!,;!",
|
||||
"Noise Pal",
|
||||
@ -1081,5 +1086,5 @@ const char JSON_palette_names[] PROGMEM = R"=====([
|
||||
"Semi Blue","Pink Candy","Red Reaf","Aqua Flash","Yelblu Hot","Lite Light","Red Flash","Blink Red","Red Shift","Red Tide",
|
||||
"Candy2"
|
||||
])=====";
|
||||
|
||||
*/
|
||||
#endif
|
||||
|
@ -1218,4 +1218,159 @@ WS2812FX* WS2812FX::instance = nullptr;
|
||||
//Bus static member definition, would belong in bus_manager.cpp
|
||||
int16_t Bus::_cct = -1;
|
||||
uint8_t Bus::_cctBlend = 0;
|
||||
uint8_t Bus::_autoWhiteMode = RGBW_MODE_DUAL;
|
||||
uint8_t Bus::_autoWhiteMode = RGBW_MODE_DUAL;
|
||||
|
||||
|
||||
// WLEDSR: extensions
|
||||
// Technical notes
|
||||
// ===============
|
||||
// If an effect name is followed by an @, slider and color control is effective.
|
||||
// See setSliderAndColorControl in index.js for implementation
|
||||
// If not effective then:
|
||||
// - 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
|
||||
// If effective (@)
|
||||
// - a ; seperates slider controls (left) from color controls (middle) and palette control (right)
|
||||
// - if left, middle or right is empty no controls are shown
|
||||
// - a , seperates slider controls (max 5) or color controls (max 3). Palette has only one value
|
||||
// - a ! means that the default is used.
|
||||
// - For sliders: Effect speeds, Effect intensity, Custom 1, Custom 2, Custom 3
|
||||
// - For colors: Fx color, Background color, Custom
|
||||
// - For palette: prompt for color palette OR palette ID if numeric (will hide palette selection)
|
||||
//
|
||||
// Note: If palette is on and no colors are specified 1,2 and 3 is shown in each color circle.
|
||||
// If a color is specified, the 1,2 or 3 is replaced by that specification.
|
||||
// Note: Effects can override default pattern behaviour
|
||||
// - FadeToBlack can override the background setting
|
||||
// - Defining SEGCOL(<i>) can override a specific palette using these values (e.g. Color Gradient)
|
||||
const char JSON_mode_names[] PROGMEM = R"=====([
|
||||
"Solid",
|
||||
"Blink@!,;!,!,;!",
|
||||
"Breathe@!,;!,!;!",
|
||||
"Wipe@!,!;!,!,;!",
|
||||
"Wipe Random@!,;;!",
|
||||
"Random Colors@!,Fade time;;!",
|
||||
"Sweep@!,!;!,!,;!",
|
||||
"Dynamic",
|
||||
"Colorloop@!,Saturation;;!",
|
||||
"Rainbow",
|
||||
"Scan@!,# of dots;!,!,;!",
|
||||
"Scan Dual@!,# of dots;!,!,;!",
|
||||
"Fade",
|
||||
"Theater@!,Gap size;!,!,;!",
|
||||
"Theater Rainbow",
|
||||
"Running@!,Wave width;!,!,;!",
|
||||
"Saw@!,Width;!,!,;!",
|
||||
"Twinkle",
|
||||
"Dissolve",
|
||||
"Dissolve Rnd",
|
||||
"Sparkle",
|
||||
"Sparkle Dark",
|
||||
"Sparkle+",
|
||||
"Strobe",
|
||||
"Strobe Rainbow",
|
||||
"Strobe Mega",
|
||||
"Blink Rainbow",
|
||||
"Android",
|
||||
"Chase",
|
||||
"Chase Random",
|
||||
"Chase Rainbow",
|
||||
"Chase Flash",
|
||||
"Chase Flash Rnd",
|
||||
"Rainbow Runner",
|
||||
"Colorful",
|
||||
"Traffic Light",
|
||||
"Sweep Random",
|
||||
"Chase 2@!,Width;!,!,;!",
|
||||
"Aurora",
|
||||
"Stream",
|
||||
"Scanner",
|
||||
"Lighthouse",
|
||||
"Fireworks",
|
||||
"Rain",
|
||||
"Tetrix@!,Width;!,!,;!",
|
||||
"Fire Flicker",
|
||||
"Gradient",
|
||||
"Loading",
|
||||
"Police@!,Width;;0",
|
||||
"Fairy",
|
||||
"Two Dots@!,Dot size;1,2,Bg;!",
|
||||
"Fairy Twinkle",
|
||||
"Running Dual",
|
||||
"Halloween",
|
||||
"Chase 3@!,Size;1,2,3;0",
|
||||
"Tri Wipe@!,Width;1,2,3;0",
|
||||
"Tri Fade",
|
||||
"Lightning",
|
||||
"ICU",
|
||||
"Multi Comet",
|
||||
"Scanner Dual",
|
||||
"Stream 2",
|
||||
"Oscillate",
|
||||
"Pride 2015",
|
||||
"Juggle@!=16,Trail=240;!,!,;!",
|
||||
"Palette@!,;;!",
|
||||
"Fire 2012@Spark rate=120,Decay=64;;!",
|
||||
"Colorwaves",
|
||||
"Bpm",
|
||||
"Fill Noise",
|
||||
"Noise 1",
|
||||
"Noise 2",
|
||||
"Noise 3",
|
||||
"Noise 4",
|
||||
"Colortwinkles",
|
||||
"Lake",
|
||||
"Meteor@!,Trail length;!,!,;!",
|
||||
"Meteor Smooth@!,Trail length;!,!,;!",
|
||||
"Railway",
|
||||
"Ripple",
|
||||
"Twinklefox",
|
||||
"Twinklecat",
|
||||
"Halloween Eyes",
|
||||
"Solid Pattern@Fg size,Bg size;Fg,Bg,;0",
|
||||
"Solid Pattern Tri@,Size;1,2,3;0",
|
||||
"Spots@Spread,Width;!,!,;!",
|
||||
"Spots Fade@Spread,Width;!,!,;!",
|
||||
"Glitter",
|
||||
"Candle@Flicker rate=96,Flicker intensity=224;!,!,;0",
|
||||
"Fireworks Starburst",
|
||||
"Fireworks 1D@Gravity,Firing side;!,!,;!",
|
||||
"Bouncing Balls@Gravity,# of balls;!,!,;!",
|
||||
"Sinelon",
|
||||
"Sinelon Dual",
|
||||
"Sinelon Rainbow",
|
||||
"Popcorn@",
|
||||
"Drip@Gravity,# of drips;!,!;!",
|
||||
"Plasma@Phase,;1,2,3;!",
|
||||
"Percent@,% of fill;!,!,;!",
|
||||
"Ripple Rainbow",
|
||||
"Heartbeat",
|
||||
"Pacifica",
|
||||
"Candle Multi@Flicker rate=96,Flicker intensity=224;!,!,;0",
|
||||
"Solid Glitter@,!;!,,;0",
|
||||
"Sunrise@Time [min]=60,;;0",
|
||||
"Phased",
|
||||
"Twinkleup@!,Intensity;!,!,;!",
|
||||
"Noise Pal",
|
||||
"Sine",
|
||||
"Phased Noise",
|
||||
"Flow",
|
||||
"Chunchun@!,Gap size;!,!,;!",
|
||||
"Dancing Shadows",
|
||||
"Washing Machine",
|
||||
"Candy Cane",
|
||||
"Blends",
|
||||
"TV Simulator",
|
||||
"Dynamic Smooth"
|
||||
])=====";
|
||||
|
||||
const char JSON_palette_names[] PROGMEM = R"=====([
|
||||
"Default","* Random Cycle","* Color 1","* Colors 1&2","* Color Gradient","* Colors Only","Party","Cloud","Lava","Ocean",
|
||||
"Forest","Rainbow","Rainbow Bands","Sunset","Rivendell","Breeze","Red & Blue","Yellowout","Analogous","Splash",
|
||||
"Pastel","Sunset 2","Beech","Vintage","Departure","Landscape","Beach","Sherbet","Hult","Hult 64",
|
||||
"Drywet","Jul","Grintage","Rewhi","Tertiary","Fire","Icefire","Cyane","Light Pink","Autumn",
|
||||
"Magenta","Magred","Yelmag","Yelblu","Orange & Teal","Tiamat","April Night","Orangery","C9","Sakura",
|
||||
"Aurora","Atlantica","C9 2","C9 New","Temperature","Aurora 2","Retro Clown","Candy","Toxy Reaf","Fairy Reaf",
|
||||
"Semi Blue","Pink Candy","Red Reaf","Aqua Flash","Yelblu Hot","Lite Light","Red Flash","Blink Red","Red Shift","Red Tide",
|
||||
"Candy2"
|
||||
])=====";
|
||||
|
@ -8,7 +8,7 @@ var expanded = [false];
|
||||
var powered = [true];
|
||||
var nlDur = 60, nlTar = 0;
|
||||
var nlMode = false;
|
||||
var selectedFx = 0;
|
||||
var selectedFx = 0, prevFx = -1;
|
||||
var selectedPal = 0;
|
||||
var sliderControl = ""; //WLEDSR: used by togglePcMode
|
||||
var csel = 0;
|
||||
@ -1043,7 +1043,10 @@ function updateSelectedFx()
|
||||
if (selEffectInput) selEffectInput.checked = true;
|
||||
|
||||
var selElement = parent.querySelector('.selected');
|
||||
if (selElement) selElement.classList.remove('selected');
|
||||
if (selElement) {
|
||||
if (parseInt(selElement.dataset.id) == prevFx) return; //already selected
|
||||
selElement.classList.remove('selected');
|
||||
}
|
||||
|
||||
var selectedEffect = parent.querySelector(`.lstI[data-id="${selectedFx}"]`);
|
||||
if (selectedEffect) {
|
||||
@ -1178,6 +1181,7 @@ function readState(s,command=false)
|
||||
showToast('Error ' + s.error + ": " + errstr, true);
|
||||
}
|
||||
|
||||
prevFx = selectedFx;
|
||||
selectedPal = i.pal;
|
||||
selectedFx = i.fx;
|
||||
redrawPalPrev(); // if any color changed (random palette did at least)
|
||||
@ -1185,6 +1189,26 @@ function readState(s,command=false)
|
||||
}
|
||||
|
||||
// WLEDSR: control HTML elements for Slider and Color Control
|
||||
// Technical notes
|
||||
// ===============
|
||||
// If an effect name is followed by an @, slider and color control is effective.
|
||||
// If not effective then:
|
||||
// - 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
|
||||
// If effective (@)
|
||||
// - a ; seperates slider controls (left) from color controls (middle) and palette control (right)
|
||||
// - if left, middle or right is empty no controls are shown
|
||||
// - a , seperates slider controls (max 5) or color controls (max 3). Palette has only one value
|
||||
// - a ! means that the default is used.
|
||||
// - For sliders: Effect speeds, Effect intensity, Custom 1, Custom 2, Custom 3
|
||||
// - For colors: Fx color, Background color, Custom
|
||||
// - For palette: prompt for color palette OR palette ID if numeric (will hide palette selection)
|
||||
//
|
||||
// Note: If palette is on and no colors are specified 1,2 and 3 is shown in each color circle.
|
||||
// If a color is specified, the 1,2 or 3 is replaced by that specification.
|
||||
// Note: Effects can override default pattern behaviour
|
||||
// - FadeToBlack can override the background setting
|
||||
// - Defining SEGCOL(<i>) can override a specific palette using these values (e.g. Color Gradient)
|
||||
function setSliderAndColorControl(idx)
|
||||
{
|
||||
if (!(Array.isArray(fxdata) && fxdata.length>idx)) return;
|
||||
@ -1195,15 +1219,25 @@ function setSliderAndColorControl(idx)
|
||||
var slOnOff = (extras.length==0 || extras[0]=='')?[]:extras[0].split(",");
|
||||
var coOnOff = (extras.length<2 || extras[1]=='')?[]:extras[1].split(",");
|
||||
var paOnOff = (extras.length<3 || extras[2]=='')?[]:extras[2].split(",");
|
||||
var obj = {"seg":{}};
|
||||
|
||||
// set html slider items on/off
|
||||
var nSliders = Math.floor((gId("Effects").children.length - 1) / 2); // p (label) & div for each slider + FX list
|
||||
var nSliders = Math.min(5,Math.floor((gId("Effects").children.length - 1) / 2)); // p (label) & div for each slider + FX list
|
||||
for (let i=0; i<nSliders; i++) {
|
||||
var slider = gId("slider" + i);
|
||||
var label = gId("sliderLabel" + i);
|
||||
// if (not controlDefined and for AC speed or intensity and for SR alle sliders) or slider has a value
|
||||
if ((!controlDefined && i < ((idx<128)?2:nSliders)) || (slOnOff.length>i && slOnOff[i] != "")) {
|
||||
label.style.display = "block";
|
||||
if (slOnOff.length>i && slOnOff[i].indexOf("=")>0) {
|
||||
//embeded default values
|
||||
var dPos = slOnOff[i].indexOf("=");
|
||||
var v = Math.max(0,Math.min(255,parseInt(slOnOff[i].substr(dPos+1))));
|
||||
if (i==0) { gId("sliderSpeed").value = v; obj.seg.sx = v; }
|
||||
else if (i==1) { gId("sliderIntensity").value = v; obj.seg.ix = v; }
|
||||
else { gId("sliderC"+(i-1)).value = v; obj.seg["C"+(i-1)] = v}
|
||||
slOnOff[i] = slOnOff[i].substring(0,dPos-1);
|
||||
}
|
||||
if (slOnOff.length>i && slOnOff[i]!="!") label.innerHTML = slOnOff[i];
|
||||
else if (i==0) label.innerHTML = "Effect speed";
|
||||
else if (i==1) label.innerHTML = "Effect intensity";
|
||||
@ -1266,17 +1300,6 @@ function setSliderAndColorControl(idx)
|
||||
if (i>0 && csel==i) selectSlot(0);
|
||||
}
|
||||
}
|
||||
/*
|
||||
// perhaps too aggressive
|
||||
var ccfg = cfg.comp.colors;
|
||||
gId("picker").style.display = hide && ccfg.picker ? "none" : "block";
|
||||
gId("vwrap").style.display = hide && ccfg.picker ? "none" : "block";
|
||||
gId("kwrap").style.display = hide && ccfg.picker && cct ? "none" : "block";
|
||||
gId("wwrap").style.display = hide ? "none" : "block";
|
||||
gId("wbal").style.display = hide && !cct ? "none" : "block";
|
||||
gId("rgbwrap").style.display = hide && ccfg.rgb ? "none" : "block";
|
||||
gId("qcs-w").style.display = hide && ccfg.quick ? "none" : "block";
|
||||
*/
|
||||
gId("cslLabel").innerHTML = cslLabel;
|
||||
|
||||
// set palette on/off
|
||||
@ -1285,14 +1308,26 @@ function setSliderAndColorControl(idx)
|
||||
// if not controlDefined or palette has a value
|
||||
if ((!controlDefined) || (paOnOff.length>0 && paOnOff[0]!="" && isNaN(paOnOff[0]))) {
|
||||
palw.style.display = "inline-block";
|
||||
if (paOnOff.length>0 && paOnOff[0].indexOf("=")>0) {
|
||||
//embeded default values
|
||||
var dPos = paOnOff[0].indexOf("=");
|
||||
var v = Math.max(0,Math.min(255,parseInt(paOnOff[0].substr(dPos+1))));
|
||||
var p = d.querySelector(`#pallist input[name="palette"][value="${v}"]`);
|
||||
if (p) {
|
||||
p.checked = true;
|
||||
obj.seg.pal = v;
|
||||
}
|
||||
paOnOff[0] = paOnOff[0].substring(0,dPos-1);
|
||||
}
|
||||
if (paOnOff.length>0 && paOnOff[0] != "!") pall.innerHTML = paOnOff[0];
|
||||
else pall.innerHTML = '<i class="icons sel-icon" onclick="tglHex()"></i> Color palette';
|
||||
} else {
|
||||
// disable label and slider
|
||||
palw.style.display = "none";
|
||||
// if numeric set as selected palette
|
||||
if (paOnOff.length>0 && paOnOff[0]!="" && !isNaN(paOnOff[0]) && parseInt(paOnOff[0])!=selectedPal) setPalette(parseInt(paOnOff[0]));
|
||||
if (paOnOff.length>0 && paOnOff[0]!="" && !isNaN(paOnOff[0]) && parseInt(paOnOff[0])!=selectedPal) obj.seg.pal = parseInt(paOnOff[0]);
|
||||
}
|
||||
if (!isEmpty(obj.seg)) requestJson(obj); //update default values (may need throttling on ESP8266)
|
||||
}
|
||||
|
||||
var jsonTimeout;
|
||||
|
1827
wled00/html_ui.h
1827
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user