PWM pins saving (hack bug) fix. UI changes.

This commit is contained in:
Blaz Kristan 2021-02-25 22:55:49 +01:00
parent 3f41ba6bdf
commit 3c81337630
7 changed files with 1785 additions and 1773 deletions

View File

@ -116,7 +116,6 @@ class BusDigital : public Bus {
_busPtr = PolyBus::create(_iType, _pins, _len);
_valid = (_busPtr != nullptr);
_colorOrder = bc.colorOrder;
//Serial.printf("Successfully inited strip %u (len %u) with type %u and pins %u,%u (itype %u)\n",nr, len, type, pins[0],pins[1],_iType);
};
inline void show() {
@ -178,7 +177,6 @@ class BusDigital : public Bus {
}
void cleanup() {
//Serial.println("Digital Cleanup");
PolyBus::cleanup(_busPtr, _iType);
_iType = I_NONE;
_valid = false;
@ -204,9 +202,9 @@ class BusDigital : public Bus {
class BusPwm : public Bus {
public:
BusPwm(BusConfig &bc) : Bus(bc.type, bc.start) {
if (!IS_PWM(bc.type)) return;
uint8_t numPins = NUM_PWM_PINS(bc.type);
BusPwm(BusConfig &bc) : Bus(bc.type&0x7F, bc.start) { // bit 7 is hacked to include RGBW info
if (!IS_PWM(bc.type&0x7F)) return; // bit 7 is hacked to include RGBW info
uint8_t numPins = NUM_PWM_PINS(bc.type&0x7F); // bit 7 is hacked to include RGBW info
#ifdef ESP8266
analogWriteRange(255); //same range as one RGB channel
@ -321,7 +319,7 @@ class BusManager {
int add(BusConfig &bc) {
if (numBusses >= WLED_MAX_BUSSES) return -1;
if (IS_DIGITAL(bc.type)) {
if (IS_DIGITAL(bc.type&0x7F)) {
busses[numBusses] = new BusDigital(bc, numBusses);
} else {
busses[numBusses] = new BusPwm(bc);

View File

@ -115,10 +115,10 @@
#define TYPE_LPD8806 52
#define TYPE_P9813 53
#define IS_DIGITAL(t) (t & 0x10) //digital are 16-31 and 48-63
#define IS_PWM(t) (t > 40 && t < 46)
#define NUM_PWM_PINS(t) (t - 40) //for analog PWM 41-45 only
#define IS_2PIN(t) (t > 47)
#define IS_DIGITAL(t) ((t) & 0x10) //digital are 16-31 and 48-63
#define IS_PWM(t) ((t) > 40 && (t) < 46)
#define NUM_PWM_PINS(t) ((t) - 40) //for analog PWM 41-45 only
#define IS_2PIN(t) ((t) > 47)
//Color orders
#define COL_ORDER_GRB 0 //GRB(w),defaut

View File

@ -290,12 +290,15 @@ button {
display: block;
position: -webkit-sticky;
position: sticky;
background: var(--c-1);
top: -1px;
z-index: 1;
margin: 1px auto auto;
}
/*
#staytop, #staytop1 {
background: var(--c-1);
}
*/
#staytop1 {
top: 28px;
}
@ -940,8 +943,17 @@ input[type="text"].fnd {
margin: 0 auto 10px;
text-align: left;
border-radius: 0;
background: var(--c-1);
border-bottom: 1px solid var(--c-3);
position: relative;
}
input[type="text"].fnd::before {
opacity: 0.33;
background: var(--c-1);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
input[type="text"].fnd:focus {

View File

@ -152,12 +152,12 @@
}
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3" || nm=="L4" || nm=="RL" || nm=="BT" || nm=="IR" || nm=="AX")
if (LCs[i].value!="" && LCs[i].value!="-1") {
if (d.um_p && d.um_p.some((e)=>e==parseInt(LCs[i].value,10))) {alert("Usermod/reserved pin clash!");LCs[i].value="";LCs[i].focus();continue;}
if (d.um_p && d.um_p.some((e)=>e==parseInt(LCs[i].value,10))) {alert("Usermod/reserved pin conflict!");LCs[i].value="";LCs[i].focus();continue;}
for (j=0; j<LCs.length; j++) {
if (i==j) continue;
var n2 = LCs[j].name.substring(0,2);
if (n2=="L0" || n2=="L1" || n2=="L2" || n2=="L3" || n2=="L4" || n2=="RL" || n2=="BT" || n2=="IR" || n2=="AX")
if (LCs[j].value!="" && LCs[i].value==LCs[j].value) {alert("Pin clash!");LCs[j].value="";LCs[j].focus();break;}
if (LCs[j].value!="" && LCs[i].value==LCs[j].value) {alert("Pin conflict!");LCs[j].value="";LCs[j].focus();break;}
}
}
}
@ -212,46 +212,47 @@
var f = d.getElementById("mLC");
if (n==1) {
// npm run build has trouble minimizing spaces inside string
var cn = '<div class="iST">'+
i>0?'<hr style="width:260px">':''+
i+1 + ':'+
`<select name="LT${i}" onchange="UI(true)">`+
'<option value="22">WS281x</option>'+
'<option value="30">SK6812 RGBW</option>'+
'<option value="31">TM1814</option>'+
'<option value="24">400kHz</option>'+
'<option value="50">WS2801</option>'+
'<option value="51">APA102</option>'+
'<option value="52">LPD8806</option>'+
'<option value="53">P9813</option>'+
'<option value="41">PWM White</option>'+
'<option value="42">PWM WWCW</option>'+
'<option value="43">PWM RGB</option>'+
'<option value="44">PWM RGBW</option>'+
'<option value="45">PWM RGBWC</option>'+
'</select>&nbsp;'+
'Color Order:'+
`<select name="CO${i}">`+
'<option value="0">GRB</option>'+
'<option value="1">RGB</option>'+
'<option value="2">BRG</option>'+
'<option value="3">RBG</option>'+
'<option value="4">BGR</option>'+
'<option value="5">GBR</option>'+
'</select>&nbsp;'+
`RGBW: <input id="ew${i}" type="checkbox" name="EW${i}"><br>`+
`<span id="p0d${i}">Pin: </span><input type="number" name="L0${i}" min="0" max="40" required style="width:35px" onchange="UI()"/>`+
`<span id="p1d${i}">Clock: </span><input type="number" name="L1${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
`<span id="p2d${i}"></span><input type="number" name="L2${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
`<span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
`<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+
'<br>'+
`<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" min="0" max="8191" value="0" required />&nbsp;`+
`<div id="dig${i}" style="display:inline">`+
`Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br>`+
`Reverse: <input type="checkbox" name="CV${i}"></div><br>`+
'</div>';
// npm run build has trouble minimizing spaces inside string
var cn = `<div class="iST">
${i>0?'<hr style="width:260px">':''}
${i+1}:
<select name="LT${i}" onchange="UI(true)">
<option value="22">WS281x</option>
<option value="30">SK6812 RGBW</option>
<option value="31">TM1814</option>
<option value="24">400kHz</option>
<option value="50">WS2801</option>
<option value="51">APA102</option>
<option value="52">LPD8806</option>
<option value="53">P9813</option>
<option value="41">PWM White</option>
<option value="42">PWM WWCW</option>
<option value="43">PWM RGB</option>
<option value="44">PWM RGBW</option>
<option value="45">PWM RGBWC</option>
</select>&nbsp;
Color Order:
<select name="CO${i}">
<option value="0">GRB</option>
<option value="1">RGB</option>
<option value="2">BRG</option>
<option value="3">RBG</option>
<option value="4">BGR</option>
<option value="5">GBR</option>
</select><br>
<span id="p0d${i}">Pin:</span> <input type="number" name="L0${i}" min="0" max="40" required style="width:35px" onchange="UI()"/>
<span id="p1d${i}">Clock:</span> <input type="number" name="L1${i}" min="0" max="40" style="width:35px" onchange="UI()"/>
<span id="p2d${i}"></span><input type="number" name="L2${i}" min="0" max="40" style="width:35px" onchange="UI()"/>
<span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="40" style="width:35px" onchange="UI()"/>
<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px" onchange="UI()"/>
<br>
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" min="0" max="8191" value="0" required />&nbsp;
<div id="dig${i}" style="display:inline">
Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br>
Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
</div>
&nbsp;RGBW: <input id="ew${i}" type="checkbox" name="EW${i}"><br>
</div>`;
f.insertAdjacentHTML("beforeend", cn);
}
if (n==-1) {
@ -278,7 +279,7 @@
<div class="helpB"><button type="button" onclick="H()">?</button></div>
<button type="button" onclick="B()">Back</button><button type="button" onclick="trySubmit()">Save</button><hr>
<h2>LED &amp; Hardware setup</h2>
Total LED count: <input name="LC" id="LC" type="number" min="1" max="8192" oninput="UI()" size="4" required readonly><br>
Total LED count: <input name="LC" id="LC" type="number" min="1" max="8192" oninput="UI()" required readonly><br>
<i>Recommended power supply for brightest white:</i><br>
<b><span id="psu">?</span></b><br>
<span id="psu2"><br></span>

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2102240
#define VERSION 2102250
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG