mirror of
https://github.com/wled/WLED.git
synced 2025-07-25 11:46:34 +00:00
xml comma bugfix + few optimisations
This commit is contained in:
parent
a9b0b8adc8
commit
86be5df475
@ -83,7 +83,7 @@ void appendGPIOinfo(Print& settingsScript) {
|
|||||||
// usermod pin reservations will become unnecessary when settings pages will read cfg.json directly
|
// usermod pin reservations will become unnecessary when settings pages will read cfg.json directly
|
||||||
if (requestJSONBufferLock(6)) {
|
if (requestJSONBufferLock(6)) {
|
||||||
// if we can't allocate JSON buffer ignore usermod pins
|
// if we can't allocate JSON buffer ignore usermod pins
|
||||||
JsonObject mods = pDoc->createNestedObject(F("um"));
|
JsonObject mods = pDoc->createNestedObject("um");
|
||||||
UsermodManager::addToConfig(mods);
|
UsermodManager::addToConfig(mods);
|
||||||
if (!mods.isNull()) fillUMPins(settingsScript, mods);
|
if (!mods.isNull()) fillUMPins(settingsScript, mods);
|
||||||
releaseJSONBufferLock();
|
releaseJSONBufferLock();
|
||||||
@ -91,35 +91,42 @@ void appendGPIOinfo(Print& settingsScript) {
|
|||||||
settingsScript.print(F("];"));
|
settingsScript.print(F("];"));
|
||||||
|
|
||||||
// add reserved (unusable) pins
|
// add reserved (unusable) pins
|
||||||
|
bool firstPin = true;
|
||||||
settingsScript.print(F("d.rsvd=["));
|
settingsScript.print(F("d.rsvd=["));
|
||||||
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
|
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
|
||||||
if (!PinManager::isPinOk(i, false)) { // include readonly pins
|
if (!PinManager::isPinOk(i, false)) { // include readonly pins
|
||||||
settingsScript.print(i); settingsScript.print(",");
|
if (!firstPin) settingsScript.print(',');
|
||||||
|
settingsScript.print(i);
|
||||||
|
firstPin = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef WLED_ENABLE_DMX
|
#ifdef WLED_ENABLE_DMX
|
||||||
settingsScript.print(F("2,")); // DMX hardcoded pin
|
if (!firstPin) settingsScript.print(',');
|
||||||
|
settingsScript.print(2); // DMX hardcoded pin
|
||||||
|
firstPin = false;
|
||||||
#endif
|
#endif
|
||||||
#if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST)
|
#if defined(WLED_DEBUG) && !defined(WLED_DEBUG_HOST)
|
||||||
settingsScript.printf_P(PSTR(",%d"),hardwareTX); // debug output (TX) pin
|
if (!firstPin) settingsScript.print(',');
|
||||||
|
settingsScript.print(hardwareTX); // debug output (TX) pin
|
||||||
|
firstPin = false;
|
||||||
#endif
|
#endif
|
||||||
//Note: Using pin 3 (RX) disables Adalight / Serial JSON
|
|
||||||
#ifdef WLED_USE_ETHERNET
|
#ifdef WLED_USE_ETHERNET
|
||||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||||
for (unsigned p=0; p<WLED_ETH_RSVD_PINS_COUNT; p++) { settingsScript.printf(",%d", esp32_nonconfigurable_ethernet_pins[p].pin); }
|
if (!firstPin) settingsScript.print(',');
|
||||||
if (ethernetBoards[ethernetType].eth_power>=0) { settingsScript.printf(",%d", ethernetBoards[ethernetType].eth_power); }
|
for (unsigned p=0; p<WLED_ETH_RSVD_PINS_COUNT; p++) { settingsScript.printf("%d,",esp32_nonconfigurable_ethernet_pins[p].pin); }
|
||||||
if (ethernetBoards[ethernetType].eth_mdc>=0) { settingsScript.printf(",%d", ethernetBoards[ethernetType].eth_mdc); }
|
if (ethernetBoards[ethernetType].eth_power >= 0) { settingsScript.printf("%d,",ethernetBoards[ethernetType].eth_power); }
|
||||||
if (ethernetBoards[ethernetType].eth_mdio>=0) { settingsScript.printf(",%d", ethernetBoards[ethernetType].eth_mdio); }
|
if (ethernetBoards[ethernetType].eth_mdc >= 0) { settingsScript.printf("%d,",ethernetBoards[ethernetType].eth_mdc); }
|
||||||
switch (ethernetBoards[ethernetType].eth_clk_mode) {
|
if (ethernetBoards[ethernetType].eth_mdio >= 0) { settingsScript.printf("%d,",ethernetBoards[ethernetType].eth_mdio); }
|
||||||
|
switch (ethernetBoards[ethernetType].eth_clk_mode) {
|
||||||
case ETH_CLOCK_GPIO0_IN:
|
case ETH_CLOCK_GPIO0_IN:
|
||||||
case ETH_CLOCK_GPIO0_OUT:
|
case ETH_CLOCK_GPIO0_OUT:
|
||||||
settingsScript.print(F("0"));
|
settingsScript.print(0);
|
||||||
break;
|
break;
|
||||||
case ETH_CLOCK_GPIO16_OUT:
|
case ETH_CLOCK_GPIO16_OUT:
|
||||||
settingsScript.print(F("16"));
|
settingsScript.print(16);
|
||||||
break;
|
break;
|
||||||
case ETH_CLOCK_GPIO17_OUT:
|
case ETH_CLOCK_GPIO17_OUT:
|
||||||
settingsScript.print(F("17"));
|
settingsScript.print(17);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -128,11 +135,11 @@ void appendGPIOinfo(Print& settingsScript) {
|
|||||||
|
|
||||||
// add info for read-only GPIO
|
// add info for read-only GPIO
|
||||||
settingsScript.print(F("d.ro_gpio=["));
|
settingsScript.print(F("d.ro_gpio=["));
|
||||||
bool firstPin = true;
|
firstPin = true;
|
||||||
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
|
for (unsigned i = 0; i < WLED_NUM_PINS; i++) {
|
||||||
if (PinManager::isReadOnlyPin(i)) {
|
if (PinManager::isReadOnlyPin(i)) {
|
||||||
// No comma before the first pin
|
// No comma before the first pin
|
||||||
if (!firstPin) settingsScript.print(F(","));
|
if (!firstPin) settingsScript.print(',');
|
||||||
settingsScript.print(i);
|
settingsScript.print(i);
|
||||||
firstPin = false;
|
firstPin = false;
|
||||||
}
|
}
|
||||||
@ -142,7 +149,7 @@ void appendGPIOinfo(Print& settingsScript) {
|
|||||||
// add info about max. # of pins
|
// add info about max. # of pins
|
||||||
settingsScript.print(F("d.max_gpio="));
|
settingsScript.print(F("d.max_gpio="));
|
||||||
settingsScript.print(WLED_NUM_PINS);
|
settingsScript.print(WLED_NUM_PINS);
|
||||||
settingsScript.print(F(";"));
|
settingsScript.print(';');
|
||||||
}
|
}
|
||||||
|
|
||||||
//get values for settings form in javascript
|
//get values for settings form in javascript
|
||||||
@ -152,6 +159,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
|||||||
DEBUG_PRINTF_P(PSTR("settings resp %u\n"), (unsigned)subPage);
|
DEBUG_PRINTF_P(PSTR("settings resp %u\n"), (unsigned)subPage);
|
||||||
|
|
||||||
if (subPage <0 || subPage >10) return;
|
if (subPage <0 || subPage >10) return;
|
||||||
|
char nS[32];
|
||||||
|
|
||||||
if (subPage == SUBPAGE_MENU)
|
if (subPage == SUBPAGE_MENU)
|
||||||
{
|
{
|
||||||
@ -259,8 +267,6 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
|||||||
|
|
||||||
if (subPage == SUBPAGE_LEDS)
|
if (subPage == SUBPAGE_LEDS)
|
||||||
{
|
{
|
||||||
char nS[32];
|
|
||||||
|
|
||||||
appendGPIOinfo(settingsScript);
|
appendGPIOinfo(settingsScript);
|
||||||
|
|
||||||
settingsScript.print(F("d.ledTypes=")); settingsScript.print(BusManager::getLEDTypesJSONString().c_str()); settingsScript.print(";");
|
settingsScript.print(F("d.ledTypes=")); settingsScript.print(BusManager::getLEDTypesJSONString().c_str()); settingsScript.print(";");
|
||||||
@ -399,7 +405,6 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
|||||||
|
|
||||||
if (subPage == SUBPAGE_SYNC)
|
if (subPage == SUBPAGE_SYNC)
|
||||||
{
|
{
|
||||||
[[maybe_unused]] char nS[32];
|
|
||||||
printSetFormValue(settingsScript,PSTR("UP"),udpPort);
|
printSetFormValue(settingsScript,PSTR("UP"),udpPort);
|
||||||
printSetFormValue(settingsScript,PSTR("U2"),udpPort2);
|
printSetFormValue(settingsScript,PSTR("U2"),udpPort2);
|
||||||
#ifndef WLED_DISABLE_ESPNOW
|
#ifndef WLED_DISABLE_ESPNOW
|
||||||
@ -637,7 +642,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
|||||||
#if defined(ARDUINO_ARCH_ESP32)
|
#if defined(ARDUINO_ARCH_ESP32)
|
||||||
ESP.getChipModel(),
|
ESP.getChipModel(),
|
||||||
#else
|
#else
|
||||||
F("esp8266"),
|
"esp8266",
|
||||||
#endif
|
#endif
|
||||||
VERSION);
|
VERSION);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user