5 configurable pins per bus (for analog)
This commit is contained in:
parent
2c0b07387b
commit
d7790a04c5
@ -87,11 +87,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
|
|
||||||
uint8_t colorOrder, type;
|
uint8_t colorOrder, type;
|
||||||
uint16_t length, start;
|
uint16_t length, start;
|
||||||
uint8_t pins[2] = {255, 255};
|
uint8_t pins[5] = {255, 255, 255, 255, 255};
|
||||||
|
|
||||||
for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) {
|
for (uint8_t s = 0; s < WLED_MAX_BUSSES; s++) {
|
||||||
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
|
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
|
||||||
char lk[4] = "L1"; lk[2] = 48+s; lk[3] = 0; //strip clock pin. 255 for none
|
|
||||||
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length
|
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length
|
||||||
char co[4] = "CO"; co[2] = 48+s; co[3] = 0; //strip color order
|
char co[4] = "CO"; co[2] = 48+s; co[3] = 0; //strip color order
|
||||||
char lt[4] = "LT"; lt[2] = 48+s; lt[3] = 0; //strip type
|
char lt[4] = "LT"; lt[2] = 48+s; lt[3] = 0; //strip type
|
||||||
@ -100,9 +99,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
|||||||
if (!request->hasArg(lp)) {
|
if (!request->hasArg(lp)) {
|
||||||
DEBUG_PRINTLN("No data."); break;
|
DEBUG_PRINTLN("No data."); break;
|
||||||
}
|
}
|
||||||
pins[0] = request->arg(lp).toInt();
|
for (uint8_t i = 0; i < 5; i++) {
|
||||||
if (request->hasArg(lk)) {
|
lp[1] = 48+i;
|
||||||
pins[1] = (request->arg(lk).length() > 0) ? request->arg(lk).toInt() : 255;
|
if (!request->hasArg(lp)) break;
|
||||||
|
pins[i] = (request->arg(lp).length() > 0) ? request->arg(lp).toInt() : 255;
|
||||||
}
|
}
|
||||||
type = request->arg(lt).toInt();
|
type = request->arg(lt).toInt();
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
char nS[3];
|
char nS[3];
|
||||||
|
|
||||||
// add usermod pins as d.um_p array (TODO: usermod config shouldn't use state. instead we should load "um" object from cfg.json)
|
// add usermod pins as d.um_p array (TODO: usermod config shouldn't use state. instead we should load "um" object from cfg.json)
|
||||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
/*DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||||
JsonObject mods = doc.createNestedObject(F("mods"));
|
JsonObject mods = doc.createNestedObject(F("mods"));
|
||||||
usermods.addToJsonState(mods);
|
usermods.addToJsonState(mods);
|
||||||
if (!mods.isNull()) {
|
if (!mods.isNull()) {
|
||||||
@ -270,7 +270,7 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
oappend(SET_F("];"));
|
oappend(SET_F("];"));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
#if defined(WLED_MAX_BUSSES) && WLED_MAX_BUSSES>1
|
#if defined(WLED_MAX_BUSSES) && WLED_MAX_BUSSES>1
|
||||||
oappend(SET_F("addLEDs("));
|
oappend(SET_F("addLEDs("));
|
||||||
@ -291,7 +291,6 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
for (uint8_t s=0; s < busses.getNumBusses(); s++){
|
for (uint8_t s=0; s < busses.getNumBusses(); s++){
|
||||||
Bus* bus = busses.getBus(s);
|
Bus* bus = busses.getBus(s);
|
||||||
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
|
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
|
||||||
char lk[4] = "L1"; lk[2] = 48+s; lk[3] = 0; //strip clock pin. 255 for none
|
|
||||||
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length
|
char lc[4] = "LC"; lc[2] = 48+s; lc[3] = 0; //strip length
|
||||||
char co[4] = "CO"; co[2] = 48+s; co[3] = 0; //strip color order
|
char co[4] = "CO"; co[2] = 48+s; co[3] = 0; //strip color order
|
||||||
char lt[4] = "LT"; lt[2] = 48+s; lt[3] = 0; //strip type
|
char lt[4] = "LT"; lt[2] = 48+s; lt[3] = 0; //strip type
|
||||||
@ -300,8 +299,10 @@ void getSettingsJS(byte subPage, char* dest)
|
|||||||
oappend(SET_F("addLEDs(1);"));
|
oappend(SET_F("addLEDs(1);"));
|
||||||
uint8_t pins[5];
|
uint8_t pins[5];
|
||||||
uint8_t nPins = bus->getPins(pins);
|
uint8_t nPins = bus->getPins(pins);
|
||||||
sappend('v', lp, pins[0]);
|
for (uint8_t i = 0; i < nPins; i++) {
|
||||||
if (pinManager.isPinOk(pins[1])) sappend('v', lk, pins[1]);
|
lp[1] = 48+i;
|
||||||
|
if (pinManager.isPinOk(pins[i])) sappend('v', lp, pins[i]);
|
||||||
|
}
|
||||||
sappend('v', lc, bus->getLength());
|
sappend('v', lc, bus->getLength());
|
||||||
sappend('v',lt,bus->getType());
|
sappend('v',lt,bus->getType());
|
||||||
sappend('v',co,bus->getColorOrder());
|
sappend('v',co,bus->getColorOrder());
|
||||||
|
Loading…
Reference in New Issue
Block a user