Merge branch 'bus-config' into HUB75-AC
This commit is contained in:
110
wled00/xml.cpp
Executable file → Normal file
110
wled00/xml.cpp
Executable file → Normal file
@@ -145,10 +145,13 @@ void appendGPIOinfo() {
|
||||
oappend(SET_F("d.rsvd=[22,23,24,25,26,27,28,29,30,31,32"));
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
oappend(SET_F("d.rsvd=[19,20,22,23,24,25,26,27,28,29,30,31,32")); // includes 19+20 for USB OTG (JTAG)
|
||||
if (psramFound()) oappend(SET_F(",33,34,35,36,37")); // in use for "octal" PSRAM or "octal" FLASH -seems that octal PSRAM is very common on S3.
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
oappend(SET_F("d.rsvd=[11,12,13,14,15,16,17"));
|
||||
#elif defined(ESP32)
|
||||
oappend(SET_F("d.rsvd=[6,7,8,9,10,11,24,28,29,30,31,37,38"));
|
||||
if (!pinManager.isPinOk(16,false)) oappend(SET_F(",16")); // covers PICO & WROVER
|
||||
if (!pinManager.isPinOk(17,false)) oappend(SET_F(",17")); // covers PICO & WROVER
|
||||
#else
|
||||
oappend(SET_F("d.rsvd=[6,7,8,9,10,11"));
|
||||
#endif
|
||||
@@ -163,17 +166,9 @@ void appendGPIOinfo() {
|
||||
|
||||
//Note: Using pin 3 (RX) disables Adalight / Serial JSON
|
||||
|
||||
#if defined(ARDUINO_ARCH_ESP32) && defined(BOARD_HAS_PSRAM)
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
if (psramFound()) oappend(SET_F(",16,17")); // GPIO16 & GPIO17 reserved for SPI RAM on ESP32 (not on S2, S3 or C3)
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
if (psramFound()) oappend(SET_F(",33,34,35,36,37")); // in use for "octal" PSRAM or "octal" FLASH -seems that octal PSRAM is very common on S3.
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
if (ethernetType != WLED_ETH_NONE && ethernetType < WLED_NUM_ETH_TYPES) {
|
||||
for (uint8_t p=0; p<WLED_ETH_RSVD_PINS_COUNT; p++) { oappend(","); oappend(itoa(esp32_nonconfigurable_ethernet_pins[p].pin,nS,10)); }
|
||||
for (unsigned p=0; p<WLED_ETH_RSVD_PINS_COUNT; p++) { oappend(","); oappend(itoa(esp32_nonconfigurable_ethernet_pins[p].pin,nS,10)); }
|
||||
if (ethernetBoards[ethernetType].eth_power>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_power,nS,10)); }
|
||||
if (ethernetBoards[ethernetType].eth_mdc>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_mdc,nS,10)); }
|
||||
if (ethernetBoards[ethernetType].eth_mdio>=0) { oappend(","); oappend(itoa(ethernetBoards[ethernetType].eth_mdio,nS,10)); }
|
||||
@@ -288,6 +283,11 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappends('s',SET_F("AP"),fapass);
|
||||
|
||||
sappend('v',SET_F("AC"),apChannel);
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
sappend('v',SET_F("TX"),txPower);
|
||||
#else
|
||||
oappend(SET_F("gId('tx').style.display='none';"));
|
||||
#endif
|
||||
sappend('c',SET_F("FG"),force802_3g);
|
||||
sappend('c',SET_F("WS"),noWifiSleep);
|
||||
|
||||
@@ -303,7 +303,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('v',SET_F("ETH"),ethernetType);
|
||||
#else
|
||||
//hide ethernet setting if not compiled in
|
||||
oappend(SET_F("document.getElementById('ethd').style.display='none';"));
|
||||
oappend(SET_F("gId('ethd').style.display='none';"));
|
||||
#endif
|
||||
|
||||
if (Network.isConnected()) //is connected
|
||||
@@ -349,46 +349,53 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
|
||||
appendGPIOinfo();
|
||||
|
||||
oappend(SET_F("d.ledTypes=")); oappend(BusManager::getLEDTypesJSONString().c_str()); oappend(";");
|
||||
|
||||
// set limits
|
||||
oappend(SET_F("bLimits("));
|
||||
oappend(itoa(WLED_MAX_BUSSES,nS,10)); oappend(",");
|
||||
oappend(itoa(WLED_MIN_VIRTUAL_BUSSES,nS,10)); oappend(",");
|
||||
oappend(itoa(MAX_LEDS_PER_BUS,nS,10)); oappend(",");
|
||||
oappend(itoa(MAX_LED_MEMORY,nS,10)); oappend(",");
|
||||
oappend(itoa(MAX_LEDS,nS,10));
|
||||
oappend(itoa(MAX_LEDS,nS,10)); oappend(",");
|
||||
oappend(itoa(WLED_MAX_COLOR_ORDER_MAPPINGS,nS,10)); oappend(",");
|
||||
oappend(itoa(WLED_MAX_DIGITAL_CHANNELS,nS,10)); oappend(",");
|
||||
oappend(itoa(WLED_MAX_ANALOG_CHANNELS,nS,10));
|
||||
oappend(SET_F(");"));
|
||||
|
||||
sappend('c',SET_F("MS"),autoSegments);
|
||||
sappend('c',SET_F("CCT"),correctWB);
|
||||
sappend('c',SET_F("CR"),cctFromRgb);
|
||||
sappend('c',SET_F("MS"),strip.autoSegments);
|
||||
sappend('c',SET_F("CCT"),strip.correctWB);
|
||||
sappend('c',SET_F("IC"),cctICused);
|
||||
sappend('c',SET_F("CR"),strip.cctFromRgb);
|
||||
sappend('v',SET_F("CB"),strip.cctBlending);
|
||||
sappend('v',SET_F("FR"),strip.getTargetFps());
|
||||
sappend('v',SET_F("AW"),Bus::getGlobalAWMode());
|
||||
sappend('c',SET_F("LD"),useGlobalLedBuffer);
|
||||
|
||||
uint16_t sumMa = 0;
|
||||
for (uint8_t s=0; s < BusManager::getNumBusses(); s++) {
|
||||
unsigned sumMa = 0;
|
||||
for (int s = 0; s < BusManager::getNumBusses(); s++) {
|
||||
Bus* bus = BusManager::getBus(s);
|
||||
if (bus == nullptr) continue;
|
||||
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
|
||||
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 lt[4] = "LT"; lt[2] = 48+s; lt[3] = 0; //strip type
|
||||
char ls[4] = "LS"; ls[2] = 48+s; ls[3] = 0; //strip start LED
|
||||
char cv[4] = "CV"; cv[2] = 48+s; cv[3] = 0; //strip reverse
|
||||
char sl[4] = "SL"; sl[2] = 48+s; sl[3] = 0; //skip 1st LED
|
||||
char rf[4] = "RF"; rf[2] = 48+s; rf[3] = 0; //off refresh
|
||||
char aw[4] = "AW"; aw[2] = 48+s; aw[3] = 0; //auto white mode
|
||||
char wo[4] = "WO"; wo[2] = 48+s; wo[3] = 0; //swap channels
|
||||
char sp[4] = "SP"; sp[2] = 48+s; sp[3] = 0; //bus clock speed
|
||||
char la[4] = "LA"; la[2] = 48+s; la[3] = 0; //LED current
|
||||
char ma[4] = "MA"; ma[2] = 48+s; ma[3] = 0; //max per-port PSU current
|
||||
int offset = s < 10 ? 48 : 55;
|
||||
char lp[4] = "L0"; lp[2] = offset+s; lp[3] = 0; //ascii 0-9 //strip data pin
|
||||
char lc[4] = "LC"; lc[2] = offset+s; lc[3] = 0; //strip length
|
||||
char co[4] = "CO"; co[2] = offset+s; co[3] = 0; //strip color order
|
||||
char lt[4] = "LT"; lt[2] = offset+s; lt[3] = 0; //strip type
|
||||
char ls[4] = "LS"; ls[2] = offset+s; ls[3] = 0; //strip start LED
|
||||
char cv[4] = "CV"; cv[2] = offset+s; cv[3] = 0; //strip reverse
|
||||
char sl[4] = "SL"; sl[2] = offset+s; sl[3] = 0; //skip 1st LED
|
||||
char rf[4] = "RF"; rf[2] = offset+s; rf[3] = 0; //off refresh
|
||||
char aw[4] = "AW"; aw[2] = offset+s; aw[3] = 0; //auto white mode
|
||||
char wo[4] = "WO"; wo[2] = offset+s; wo[3] = 0; //swap channels
|
||||
char sp[4] = "SP"; sp[2] = offset+s; sp[3] = 0; //bus clock speed
|
||||
char la[4] = "LA"; la[2] = offset+s; la[3] = 0; //LED current
|
||||
char ma[4] = "MA"; ma[2] = offset+s; ma[3] = 0; //max per-port PSU current
|
||||
oappend(SET_F("addLEDs(1);"));
|
||||
uint8_t pins[5];
|
||||
uint8_t nPins = bus->getPins(pins);
|
||||
for (uint8_t i = 0; i < nPins; i++) {
|
||||
lp[1] = 48+i;
|
||||
if (pinManager.isPinOk(pins[i]) || IS_VIRTUAL(bus->getType())) sappend('v',lp,pins[i]);
|
||||
int nPins = bus->getPins(pins);
|
||||
for (int i = 0; i < nPins; i++) {
|
||||
lp[1] = offset+i;
|
||||
if (pinManager.isPinOk(pins[i]) || bus->isVirtual()) sappend('v',lp,pins[i]);
|
||||
}
|
||||
sappend('v',lc,bus->getLength());
|
||||
sappend('v',lt,bus->getType());
|
||||
@@ -399,17 +406,17 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('c',rf,bus->isOffRefreshRequired());
|
||||
sappend('v',aw,bus->getAutoWhiteMode());
|
||||
sappend('v',wo,bus->getColorOrder() >> 4);
|
||||
uint16_t speed = bus->getFrequency();
|
||||
if (IS_PWM(bus->getType())) {
|
||||
unsigned speed = bus->getFrequency();
|
||||
if (bus->isPWM()) {
|
||||
switch (speed) {
|
||||
case WLED_PWM_FREQ/3 : speed = 0; break;
|
||||
case WLED_PWM_FREQ/2 : speed = 1; break;
|
||||
case WLED_PWM_FREQ/2 : speed = 0; break;
|
||||
case WLED_PWM_FREQ*2/3 : speed = 1; break;
|
||||
default:
|
||||
case WLED_PWM_FREQ : speed = 2; break;
|
||||
case WLED_PWM_FREQ*4/3 : speed = 3; break;
|
||||
case WLED_PWM_FREQ*2 : speed = 4; break;
|
||||
case WLED_PWM_FREQ : speed = 2; break;
|
||||
case WLED_PWM_FREQ*2 : speed = 3; break;
|
||||
case WLED_PWM_FREQ*10/3 : speed = 4; break; // uint16_t max (19531 * 3.333)
|
||||
}
|
||||
} else if (IS_DIGITAL(bus->getType()) && IS_2PIN(bus->getType())) {
|
||||
} else if (bus->is2Pin()) {
|
||||
switch (speed) {
|
||||
case 1000 : speed = 0; break;
|
||||
case 2000 : speed = 1; break;
|
||||
@@ -425,13 +432,14 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sumMa += bus->getMaxCurrent();
|
||||
}
|
||||
sappend('v',SET_F("MA"),BusManager::ablMilliampsMax() ? BusManager::ablMilliampsMax() : sumMa);
|
||||
sappend('c',SET_F("ABL"),BusManager::ablMilliampsMax() || sumMa > 0);
|
||||
sappend('c',SET_F("PPL"),!BusManager::ablMilliampsMax() && sumMa > 0);
|
||||
|
||||
oappend(SET_F("resetCOM("));
|
||||
oappend(itoa(WLED_MAX_COLOR_ORDER_MAPPINGS,nS,10));
|
||||
oappend(SET_F(");"));
|
||||
const ColorOrderMap& com = BusManager::getColorOrderMap();
|
||||
for (uint8_t s=0; s < com.count(); s++) {
|
||||
for (int s = 0; s < com.count(); s++) {
|
||||
const ColorOrderMapEntry* entry = com.get(s);
|
||||
if (entry == nullptr) break;
|
||||
oappend(SET_F("addCOM("));
|
||||
@@ -461,7 +469,8 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('i',SET_F("PB"),strip.paletteBlend);
|
||||
sappend('v',SET_F("RL"),rlyPin);
|
||||
sappend('c',SET_F("RM"),rlyMde);
|
||||
for (uint8_t i=0; i<WLED_MAX_BUTTONS; i++) {
|
||||
sappend('c',SET_F("RO"),rlyOpenDrain);
|
||||
for (int i = 0; i < WLED_MAX_BUTTONS; i++) {
|
||||
oappend(SET_F("addBtn("));
|
||||
oappend(itoa(i,nS,10)); oappend(",");
|
||||
oappend(itoa(btnPin[i],nS,10)); oappend(",");
|
||||
@@ -470,8 +479,10 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
}
|
||||
sappend('c',SET_F("IP"),disablePullUp);
|
||||
sappend('v',SET_F("TT"),touchThreshold);
|
||||
#ifndef WLED_DISABLE_INFRARED
|
||||
sappend('v',SET_F("IR"),irPin);
|
||||
sappend('v',SET_F("IT"),irEnabled);
|
||||
#endif
|
||||
sappend('c',SET_F("MSO"),!irApplyToAllSelected);
|
||||
}
|
||||
|
||||
@@ -524,15 +535,16 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('c',SET_F("FB"),arlsForceMaxBri);
|
||||
sappend('c',SET_F("RG"),arlsDisableGammaCorrection);
|
||||
sappend('v',SET_F("WO"),arlsOffset);
|
||||
#ifndef WLED_DISABLE_ALEXA
|
||||
sappend('c',SET_F("AL"),alexaEnabled);
|
||||
sappends('s',SET_F("AI"),alexaInvocationName);
|
||||
sappend('c',SET_F("SA"),notifyAlexa);
|
||||
sappend('v',SET_F("AP"),alexaNumPresets);
|
||||
#ifdef WLED_DISABLE_ALEXA
|
||||
#else
|
||||
oappend(SET_F("toggle('Alexa');")); // hide Alexa settings
|
||||
#endif
|
||||
|
||||
#ifdef WLED_ENABLE_MQTT
|
||||
#ifndef WLED_DISABLE_MQTT
|
||||
sappend('c',SET_F("MQ"),mqttEnabled);
|
||||
sappends('s',SET_F("MS"),mqttServer);
|
||||
sappend('v',SET_F("MQPORT"),mqttPort);
|
||||
@@ -623,7 +635,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('v',SET_F("A1"),macroAlexaOff);
|
||||
sappend('v',SET_F("MC"),macroCountdown);
|
||||
sappend('v',SET_F("MN"),macroNl);
|
||||
for (uint8_t i=0; i<WLED_MAX_BUTTONS; i++) {
|
||||
for (unsigned i=0; i<WLED_MAX_BUTTONS; i++) {
|
||||
oappend(SET_F("addRow("));
|
||||
oappend(itoa(i,tm,10)); oappend(",");
|
||||
oappend(itoa(macroButton[i],tm,10)); oappend(",");
|
||||
@@ -723,6 +735,8 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappends('m',SET_F("(\"sip\")[0]"),(char*)F("WLED "));
|
||||
olen -= 2; //delete ";
|
||||
oappend(versionString);
|
||||
oappend(SET_F("<br>"));
|
||||
oappend(releaseString);
|
||||
oappend(SET_F("<br>("));
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
oappend(ESP.getChipModel());
|
||||
@@ -747,7 +761,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
}
|
||||
sappend('v',SET_F("MPC"),strip.panels);
|
||||
// panels
|
||||
for (uint8_t i=0; i<strip.panels; i++) {
|
||||
for (unsigned i=0; i<strip.panels; i++) {
|
||||
char n[5];
|
||||
oappend(SET_F("addPanel("));
|
||||
oappend(itoa(i,n,10));
|
||||
@@ -755,7 +769,7 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
char pO[8] = { '\0' };
|
||||
snprintf_P(pO, 7, PSTR("P%d"), i); // MAX_PANELS is 64 so pO will always only be 4 characters or less
|
||||
pO[7] = '\0';
|
||||
uint8_t l = strlen(pO);
|
||||
unsigned l = strlen(pO);
|
||||
// create P0B, P1B, ..., P63B, etc for other PxxX
|
||||
pO[l] = 'B'; sappend('v',pO,strip.panel[i].bottomStart);
|
||||
pO[l] = 'R'; sappend('v',pO,strip.panel[i].rightStart);
|
||||
|
||||
Reference in New Issue
Block a user