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

View File

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

View File

@ -290,12 +290,15 @@ button {
display: block; display: block;
position: -webkit-sticky; position: -webkit-sticky;
position: sticky; position: sticky;
background: var(--c-1);
top: -1px; top: -1px;
z-index: 1; z-index: 1;
margin: 1px auto auto; margin: 1px auto auto;
} }
/*
#staytop, #staytop1 {
background: var(--c-1);
}
*/
#staytop1 { #staytop1 {
top: 28px; top: 28px;
} }
@ -940,8 +943,17 @@ input[type="text"].fnd {
margin: 0 auto 10px; margin: 0 auto 10px;
text-align: left; text-align: left;
border-radius: 0; border-radius: 0;
background: var(--c-1);
border-bottom: 1px solid var(--c-3); 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 { 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 (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 (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++) { for (j=0; j<LCs.length; j++) {
if (i==j) continue; if (i==j) continue;
var n2 = LCs[j].name.substring(0,2); 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 (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"); var f = d.getElementById("mLC");
if (n==1) { if (n==1) {
// npm run build has trouble minimizing spaces inside string // npm run build has trouble minimizing spaces inside string
var cn = '<div class="iST">'+ var cn = `<div class="iST">
i>0?'<hr style="width:260px">':''+ ${i>0?'<hr style="width:260px">':''}
i+1 + ':'+ ${i+1}:
`<select name="LT${i}" onchange="UI(true)">`+ <select name="LT${i}" onchange="UI(true)">
'<option value="22">WS281x</option>'+ <option value="22">WS281x</option>
'<option value="30">SK6812 RGBW</option>'+ <option value="30">SK6812 RGBW</option>
'<option value="31">TM1814</option>'+ <option value="31">TM1814</option>
'<option value="24">400kHz</option>'+ <option value="24">400kHz</option>
'<option value="50">WS2801</option>'+ <option value="50">WS2801</option>
'<option value="51">APA102</option>'+ <option value="51">APA102</option>
'<option value="52">LPD8806</option>'+ <option value="52">LPD8806</option>
'<option value="53">P9813</option>'+ <option value="53">P9813</option>
'<option value="41">PWM White</option>'+ <option value="41">PWM White</option>
'<option value="42">PWM WWCW</option>'+ <option value="42">PWM WWCW</option>
'<option value="43">PWM RGB</option>'+ <option value="43">PWM RGB</option>
'<option value="44">PWM RGBW</option>'+ <option value="44">PWM RGBW</option>
'<option value="45">PWM RGBWC</option>'+ <option value="45">PWM RGBWC</option>
'</select>&nbsp;'+ </select>&nbsp;
'Color Order:'+ Color Order:
`<select name="CO${i}">`+ <select name="CO${i}">
'<option value="0">GRB</option>'+ <option value="0">GRB</option>
'<option value="1">RGB</option>'+ <option value="1">RGB</option>
'<option value="2">BRG</option>'+ <option value="2">BRG</option>
'<option value="3">RBG</option>'+ <option value="3">RBG</option>
'<option value="4">BGR</option>'+ <option value="4">BGR</option>
'<option value="5">GBR</option>'+ <option value="5">GBR</option>
'</select>&nbsp;'+ </select><br>
`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="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="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="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="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()"/>
`<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px" onchange="UI()"/>`+ <br>
'<br>'+ <span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" min="0" max="8191" value="0" required />&nbsp;
`<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">
`<div id="dig${i}" style="display:inline">`+ Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br>
`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}">
`Reverse: <input type="checkbox" name="CV${i}"></div><br>`+ </div>
'</div>'; &nbsp;RGBW: <input id="ew${i}" type="checkbox" name="EW${i}"><br>
</div>`;
f.insertAdjacentHTML("beforeend", cn); f.insertAdjacentHTML("beforeend", cn);
} }
if (n==-1) { if (n==-1) {
@ -278,7 +279,7 @@
<div class="helpB"><button type="button" onclick="H()">?</button></div> <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> <button type="button" onclick="B()">Back</button><button type="button" onclick="trySubmit()">Save</button><hr>
<h2>LED &amp; Hardware setup</h2> <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> <i>Recommended power supply for brightest white:</i><br>
<b><span id="psu">?</span></b><br> <b><span id="psu">?</span></b><br>
<span id="psu2"><br></span> <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) // 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 //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG