Merge branch 'main' into HUB75-AC
This commit is contained in:
@@ -26,7 +26,8 @@ void XML_response(Print& dest)
|
||||
);
|
||||
}
|
||||
|
||||
static void extractPin(Print& settingsScript, const JsonObject &obj, const char *key) {
|
||||
static void extractPin(Print& settingsScript, const JsonObject &obj, const char *key)
|
||||
{
|
||||
if (obj[key].is<JsonArray>()) {
|
||||
JsonArray pins = obj[key].as<JsonArray>();
|
||||
for (JsonVariant pv : pins) {
|
||||
@@ -37,6 +38,22 @@ static void extractPin(Print& settingsScript, const JsonObject &obj, const char
|
||||
}
|
||||
}
|
||||
|
||||
void fillWLEDVersion(char *buf, size_t len)
|
||||
{
|
||||
if (!buf || len == 0) return;
|
||||
|
||||
snprintf_P(buf,len,PSTR("WLED %s (%d)<br>\\\"%s\\\"<br>(Processor: %s)"),
|
||||
versionString,
|
||||
VERSION,
|
||||
releaseString,
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
ESP.getChipModel()
|
||||
#else
|
||||
"ESP8266"
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
// print used pins by scanning JsonObject (1 level deep)
|
||||
static void fillUMPins(Print& settingsScript, const JsonObject &mods)
|
||||
{
|
||||
@@ -72,7 +89,8 @@ static void fillUMPins(Print& settingsScript, const JsonObject &mods)
|
||||
}
|
||||
}
|
||||
|
||||
void appendGPIOinfo(Print& settingsScript) {
|
||||
void appendGPIOinfo(Print& settingsScript)
|
||||
{
|
||||
settingsScript.print(F("d.um_p=[-1")); // has to have 1 element
|
||||
if (i2c_sda > -1 && i2c_scl > -1) {
|
||||
settingsScript.printf_P(PSTR(",%d,%d"), i2c_sda, i2c_scl);
|
||||
@@ -311,6 +329,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
||||
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
|
||||
char hs[4] = "HS"; hs[2] = offset+s; hs[3] = 0; //hostname (for network types, custom text for others)
|
||||
settingsScript.print(F("addLEDs(1);"));
|
||||
uint8_t pins[OUTPUT_MAX_PINS];
|
||||
int nPins = bus->getPins(pins);
|
||||
@@ -350,6 +369,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
||||
printSetFormValue(settingsScript,sp,speed);
|
||||
printSetFormValue(settingsScript,la,bus->getLEDCurrent());
|
||||
printSetFormValue(settingsScript,ma,bus->getMaxCurrent());
|
||||
printSetFormValue(settingsScript,hs,bus->getCustomText().c_str());
|
||||
sumMa += bus->getMaxCurrent();
|
||||
}
|
||||
printSetFormValue(settingsScript,PSTR("MA"),BusManager::ablMilliampsMax() ? BusManager::ablMilliampsMax() : sumMa);
|
||||
@@ -380,7 +400,6 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
||||
printSetFormValue(settingsScript,PSTR("TL"),nightlightDelayMinsDefault);
|
||||
printSetFormValue(settingsScript,PSTR("TW"),nightlightMode);
|
||||
printSetFormIndex(settingsScript,PSTR("PB"),paletteBlend);
|
||||
printSetFormCheckbox(settingsScript,PSTR("RW"),useRainbowWheel);
|
||||
printSetFormValue(settingsScript,PSTR("RL"),rlyPin);
|
||||
printSetFormCheckbox(settingsScript,PSTR("RM"),rlyMde);
|
||||
printSetFormCheckbox(settingsScript,PSTR("RO"),rlyOpenDrain);
|
||||
@@ -593,11 +612,14 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
||||
printSetFormCheckbox(settingsScript,PSTR("AO"),aOtaEnabled);
|
||||
printSetFormCheckbox(settingsScript,PSTR("SU"),otaSameSubnet);
|
||||
char tmp_buf[128];
|
||||
snprintf_P(tmp_buf,sizeof(tmp_buf),PSTR("WLED %s (build %d)"),versionString,VERSION);
|
||||
fillWLEDVersion(tmp_buf,sizeof(tmp_buf));
|
||||
printSetClassElementHTML(settingsScript,PSTR("sip"),0,tmp_buf);
|
||||
settingsScript.printf_P(PSTR("sd=\"%s\";"), serverDescription);
|
||||
#ifdef WLED_DISABLE_OTA
|
||||
//hide settings if not compiled
|
||||
#ifdef WLED_DISABLE_OTA
|
||||
settingsScript.print(F("toggle('OTA');")); // hide update section
|
||||
#endif
|
||||
#ifndef WLED_ENABLE_AOTA
|
||||
settingsScript.print(F("toggle('aOTA');")); // hide ArduinoOTA checkbox
|
||||
#endif
|
||||
}
|
||||
@@ -652,16 +674,7 @@ void getSettingsJS(byte subPage, Print& settingsScript)
|
||||
if (subPage == SUBPAGE_UPDATE) // update
|
||||
{
|
||||
char tmp_buf[128];
|
||||
snprintf_P(tmp_buf,sizeof(tmp_buf),PSTR("WLED %s<br>%s<br>(%s build %d)"),
|
||||
versionString,
|
||||
releaseString,
|
||||
#if defined(ARDUINO_ARCH_ESP32)
|
||||
ESP.getChipModel(),
|
||||
#else
|
||||
"esp8266",
|
||||
#endif
|
||||
VERSION);
|
||||
|
||||
fillWLEDVersion(tmp_buf,sizeof(tmp_buf));
|
||||
printSetClassElementHTML(settingsScript,PSTR("sip"),0,tmp_buf);
|
||||
#ifndef ARDUINO_ARCH_ESP32
|
||||
settingsScript.print(F("toggle('rev');")); // hide revert button on ESP8266
|
||||
|
||||
Reference in New Issue
Block a user