-
White balance
+
@@ -310,7 +315,7 @@
-
Transition: s
+
Transition: s
diff --git a/wled00/data/index.js b/wled00/data/index.js
index 68a66e3e..32b52279 100644
--- a/wled00/data/index.js
+++ b/wled00/data/index.js
@@ -4,6 +4,7 @@ var isOn = false, nlA = false, isLv = false, isInfo = false, isNodes = false, sy
var hasWhite = false, hasRGB = false, hasCCT = false;
var nlDur = 60, nlTar = 0;
var nlMode = false;
+var segLmax = 0; // size (in pixels) of largest selected segment
var selectedFx = 0;
var selectedPal = 0;
var csel = 0; // selected color slot (0-2)
@@ -60,13 +61,10 @@ function setCSL(cs)
let w = cs.dataset.w ? parseInt(cs.dataset.w) : 0;
let hasShadow = getComputedStyle(cs).textShadow !== "none";
if (hasRGB && !isRgbBlack(cs.dataset)) {
- cs.style.backgroundColor = rgbStr(cs.dataset);
if (!hasShadow) cs.style.color = rgbBri(cs.dataset) > 127 ? "#000":"#fff"; // if text has no CSS "shadow"
- if (hasWhite && w > 0) {
- cs.style.background = `linear-gradient(180deg, ${rgbStr(cs.dataset)} 30%, rgb(${w},${w},${w}))`;
- }
+ cs.style.background = (hasWhite && w > 0) ? `linear-gradient(180deg, ${rgbStr(cs.dataset)} 30%, rgb(${w},${w},${w}))` : rgbStr(cs.dataset);
} else {
- if (!hasWhite) w = 0;
+ if (hasRGB && !hasWhite) w = 0;
cs.style.background = `rgb(${w},${w},${w})`;
if (!hasShadow) cs.style.color = w > 127 ? "#000":"#fff";
}
@@ -713,7 +711,7 @@ function populateSegments(s)
let rvXck = `
`;
let miXck = `
`;
let rvYck = "", miYck ="";
- if (isM) {
+ if (isM && staX
Reverse`;
miYck = ``;
}
@@ -746,42 +744,43 @@ function populateSegments(s)
${cfg.comp.segpwr?segp:''}
-
+
- ${!isM?rvXck:''}
- ${isM&&stoY-staY>1&&stoX-staX>1?map2D:''}
+ ${!(isM&&staX
1&&stoX-staX>1?map2D:''}
${s.AudioReactive && s.AudioReactive.on ? "" : sndSim}
@@ -800,16 +799,19 @@ function populateSegments(s)
for (var i = 0; i <= lSeg; i++) {
updateLen(i);
updateTrail(gId(`seg${i}bri`));
- gId(`segr${i}`).style.display = "none";
+ gId(`segr${i}`).classList.add("hide");
if (!gId(`seg${i}sel`).checked && gId('selall')) gId('selall').checked = false; // uncheck if at least one is unselected.
}
- if (segCount < 2) gId(`segd${lSeg}`).style.display = "none";
+ if (segCount < 2) {
+ gId(`segd${lSeg}`).classList.add("hide");
+ gId(`segp0`).classList.add("hide");
+ }
if (!isM && !noNewSegs && (cfg.comp.seglen?parseInt(gId(`seg${lSeg}s`).value):0)+parseInt(gId(`seg${lSeg}e`).value) 1) ? "block":"none"; // rsbtn parent
- if (!isM && Array.isArray(li.maps) && li.maps.length>1) {
+ if (Array.isArray(li.maps) && li.maps.length>1) {
let cont = `Ledmap:
";
gId("ledmap").innerHTML = cont;
gId("ledmap").classList.remove('hide');
@@ -851,6 +853,7 @@ function populateEffects()
let m = (eP.length<4 || eP[3]==='')?'1':eP[3]; // flags
if (id == 0) m = ''; // solid has no flags
if (m.length>0) {
+ if (m.includes('0')) nm += "•"; // 0D effects (PWM & On/Off)
if (m.includes('1')) nm += "⋮"; // 1D effects
if (m.includes('2')) nm += "▦"; // 2D effects
if (m.includes('v')) nm += "♪"; // volume effects
@@ -1049,29 +1052,50 @@ function updateLen(s)
var start = parseInt(gId(`seg${s}s`).value);
var stop = parseInt(gId(`seg${s}e`).value) + (cfg.comp.seglen?start:0);
var len = stop - start;
+ let sY = gId(`seg${s}sY`);
+ let eY = gId(`seg${s}eY`);
+ let sX = gId(`seg${s}s`);
+ let eX = gId(`seg${s}e`);
+ let of = gId(`seg${s}of`);
+ let mySH = gId("mkSYH");
+ let mySD = gId("mkSYD");
if (isM) {
- // matrix setup
- let startY = parseInt(gId(`seg${s}sY`).value);
- let stopY = parseInt(gId(`seg${s}eY`).value) + (cfg.comp.seglen?startY:0);
- len *= (stopY-startY);
- let tPL = gId(`seg${s}lbtm`);
- if (stop-start>1 && stopY-startY>1) {
- // 2D segment
- if (tPL) tPL.classList.remove('hide'); // unhide transpose checkbox
- let sE = gId('fxlist').querySelector(`.lstI[data-id="${selectedFx}"]`);
- if (sE) {
- let sN = sE.querySelector(".lstIname").innerText;
- let seg = gId(`seg${s}map2D`);
- if (seg) {
- if(sN.indexOf("\u25A6")<0) seg.classList.remove('hide'); // unhide mapping for 1D effects (| in name)
- else seg.classList.add('hide'); // hide mapping otherwise
- }
- }
+ // do we have 1D segment *after* the matrix?
+ if (start >= mw*mh) {
+ if (sY) { sY.value = 0; sY.max = 0; sY.min = 0; }
+ if (eY) { eY.value = 1; eY.max = 1; eY.min = 0; }
+ sX.min = mw*mh; sX.max = ledCount-1;
+ eX.min = mw*mh+1; eX.max = ledCount;
+ if (mySH) mySH.classList.add("hide");
+ if (mySD) mySD.classList.add("hide");
+ if (of) of.classList.remove("hide");
} else {
- // 1D segment in 2D set-up
- if (tPL) {
- tPL.classList.add('hide'); // hide transpose checkbox
- gId(`seg${s}tp`).checked = false; // and uncheck it
+ // matrix setup
+ if (mySH) mySH.classList.remove("hide");
+ if (mySD) mySD.classList.remove("hide");
+ if (of) of.classList.add("hide");
+ let startY = parseInt(sY.value);
+ let stopY = parseInt(eY.value) + (cfg.comp.seglen?startY:0);
+ len *= (stopY-startY);
+ let tPL = gId(`seg${s}lbtm`);
+ if (stop-start>1 && stopY-startY>1) {
+ // 2D segment
+ if (tPL) tPL.classList.remove('hide'); // unhide transpose checkbox
+ let sE = gId('fxlist').querySelector(`.lstI[data-id="${selectedFx}"]`);
+ if (sE) {
+ let sN = sE.querySelector(".lstIname").innerText;
+ let seg = gId(`seg${s}map2D`);
+ if (seg) {
+ if(sN.indexOf("\u25A6")<0) seg.classList.remove('hide'); // unhide mapping for 1D effects (| in name)
+ else seg.classList.add('hide'); // hide mapping otherwise
+ }
+ }
+ } else {
+ // 1D segment in 2D set-up
+ if (tPL) {
+ tPL.classList.add('hide'); // hide transpose checkbox
+ gId(`seg${s}tp`).checked = false; // and uncheck it
+ }
}
}
}
@@ -1090,6 +1114,7 @@ function updateLen(s)
var virt = Math.ceil(len/(grp + spc));
if (!isNaN(virt) && (grp > 1 || spc > 0)) out += ` (${virt} virtual)`;
}
+ if (isM && start >= mw*mh) out += " [strip]";
gId(`seg${s}len`).innerHTML = out;
}
@@ -1142,18 +1167,19 @@ function updateUI()
}
if (hasWhite) updateTrail(gId('sliderW'));
- gId('wwrap').style.display = (hasWhite) ? "block":"none"; // white channel
- gId('wbal').style.display = (hasCCT) ? "block":"none"; // white balance
var ccfg = cfg.comp.colors;
- gId('hexw').style.display = ccfg.hex ? "block":"none"; // HEX input
- gId('picker').style.display = (hasRGB && ccfg.picker) ? "block":"none"; // color picker wheel
- gId('hwrap').style.display = (hasRGB && !ccfg.picker) ? "block":"none"; // color picker wheel
- gId('swrap').style.display = (hasRGB && !ccfg.picker) ? "block":"none"; // color picker wheel
- gId('vwrap').style.display = (hasRGB /*&& ccfg.picker*/) ? "block":"none"; // brightness (value) slider
- gId('kwrap').style.display = (hasRGB && !hasCCT /*&& ccfg.picker*/) ? "block":"none"; // Kelvin slider
- gId('rgbwrap').style.display = (hasRGB && ccfg.rgb) ? "block":"none"; // RGB sliders
- gId('qcs-w').style.display = (hasRGB && ccfg.quick) ? "block":"none"; // quick selection
- //gId('palw').style.display = hasRGB ? "block":"none"; // palettes
+ gId('wwrap').style.display = (hasWhite) ? "block":"none"; // white channel
+ gId('wbal').style.display = (hasCCT) ? "block":"none"; // white balance
+ gId('hexw').style.display = (ccfg.hex) ? "block":"none"; // HEX input
+ gId('picker').style.display = (hasRGB && ccfg.picker) ? "block":"none"; // color picker wheel
+ gId('hwrap').style.display = (hasRGB && !ccfg.picker) ? "block":"none"; // hue slider
+ gId('swrap').style.display = (hasRGB && !ccfg.picker) ? "block":"none"; // saturation slider
+ gId('vwrap').style.display = (hasRGB) ? "block":"none"; // brightness (value) slider
+ gId('kwrap').style.display = (hasRGB && !hasCCT) ? "block":"none"; // Kelvin slider
+ gId('rgbwrap').style.display = (hasRGB && ccfg.rgb) ? "block":"none"; // RGB sliders
+ gId('qcs-w').style.display = (hasRGB && ccfg.quick) ? "block":"none"; // quick selection
+ //gId('csl').style.display = (hasRGB || hasWhite) ? "block":"none"; // color selectors (hide for On/Off bus)
+ //gId('palw').style.display = (hasRGB) ? "inline-block":"none"; // palettes are shown/hidden in setEffectParameters()
updatePA();
updatePSliders();
@@ -1198,7 +1224,19 @@ function updateSelectedFx()
if (selectedEffect) {
selectedEffect.classList.add('selected');
setEffectParameters(selectedFx);
-
+ // hide non-0D effects if segment only has 1 pixel (0D)
+ var fxs = parent.querySelectorAll('.lstI');
+ for (const fx of fxs) {
+ let opts = fx.dataset.opt.split(";");
+ if (fx.dataset.id>0) {
+ if (segLmax==0) fx.classList.add('hide'); // none of the segments selected (hide all effects)
+ else {
+ if (segLmax==1 && (!opts[3] || opts[3].indexOf("0")<0)) fx.classList.add('hide');
+ else fx.classList.remove('hide');
+ }
+ }
+ }
+ // hide 2D mapping and/or sound simulation options
var selectedName = selectedEffect.querySelector(".lstIname").innerText;
var segs = gId("segcont").querySelectorAll(`div[data-map="map2D"]`);
for (const seg of segs) if (selectedName.indexOf("\u25A6")<0) seg.classList.remove('hide'); else seg.classList.add('hide');
@@ -1285,6 +1323,7 @@ function readState(s,command=false)
var selc=0;
var sellvl=0; // 0: selc is invalid, 1: selc is mainseg, 2: selc is first selected
hasRGB = hasWhite = hasCCT = false;
+ segLmax = 0;
for (let i = 0; i < (s.seg||[]).length; i++)
{
if (sellvl == 0 && s.seg[i].id == s.mainseg) {
@@ -1296,15 +1335,17 @@ function readState(s,command=false)
sellvl = 2;
var lc = lastinfo.leds.seglc[s.seg[i].id];
hasRGB |= !!(lc & 0x01);
- hasWhite |= !!(lc & 0x08); // & 0x02 contains W channel
+ hasWhite |= !!(lc & 0x02);
hasCCT |= !!(lc & 0x04);
+ let sLen = (s.seg[i].stop - s.seg[i].start)*(s.seg[i].stopY?(s.seg[i].stopY - s.seg[i].startY):1);
+ segLmax = segLmax < sLen ? sLen : segLmax;
}
}
var i=s.seg[selc];
if (sellvl == 1) {
var lc = lastinfo.leds.seglc[i.id];
hasRGB = !!(lc & 0x01);
- hasWhite = !!(lc & 0x08); // & 0x02 contains W channel
+ hasWhite = !!(lc & 0x02);
hasCCT = !!(lc & 0x04);
}
if (!i) {
@@ -1318,7 +1359,7 @@ function readState(s,command=false)
cd[e].dataset.r = i.col[e][0];
cd[e].dataset.g = i.col[e][1];
cd[e].dataset.b = i.col[e][2];
- if (hasWhite) { cd[e].dataset.w = i.col[e][3]; }
+ if (hasWhite || (!hasRGB && !hasWhite)) { cd[e].dataset.w = i.col[e][3]; }
setCSL(cd[e]);
}
selectSlot(csel);
@@ -1470,8 +1511,8 @@ function setEffectParameters(idx)
var palw = gId("palw"); // wrapper
var pall = gId("pall"); // label
// if not controlDefined or palette has a value
- if ((!controlDefined) || (paOnOff.length>0 && paOnOff[0]!="" && isNaN(paOnOff[0]))) {
- palw.style.display = hasRGB ? "inline-block" : "none";
+ if (hasRGB && ((!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("=");
@@ -1681,22 +1722,22 @@ function makeSeg()
});
var cn = `
-
+
${ledCount - ns} LEDs
@@ -1820,7 +1861,7 @@ function makeP(i,pl)
-
Repeat 0?rep:1}> times
+
Repeat 0?rep:1}> times
End preset: