Bugfix to allow more than 10 buttons.
This commit is contained in:
parent
fcfb73c755
commit
70aa01b261
@ -350,8 +350,8 @@ ${i+1}:
|
|||||||
}
|
}
|
||||||
function addBtn(i,p,t) {
|
function addBtn(i,p,t) {
|
||||||
var c = gId("btns").innerHTML;
|
var c = gId("btns").innerHTML;
|
||||||
var bt = "BT" + i;
|
var bt = "BT" + String.fromCharCode((i<10?48:55)+i);
|
||||||
var be = "BE" + i;
|
var be = "BE" + String.fromCharCode((i<10?48:55)+i);
|
||||||
c += `Button ${i} GPIO: <input type="number" min="-1" max="40" name="${bt}" onchange="UI()" class="xs" value="${p}">`;
|
c += `Button ${i} GPIO: <input type="number" min="-1" max="40" name="${bt}" onchange="UI()" class="xs" value="${p}">`;
|
||||||
c += ` <select name="${be}">`
|
c += ` <select name="${be}">`
|
||||||
c += `<option value="0" ${t==0?"selected":""}>Disabled</option>`;
|
c += `<option value="0" ${t==0?"selected":""}>Disabled</option>`;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -128,8 +128,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
rlyMde = (bool)request->hasArg(F("RM"));
|
rlyMde = (bool)request->hasArg(F("RM"));
|
||||||
|
|
||||||
for (uint8_t i=0; i<WLED_MAX_BUTTONS; i++) {
|
for (uint8_t i=0; i<WLED_MAX_BUTTONS; i++) {
|
||||||
char bt[4] = "BT"; bt[2] = 48+i; bt[3] = 0; // button pin
|
char bt[4] = "BT"; bt[2] = (i<10?48:55)+i; bt[3] = 0; // button pin (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
||||||
char be[4] = "BE"; be[2] = 48+i; be[3] = 0; // button type
|
char be[4] = "BE"; be[2] = (i<10?48:55)+i; be[3] = 0; // button type (use A,B,C,... if WLED_MAX_BUTTONS>10)
|
||||||
int hw_btn_pin = request->arg(bt).toInt();
|
int hw_btn_pin = request->arg(bt).toInt();
|
||||||
if (pinManager.allocatePin(hw_btn_pin,false,PinOwner::Button)) {
|
if (pinManager.allocatePin(hw_btn_pin,false,PinOwner::Button)) {
|
||||||
btnPin[i] = hw_btn_pin;
|
btnPin[i] = hw_btn_pin;
|
||||||
|
Loading…
Reference in New Issue
Block a user