@@ -220,20 +220,30 @@ function GetOrientationInput(currentValue, attr) {
220220 return str;
221221 }
222222
223- function GetColorOrderSelect(currentValue, attr) {
224- var options = [
225- "RGB", "RBG", "GRB", "GBR", "BRG", "BGR",
226- "RGBW", "RBGW", "GRBW", "GBRW", "BRGW", "BGRW"
227- ];
228- if (!currentValue) currentValue = "RGB";
229- var str = "<select class='colorOrder'" + attr + ">";
223+ // 1, 3 and 4 are the node widths FPP's outputs actually produce - a plain
224+ // 1-4 spinner also offers 2, which no output can drive and which silently
225+ // discards the blue channel. A width already saved in the config is kept
226+ // as an extra choice rather than quietly rewritten.
227+ function GetChannelsPerNodeInput(currentValue, attr) {
228+ var options = [1, 3, 4];
229+ var current = parseInt(currentValue);
230+ if (isNaN(current) || current < 1) {
231+ current = 3;
232+ }
233+ if (options.indexOf(current) == -1) {
234+ options.push(current);
235+ options.sort(function (a, b) { return a - b; });
236+ }
237+
238+ var str = "<select class='form-select cpn'" + attr + ">";
230239 for (var i = 0; i < options.length; i++) {
231240 str += "<option value='" + options[i] + "'";
232- if (currentValue == options[i])
241+ if (current == options[i])
233242 str += " selected";
234243 str += ">" + options[i] + "</option>";
235244 }
236245 str += "</select>";
246+
237247 return str;
238248 }
239249
@@ -334,12 +344,10 @@ function PopulateChannelMemMapTable(data) {
334344
335345 switch (model.Type) {
336346 case "Channel":
337- var colorOrder = model.ColorOrder || "RGB";
338347 postr += "<td><span class='hidden type'>" + model.Type + "</span>" + model.Type + "</td>" +
339348 "<td><input class='start' type='text' size='6' maxlength='6' value='" + model.StartChannel + "'" + attr + "></td>" +
340349 "<td><input class='cnt' type='text' size='6' maxlength='6' value='" + model.ChannelCount + "'" + attr + "></td>" +
341- "<td><input class='cpn' type='number' min='1' max='4' value='" + ChannelCountPerNode + "'" + attr + "></td>" +
342- "<td>" + GetColorOrderSelect(colorOrder, attr) + "</td>" +
350+ "<td>" + GetChannelsPerNodeInput(ChannelCountPerNode, attr) + "</td>" +
343351 "<td style=\"white-space: nowrap;\">" + GetOrientationInput(model.Orientation + orientationDetails(model), attr) + "</td>";
344352 if (model.Orientation != "custom") {
345353 postr += "<td>" + GetStartingCornerInput(model.StartCorner, attr) + "</td>" +
@@ -350,13 +358,21 @@ function PopulateChannelMemMapTable(data) {
350358 "<td><input class='strcnt' type='hidden' value='" + model.StringCount + "'></td>" +
351359 "<td><input class='strands' type='hidden' value='" + model.StrandsPerString + "'></td>";
352360 }
353- var xlchecked = "";
354- if (model.xLights) {
355- xlchecked = " checked";
356- }
357- postr += "<td><input class='xlights' type='checkbox'" + xlchecked + " disabled>";
358- if (model.xLights) {
359- postr += " <i class='fas fa-eye' style='cursor:pointer; color:#5bc0de;' title='Preview model layout' onclick='showModelPreview(" + JSON.stringify(model.Name) + ")'></i>";
361+ // This column is headed "xLights Generated" on the editable
362+ // table and "Submodels" on the auto created one. The checkbox
363+ // is meaningless for an auto created model - it is never an
364+ // xLights import - but the submodel expander still applies, so
365+ // the cell is always emitted and only its contents differ.
366+ postr += "<td>";
367+ if (!model.autoCreated) {
368+ var xlchecked = "";
369+ if (model.xLights) {
370+ xlchecked = " checked";
371+ }
372+ postr += "<input class='xlights' type='checkbox'" + xlchecked + " disabled>";
373+ if (model.xLights) {
374+ postr += " <i class='fas fa-eye' style='cursor:pointer; color:#5bc0de;' title='Preview model layout' onclick='showModelPreview(" + JSON.stringify(model.Name) + ")'></i>";
375+ }
360376 }
361377 var subModels = getSubModels(model.Name);
362378 if (subModels && subModels.length > 0) {
@@ -579,8 +595,7 @@ function SetChannelMemMaps() {
579595 model.StartCorner = $this.find("select.corner").val();
580596 model.StringCount = parseInt($this.find("input.strcnt").val());
581597 model.StrandsPerString = parseInt($this.find("input.strands").val());
582- model.ChannelCountPerNode = parseInt($this.find("input.cpn").val());
583- model.ColorOrder = $this.find("select.colorOrder").val();
598+ model.ChannelCountPerNode = parseInt($this.find(".cpn").val());
584599 model.xLights = $this.find("input.xlights").is(':checked');
585600
586601 if ((model.StartChannel > 0) &&
@@ -656,8 +671,7 @@ function AddNewChannelModel() {
656671 "<td><span class='hidden type'>Channel</span>Channel</td>" +
657672 "<td><input class='start' type='text' size='6' maxlength='6' value='1'></td>" +
658673 "<td><input class='cnt' type='text' size='6' maxlength='6' value='150'></td>" +
659- "<td><input class='cpn' type='number' min='1' max='4' value='3'></td>" +
660- "<td>" + GetColorOrderSelect("RGB", "") + "</td>" +
674+ "<td>" + GetChannelsPerNodeInput(3, "") + "</td>" +
661675 "<td>" + GetOrientationInput("", "") + "</td>" +
662676 "<td>" + GetStartingCornerInput('') + "</td>" +
663677 "<td><input class='strcnt' type='text' size='3' maxlength='3' value='1'></td>" +
@@ -987,38 +1001,6 @@ function pageSpecific_PageLoad_PostDOMLoad_ActionsSetup() {
9871001 DisableButtonClass('btnDelete');
9881002 }
9891003 });
990-
991- // Keep Ch./Node consistent with the selected Color Order: RGBW orders are
992- // 4 channels per node, RGB orders 3. Leave 1/2-channel models alone when
993- // a plain RGB order is selected since color order doesn't apply to them.
994- $('#channelMemMaps').on('change', 'select.colorOrder', function () {
995- var cpnInput = $(this).closest('tr').find('input.cpn');
996- if (cpnInput.length == 0) {
997- return;
998- }
999- var isRGBW = $(this).val().indexOf('W') != -1;
1000- if (isRGBW) {
1001- cpnInput.val(4);
1002- } else if (parseInt(cpnInput.val()) == 4) {
1003- cpnInput.val(3);
1004- }
1005- });
1006-
1007- // And the reverse: dropping Ch./Node below 4 on an RGBW model reverts the
1008- // Color Order to a 3-channel one, raising it to 4 selects RGBW.
1009- $('#channelMemMaps').on('change', 'input.cpn', function () {
1010- var orderSelect = $(this).closest('tr').find('select.colorOrder');
1011- if (orderSelect.length == 0) {
1012- return;
1013- }
1014- var order = orderSelect.val() || 'RGB';
1015- var isRGBW = order.indexOf('W') != -1;
1016- if (parseInt($(this).val()) == 4 && !isRGBW) {
1017- orderSelect.val(order + 'W');
1018- } else if (parseInt($(this).val()) != 4 && isRGBW) {
1019- orderSelect.val(order.replace('W', ''));
1020- }
1021- });
10221004 }
10231005
10241006 </script>
@@ -1073,8 +1055,7 @@ class='buttons btn-success ml-1'>
10731055 <th><span title='Type'>Type</span></th>
10741056 <th><span title='Start Channel'>Start Ch.</span></th>
10751057 <th><span title='Channel Count'>Ch. Count</span></th>
1076- <th><span title='Chan Per Node'>Ch./Node</span></th>
1077- <th><span title='Color Order (RGB, RGBW, etc.)'>Color Order</span></th>
1058+ <th><span title='Channels each node occupies. 1, 3 and 4 are the widths FPP's outputs produce.'>Ch./Node</span></th>
10781059 <th><span title='String Orientation'>Orientation</span></th>
10791060 <th><span title='Starting Corner'>Start Corner</span></th>
10801061 <th><span title='Number of Strings or Width of FB/X11/Sub-Model'>Strings</span></th>
@@ -1108,14 +1089,14 @@ class='buttons btn-success ml-1'>
11081089 <th><span title='Type'>Type</span></th>
11091090 <th><span title='Start Channel'>Start Ch.</span></th>
11101091 <th><span title='Channel Count'>Ch. Count</span></th>
1111- <th><span title='Chan Per Node'>Ch./Node</span></th>
1112- <th><span title='Color Order (RGB, RGBW, etc.)'>Color Order</span></th>
1092+ <th><span title='Channels each node occupies. 1, 3 and 4 are the widths FPP's outputs produce.'>Ch./Node</span></th>
11131093 <th><span title='String Orientation'>Orientation</span></th>
11141094 <th><span title='Starting Corner'>Start Corner</span></th>
11151095 <th><span title='Number of Strings or Width of FB/X11/Sub-Model'>Strings</span></th>
11161096 <th><span
11171097 title='Number of Strands Per String or Height of FB/X11/Sub-Model'>Strands</span>
11181098 </th>
1099+ <th><span title='xLights submodels defined for this model'>Submodels</span></th>
11191100 <th><span title='Running Effect'>Running Effect</span></th>
11201101 </tr>
11211102 </thead>
0 commit comments