Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion wled00/data/settings_um.htm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
d.um_p = [];
d.rsvd = [];
d.ro_gpio = [];
d.h_pins = [];
d.x_pins = [];
var umCfg = {};
var pins = [], pinO = [], owner;
var loc = false, locip;
Expand Down Expand Up @@ -56,13 +58,19 @@
// function check(o,k) {} //WLEDMM not needed as we use dropdowns
function getPins(o) {
if (isO(o)) {
// If this object is a bus instance, extract the "type" field
let busType = o.type !== undefined ? o.type : -1;
for (const [k,v] of Object.entries(o)) {
if (isO(v)) {
owner = k;
getPins(v);
continue;
}
if (k.replace("[]","").substr(-3)=="pin") {
// Skip pin arrays for special bus types where pin array doesn't contain GPIO numbers, but allow all other entries
if (busType >= 80 && busType < 96) continue; // Network buses - pin array stores IP address
if (busType >= 100 && busType <= 110) continue; // HUB75 buses - pin array stores chain length

if (Array.isArray(v)) {
for (var i=0; i<v.length; i++) if (v[i]>=0) { pins.push(v[i]); pinO.push(owner); }
} else {
Expand Down Expand Up @@ -269,6 +277,8 @@
// console.log("pinPost option", c, c.value, d.ro_gpio.includes(c.value));
for (let j=0; j<d.ro_gpio.length; j++) if (d.ro_gpio[j] == c.value) c.text += " read only 🟠"; //if (d.ro_gpio.includes(c.value)) not working ???
for (let j=0; j<d.rsvd.length; j++) if (d.rsvd[j] == c.value) {c.text += " reserved 🟣"; c.disabled=true;} //now always disabled as post is done last if (d.rsvd.includes(c.value))
for (let j=0; j<d.h_pins.length; j++) if (d.h_pins[j] == c.value && c.text.length <= 4) {c.text += " HUB75 🔴"; c.disabled=true;} // HUB75 pins
for (let j=0; j<d.x_pins.length; j++) if (d.x_pins[j] == c.value && c.text.length <= 4) {c.text += " DMX 🔴"; c.disabled=true;} // DMX pins
//remove pins > max_gpio
if (c.value > d.max_gpio) {
select.removeChild(c);
Expand All @@ -278,7 +288,7 @@
//https://www.javascripttutorial.net/javascript-dom/javascript-remove-items-from-a-select-conditionally/
if (c.text.length <= 4) c.text += " 🟢"; //2 digit number space and ⍼/⎌. If no reserved/read only/other um, then pin can be freely used (green)
for (let jj=0; jj<d.dt_pins.length; jj++) if (d.dt_pins[jj] == c.value) c.text += ((jj<9)?` D${jj}`:((jj==9)?` RX`:` TX`)); //WLEDMM: Add D0-D8, RX/TX to name
for (let jj=0; jj<d.a_pins.length; jj++) if (d.a_pins[jj] == c.value) c.text += ` A${jj}`; //WLEDMM: Add A0-A10
for (let jj=0; jj<d.a_pins.length; jj++) if (d.a_pins[jj] == c.value) c.text += `   A${jj}`; //WLEDMM: Add A0-A10
}
}
}
Expand Down
24 changes: 24 additions & 0 deletions wled00/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,30 @@ void appendGPIOinfo() {
char a_pins[64] = { '\0' }; // fix warning: output 45 bytes into a destination of size 30
snprintf(a_pins, 64, "d.a_pins=[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d];", pinManager.getADCPin(PM_ADC1, 0), pinManager.getADCPin(PM_ADC1, 1), pinManager.getADCPin(PM_ADC1, 2), pinManager.getADCPin(PM_ADC1, 3), pinManager.getADCPin(PM_ADC1, 4), pinManager.getADCPin(PM_ADC1, 5), pinManager.getADCPin(PM_ADC1, 6), pinManager.getADCPin(PM_ADC1, 7), pinManager.getADCPin(PM_ADC1, 8), pinManager.getADCPin(PM_ADC1, 9), pinManager.getADCPin(PM_ADC1, 10));
oappend(a_pins);

// WLEDMM add HUB75 pins, as they are not stored directly in cfg.json
strcpy(ro_gpio, "d.h_pins=["); // WLEDMM we re-use this array, instead of creating an addition one; 140 bytes is more than enough for 14 pins.
bool isFirstPin = true;
for(int pinNr = 0; pinNr < WLED_NUM_PINS; pinNr++) {
if ((pinManager.isPinOk(pinNr)) && (pinManager.getPinOwner(pinNr) == PinOwner::HUB75)) {
sprintf(pinString, "%s%d", isFirstPin ? "" : ",", pinNr);
strcat(ro_gpio, pinString); isFirstPin = false;
}
}
oappend(ro_gpio);
oappend(SET_F("];"));

// WLEDMM same procedure for DMX pins
strcpy(ro_gpio, "d.x_pins=["); // WLEDMM we re-use this array, instead of creating an addition one; 140 bytes is more than enough for max 4 pins.
isFirstPin = true;
for(int pinNr = 0; pinNr < WLED_NUM_PINS; pinNr++) {
if ((pinManager.isPinOk(pinNr)) && (pinManager.getPinOwner(pinNr) == PinOwner::DMX || pinManager.getPinOwner(pinNr) == PinOwner::DMX_INPUT)) {
sprintf(pinString, "%s%d", isFirstPin ? "" : ",", pinNr);
strcat(ro_gpio, pinString); isFirstPin = false;
}
}
oappend(ro_gpio);
oappend(SET_F("];"));
}

//get values for settings form in javascript
Expand Down