Skip to content

Commit d7790a0

Browse files
committed
5 configurable pins per bus (for analog)
1 parent 2c0b073 commit d7790a0

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

wled00/set.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
8787

8888
uint8_t colorOrder, type;
8989
uint16_t length, start;
90-
uint8_t pins[2] = {255, 255};
90+
uint8_t pins[5] = {255, 255, 255, 255, 255};
9191

9292
for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) {
9393
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
94-
char lk[4] = "L1"; lk[2] = 48+s; lk[3] = 0; //strip clock pin. 255 for none
9594
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length
9695
char co[4] = "CO"; co[2] = 48+s; co[3] = 0; //strip color order
9796
char lt[4] = "LT"; lt[2] = 48+s; lt[3] = 0; //strip type
@@ -100,9 +99,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
10099
if (!request->hasArg(lp)) {
101100
DEBUG_PRINTLN("No data."); break;
102101
}
103-
pins[0] = request->arg(lp).toInt();
104-
if (request->hasArg(lk)) {
105-
pins[1] = (request->arg(lk).length() > 0) ? request->arg(lk).toInt() : 255;
102+
for (uint8_t i = 0; i < 5; i++) {
103+
lp[1] = 48+i;
104+
if (!request->hasArg(lp)) break;
105+
pins[i] = (request->arg(lp).length() > 0) ? request->arg(lp).toInt() : 255;
106106
}
107107
type = request->arg(lt).toInt();
108108

wled00/xml.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ void getSettingsJS(byte subPage, char* dest)
257257
char nS[3];
258258

259259
// add usermod pins as d.um_p array (TODO: usermod config shouldn't use state. instead we should load "um" object from cfg.json)
260-
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
260+
/*DynamicJsonDocument doc(JSON_BUFFER_SIZE);
261261
JsonObject mods = doc.createNestedObject(F("mods"));
262262
usermods.addToJsonState(mods);
263263
if (!mods.isNull()) {
@@ -270,7 +270,7 @@ void getSettingsJS(byte subPage, char* dest)
270270
}
271271
}
272272
oappend(SET_F("];"));
273-
}
273+
}*/
274274

275275
#if defined(WLED_MAX_BUSSES) && WLED_MAX_BUSSES>1
276276
oappend(SET_F("addLEDs("));
@@ -291,7 +291,6 @@ void getSettingsJS(byte subPage, char* dest)
291291
for (uint8_t s=0; s < busses.getNumBusses(); s++){
292292
Bus* bus = busses.getBus(s);
293293
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
294-
char lk[4] = "L1"; lk[2] = 48+s; lk[3] = 0; //strip clock pin. 255 for none
295294
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length
296295
char co[4] = "CO"; co[2] = 48+s; co[3] = 0; //strip color order
297296
char lt[4] = "LT"; lt[2] = 48+s; lt[3] = 0; //strip type
@@ -300,8 +299,10 @@ void getSettingsJS(byte subPage, char* dest)
300299
oappend(SET_F("addLEDs(1);"));
301300
uint8_t pins[5];
302301
uint8_t nPins = bus->getPins(pins);
303-
sappend('v', lp, pins[0]);
304-
if (pinManager.isPinOk(pins[1])) sappend('v', lk, pins[1]);
302+
for (uint8_t i = 0; i < nPins; i++) {
303+
lp[1] = 48+i;
304+
if (pinManager.isPinOk(pins[i])) sappend('v', lp, pins[i]);
305+
}
305306
sappend('v', lc, bus->getLength());
306307
sappend('v',lt,bus->getType());
307308
sappend('v',co,bus->getColorOrder());

0 commit comments

Comments
 (0)