2020-04-10 12:30:08 +02:00
|
|
|
#include "wled.h"
|
2021-09-30 16:30:44 +02:00
|
|
|
#include "wled_ethernet.h"
|
2020-04-10 12:30:08 +02:00
|
|
|
|
2016-12-31 00:38:51 +01:00
|
|
|
/*
|
|
|
|
* Sending XML status files to client
|
|
|
|
*/
|
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
//build XML response to HTTP /win API request
|
2020-05-28 02:20:02 +02:00
|
|
|
void XML_response(AsyncWebServerRequest *request, char* dest)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2019-03-19 12:19:48 +01:00
|
|
|
char sbuf[(dest == nullptr)?1024:1]; //allocate local buffer if none passed
|
|
|
|
obuf = (dest == nullptr)? sbuf:dest;
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2019-03-16 02:09:37 +01:00
|
|
|
olen = 0;
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("<?xml version=\"1.0\" ?><vs><ac>"));
|
2020-06-22 12:30:31 +02:00
|
|
|
oappendi((nightlightActive && nightlightMode > NL_MODE_SET) ? briT : bri);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</ac>"));
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
oappend("<cl>");
|
|
|
|
oappendi(col[i]);
|
|
|
|
oappend("</cl>");
|
|
|
|
}
|
2019-01-18 01:20:36 +01:00
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
oappend("<cs>");
|
|
|
|
oappendi(colSec[i]);
|
|
|
|
oappend("</cs>");
|
|
|
|
}
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("<ns>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(notifyDirect);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</ns><nr>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(receiveNotifications);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</nr><nl>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(nightlightActive);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</nl><nf>"));
|
2020-06-22 12:30:31 +02:00
|
|
|
oappendi(nightlightMode > NL_MODE_SET);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</nf><nd>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(nightlightDelayMins);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</nd><nt>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(nightlightTargetBri);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</nt><fx>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(effectCurrent);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</fx><sx>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(effectSpeed);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</sx><ix>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(effectIntensity);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</ix><fp>"));
|
2018-11-09 17:00:36 +01:00
|
|
|
oappendi(effectPalette);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</fp><wv>"));
|
2022-02-04 13:28:00 +01:00
|
|
|
if (strip.hasWhiteChannel()) {
|
2019-02-05 21:53:39 +01:00
|
|
|
oappendi(col[3]);
|
2018-11-09 17:00:36 +01:00
|
|
|
} else {
|
|
|
|
oappend("-1");
|
|
|
|
}
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</wv><ws>"));
|
2019-02-05 21:53:39 +01:00
|
|
|
oappendi(colSec[3]);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</ws><ps>"));
|
2021-10-03 13:53:37 +02:00
|
|
|
oappendi(currentPreset);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</ps><cy>"));
|
2021-10-03 13:53:37 +02:00
|
|
|
oappendi(currentPlaylist >= 0);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</cy><ds>"));
|
2020-08-19 09:10:47 +02:00
|
|
|
oappend(serverDescription);
|
2020-02-09 19:10:29 +01:00
|
|
|
if (realtimeMode)
|
2019-02-19 12:57:50 +01:00
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F(" (live)"));
|
2019-02-19 12:57:50 +01:00
|
|
|
}
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</ds><ss>"));
|
2022-02-23 19:20:07 +01:00
|
|
|
oappendi(strip.getFirstSelectedSegId());
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</ss></vs>"));
|
2019-03-16 02:09:37 +01:00
|
|
|
if (request != nullptr) request->send(200, "text/xml", obuf);
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
|
|
|
|
2022-02-16 21:12:33 +01:00
|
|
|
//Deprecated, use of /json/state and presets recommended instead
|
2020-05-28 02:20:02 +02:00
|
|
|
void URL_response(AsyncWebServerRequest *request)
|
2020-02-24 12:18:30 +01:00
|
|
|
{
|
2020-05-28 02:20:02 +02:00
|
|
|
char sbuf[256];
|
2020-02-24 12:18:30 +01:00
|
|
|
char s2buf[100];
|
|
|
|
obuf = s2buf;
|
|
|
|
olen = 0;
|
|
|
|
|
|
|
|
char s[16];
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("http://"));
|
2020-11-13 18:25:13 +01:00
|
|
|
IPAddress localIP = Network.localIP();
|
2020-02-24 12:18:30 +01:00
|
|
|
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
|
|
|
|
oappend(s);
|
2020-11-13 18:25:13 +01:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("/win&A="));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappendi(bri);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("&CL=h"));
|
2020-02-24 12:18:30 +01:00
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
sprintf(s,"%02X", col[i]);
|
2023-01-06 09:24:29 +01:00
|
|
|
oappend(s);
|
2020-02-24 12:18:30 +01:00
|
|
|
}
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("&C2=h"));
|
2020-02-24 12:18:30 +01:00
|
|
|
for (int i = 0; i < 3; i++)
|
|
|
|
{
|
|
|
|
sprintf(s,"%02X", colSec[i]);
|
|
|
|
oappend(s);
|
|
|
|
}
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("&FX="));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappendi(effectCurrent);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("&SX="));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappendi(effectSpeed);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("&IX="));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappendi(effectIntensity);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("&FP="));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappendi(effectPalette);
|
|
|
|
|
|
|
|
obuf = sbuf;
|
|
|
|
olen = 0;
|
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("<html><body><a href=\""));
|
2020-02-24 12:18:30 +01:00
|
|
|
oappend(s2buf);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("\" target=\"_blank\">"));
|
2023-01-06 09:24:29 +01:00
|
|
|
oappend(s2buf);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("</a></body></html>"));
|
2020-02-24 12:18:30 +01:00
|
|
|
|
|
|
|
if (request != nullptr) request->send(200, "text/html", obuf);
|
|
|
|
}
|
|
|
|
|
2021-09-30 16:30:44 +02:00
|
|
|
void extractPin(JsonObject &obj, const char *key) {
|
|
|
|
if (obj[key].is<JsonArray>()) {
|
|
|
|
JsonArray pins = obj[key].as<JsonArray>();
|
|
|
|
for (JsonVariant pv : pins) {
|
|
|
|
if (pv.as<int>() > -1) { oappend(","); oappendi(pv.as<int>()); }
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (obj[key].as<int>() > -1) { oappend(","); oappendi(obj[key].as<int>()); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-02 15:07:02 +02:00
|
|
|
// oappend used pins by scanning JsonObject (1 level deep)
|
2021-09-30 16:30:44 +02:00
|
|
|
void fillUMPins(JsonObject &mods)
|
|
|
|
{
|
|
|
|
for (JsonPair kv : mods) {
|
|
|
|
// kv.key() is usermod name or subobject key
|
|
|
|
// kv.value() is object itself
|
|
|
|
JsonObject obj = kv.value();
|
|
|
|
if (!obj.isNull()) {
|
|
|
|
// element is an JsonObject
|
|
|
|
if (!obj["pin"].isNull()) {
|
|
|
|
extractPin(obj, "pin");
|
|
|
|
} else {
|
|
|
|
// scan keys (just one level deep as is possible with usermods)
|
|
|
|
for (JsonPair so : obj) {
|
|
|
|
const char *key = so.key().c_str();
|
|
|
|
if (strstr(key, "pin")) {
|
|
|
|
// we found a key containing "pin" substring
|
|
|
|
if (strlen(strstr(key, "pin")) == 3) {
|
|
|
|
// and it is at the end, we found another pin
|
|
|
|
extractPin(obj, key);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!obj[so.key()].is<JsonObject>()) continue;
|
|
|
|
JsonObject subObj = obj[so.key()];
|
|
|
|
if (!subObj["pin"].isNull()) {
|
|
|
|
// get pins from subobject
|
|
|
|
extractPin(subObj, "pin");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-10 19:27:00 +02:00
|
|
|
void appendGPIOinfo() {
|
|
|
|
char nS[8];
|
|
|
|
|
|
|
|
oappend(SET_F("d.um_p=[-1")); // has to have 1 element
|
|
|
|
if (i2c_sda > -1 && i2c_scl > -1) {
|
|
|
|
oappend(","); oappend(itoa(i2c_sda,nS,10));
|
|
|
|
oappend(","); oappend(itoa(i2c_scl,nS,10));
|
|
|
|
}
|
|
|
|
if (spi_mosi > -1 && spi_sclk > -1) {
|
|
|
|
oappend(","); oappend(itoa(spi_mosi,nS,10));
|
|
|
|
oappend(","); oappend(itoa(spi_sclk,nS,10));
|
|
|
|
}
|
|
|
|
// usermod pin reservations will become unnecessary when settings pages will read cfg.json directly
|
|
|
|
if (requestJSONBufferLock(6)) {
|
|
|
|
// if we can't allocate JSON buffer ignore usermod pins
|
|
|
|
JsonObject mods = doc.createNestedObject(F("um"));
|
|
|
|
usermods.addToConfig(mods);
|
|
|
|
if (!mods.isNull()) fillUMPins(mods);
|
|
|
|
releaseJSONBufferLock();
|
|
|
|
}
|
|
|
|
oappend(SET_F("];"));
|
|
|
|
|
|
|
|
// add reserved and usermod pins as d.um_p array
|
2022-09-11 13:17:08 +02:00
|
|
|
#if defined(CONFIG_IDF_TARGET_ESP32S2)
|
2022-09-10 19:27:00 +02:00
|
|
|
oappend(SET_F("d.rsvd=[22,23,24,25,26,27,28,29,30,31,32"));
|
2022-09-11 13:17:08 +02:00
|
|
|
#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)
|
2022-09-10 19:27:00 +02:00
|
|
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
|
|
|
oappend(SET_F("d.rsvd=[11,12,13,14,15,16,17"));
|
|
|
|
#elif defined(ESP32)
|
2022-09-12 21:15:19 +02:00
|
|
|
oappend(SET_F("d.rsvd=[6,7,8,9,10,11,24,28,29,30,31"));
|
2022-09-10 19:27:00 +02:00
|
|
|
#else
|
|
|
|
oappend(SET_F("d.rsvd=[6,7,8,9,10,11"));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WLED_ENABLE_DMX
|
|
|
|
oappend(SET_F(",2")); // DMX hardcoded pin
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef WLED_DEBUG
|
2022-09-11 13:17:08 +02:00
|
|
|
oappend(SET_F(",")); oappend(itoa(hardwareTX,nS,10));// debug output (TX) pin
|
2022-09-10 19:27:00 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
//Note: Using pin 3 (RX) disables Adalight / Serial JSON
|
|
|
|
|
|
|
|
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_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)
|
2022-09-11 13:17:08 +02:00
|
|
|
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
2022-09-12 21:15:19 +02:00
|
|
|
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.
|
2022-09-10 19:27:00 +02:00
|
|
|
#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)); }
|
|
|
|
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)); }
|
|
|
|
switch (ethernetBoards[ethernetType].eth_clk_mode) {
|
|
|
|
case ETH_CLOCK_GPIO0_IN:
|
|
|
|
case ETH_CLOCK_GPIO0_OUT:
|
|
|
|
oappend(SET_F(",0"));
|
|
|
|
break;
|
|
|
|
case ETH_CLOCK_GPIO16_OUT:
|
|
|
|
oappend(SET_F(",16"));
|
|
|
|
break;
|
|
|
|
case ETH_CLOCK_GPIO17_OUT:
|
|
|
|
oappend(SET_F(",17"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
oappend(SET_F("];"));
|
|
|
|
|
|
|
|
// add info for read-only GPIO
|
|
|
|
oappend(SET_F("d.ro_gpio=["));
|
2022-09-10 20:19:13 +02:00
|
|
|
#if defined(CONFIG_IDF_TARGET_ESP32S2)
|
2022-09-10 19:27:00 +02:00
|
|
|
oappendi(46);
|
2022-09-10 20:19:13 +02:00
|
|
|
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
2022-09-11 13:17:08 +02:00
|
|
|
// none for S3
|
2022-09-10 19:27:00 +02:00
|
|
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
|
|
|
// none for C3
|
|
|
|
#elif defined(ESP32)
|
2022-09-11 13:17:08 +02:00
|
|
|
oappend(SET_F("34,35,36,37,38,39"));
|
2022-09-10 19:27:00 +02:00
|
|
|
#else
|
|
|
|
// none for ESP8266
|
|
|
|
#endif
|
|
|
|
oappend(SET_F("];"));
|
|
|
|
|
|
|
|
// add info about max. # of pins
|
|
|
|
oappend(SET_F("d.max_gpio="));
|
2022-09-10 20:19:13 +02:00
|
|
|
#if defined(CONFIG_IDF_TARGET_ESP32S2)
|
2022-09-10 19:27:00 +02:00
|
|
|
oappendi(46);
|
2022-09-10 20:19:13 +02:00
|
|
|
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
|
|
|
oappendi(48);
|
2022-09-10 19:27:00 +02:00
|
|
|
#elif defined(CONFIG_IDF_TARGET_ESP32C3)
|
|
|
|
oappendi(21);
|
|
|
|
#elif defined(ESP32)
|
|
|
|
oappendi(39);
|
|
|
|
#else
|
|
|
|
oappendi(16);
|
|
|
|
#endif
|
|
|
|
oappend(SET_F(";"));
|
|
|
|
}
|
2019-03-11 17:57:06 +01:00
|
|
|
|
2018-11-09 17:00:36 +01:00
|
|
|
//get values for settings form in javascript
|
2019-03-16 02:09:37 +01:00
|
|
|
void getSettingsJS(byte subPage, char* dest)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2018-01-27 23:28:20 +01:00
|
|
|
//0: menu 1: wifi 2: leds 3: ui 4: sync 5: time 6: sec
|
2020-09-20 01:18:31 +02:00
|
|
|
DEBUG_PRINT(F("settings resp"));
|
2018-01-27 23:28:20 +01:00
|
|
|
DEBUG_PRINTLN(subPage);
|
2019-03-16 02:09:37 +01:00
|
|
|
obuf = dest;
|
|
|
|
olen = 0;
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2022-05-08 10:50:48 +02:00
|
|
|
if (subPage <0 || subPage >10) return;
|
2022-03-07 09:44:35 +01:00
|
|
|
|
|
|
|
if (subPage == 0)
|
|
|
|
{
|
2023-01-16 22:09:43 +01:00
|
|
|
#ifndef WLED_DISABLE_2D // include only if 2D is compiled in
|
|
|
|
oappend(PSTR("gId('2dbtn').style.display='';"));
|
|
|
|
#endif
|
2022-03-07 09:44:35 +01:00
|
|
|
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
|
|
|
|
oappend(PSTR("gId('dmxbtn').style.display='';"));
|
|
|
|
#endif
|
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
2021-09-30 16:30:44 +02:00
|
|
|
if (subPage == 1)
|
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("CS"),clientSSID);
|
2018-07-20 19:35:31 +02:00
|
|
|
|
2018-07-21 23:21:07 +02:00
|
|
|
byte l = strlen(clientPass);
|
2018-07-20 19:35:31 +02:00
|
|
|
char fpass[l+1]; //fill password field with ***
|
|
|
|
fpass[l] = 0;
|
2019-08-17 12:27:06 +02:00
|
|
|
memset(fpass,'*',l);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("CP"),fpass);
|
2018-07-20 19:35:31 +02:00
|
|
|
|
|
|
|
char k[3]; k[2] = 0; //IP addresses
|
|
|
|
for (int i = 0; i<4; i++)
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
2018-07-20 19:35:31 +02:00
|
|
|
k[1] = 48+i; //ascii 0,1,2,3
|
|
|
|
k[0] = 'I'; sappend('v',k,staticIP[i]);
|
|
|
|
k[0] = 'G'; sappend('v',k,staticGateway[i]);
|
|
|
|
k[0] = 'S'; sappend('v',k,staticSubnet[i]);
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
2018-07-20 19:35:31 +02:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("CM"),cmDNS);
|
|
|
|
sappend('i',SET_F("AB"),apBehavior);
|
|
|
|
sappends('s',SET_F("AS"),apSSID);
|
|
|
|
sappend('c',SET_F("AH"),apHide);
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-07-21 23:21:07 +02:00
|
|
|
l = strlen(apPass);
|
2018-07-20 19:35:31 +02:00
|
|
|
char fapass[l+1]; //fill password field with ***
|
|
|
|
fapass[l] = 0;
|
2019-08-17 12:27:06 +02:00
|
|
|
memset(fapass,'*',l);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("AP"),fapass);
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("AC"),apChannel);
|
|
|
|
sappend('c',SET_F("WS"),noWifiSleep);
|
2020-02-20 17:08:56 +01:00
|
|
|
|
2021-01-15 10:37:45 +01:00
|
|
|
#ifdef WLED_USE_ETHERNET
|
2021-02-23 00:47:48 +01:00
|
|
|
sappend('v',SET_F("ETH"),ethernetType);
|
2021-01-15 10:37:45 +01:00
|
|
|
#else
|
|
|
|
//hide ethernet setting if not compiled in
|
|
|
|
oappend(SET_F("document.getElementById('ethd').style.display='none';"));
|
|
|
|
#endif
|
2018-07-20 19:35:31 +02:00
|
|
|
|
2020-11-13 18:25:13 +01:00
|
|
|
if (Network.isConnected()) //is connected
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
2020-11-13 18:25:13 +01:00
|
|
|
char s[32];
|
|
|
|
IPAddress localIP = Network.localIP();
|
2018-07-21 23:21:07 +02:00
|
|
|
sprintf(s, "%d.%d.%d.%d", localIP[0], localIP[1], localIP[2], localIP[3]);
|
2020-11-13 18:25:13 +01:00
|
|
|
|
|
|
|
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
|
|
|
|
if (Network.isEthernet()) strcat_P(s ,SET_F(" (Ethernet)"));
|
|
|
|
#endif
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('m',SET_F("(\"sip\")[0]"),s);
|
2018-02-20 22:29:48 +01:00
|
|
|
} else
|
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('m',SET_F("(\"sip\")[0]"),(char*)F("Not connected"));
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2018-07-20 19:35:31 +02:00
|
|
|
if (WiFi.softAPIP()[0] != 0) //is active
|
2018-02-20 22:29:48 +01:00
|
|
|
{
|
2018-07-21 23:21:07 +02:00
|
|
|
char s[16];
|
|
|
|
IPAddress apIP = WiFi.softAPIP();
|
|
|
|
sprintf(s, "%d.%d.%d.%d", apIP[0], apIP[1], apIP[2], apIP[3]);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('m',SET_F("(\"sip\")[1]"),s);
|
2018-02-20 22:29:48 +01:00
|
|
|
} else
|
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('m',SET_F("(\"sip\")[1]"),(char*)F("Not active"));
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2021-09-30 16:30:44 +02:00
|
|
|
if (subPage == 2)
|
|
|
|
{
|
2021-03-06 02:35:49 +01:00
|
|
|
char nS[8];
|
2021-01-17 00:20:31 +01:00
|
|
|
|
2022-09-10 19:27:00 +02:00
|
|
|
appendGPIOinfo();
|
2021-01-17 00:20:31 +01:00
|
|
|
|
2021-05-20 19:54:07 +02:00
|
|
|
// set limits
|
2021-03-07 00:42:21 +01:00
|
|
|
oappend(SET_F("bLimits("));
|
2021-05-20 19:54:07 +02:00
|
|
|
oappend(itoa(WLED_MAX_BUSSES,nS,10)); oappend(",");
|
2022-12-31 17:06:18 +01:00
|
|
|
oappend(itoa(WLED_MIN_VIRTUAL_BUSSES,nS,10)); oappend(",");
|
2021-05-20 19:54:07 +02:00
|
|
|
oappend(itoa(MAX_LEDS_PER_BUS,nS,10)); oappend(",");
|
2022-07-22 08:59:04 +02:00
|
|
|
oappend(itoa(MAX_LED_MEMORY,nS,10)); oappend(",");
|
2021-10-06 14:30:41 +02:00
|
|
|
oappend(itoa(MAX_LEDS,nS,10));
|
2021-03-07 00:42:21 +01:00
|
|
|
oappend(SET_F(");"));
|
2021-01-17 00:20:31 +01:00
|
|
|
|
2021-09-11 01:17:42 +02:00
|
|
|
sappend('c',SET_F("MS"),autoSegments);
|
2021-11-24 11:02:25 +01:00
|
|
|
sappend('c',SET_F("CCT"),correctWB);
|
2021-11-26 20:18:38 +01:00
|
|
|
sappend('c',SET_F("CR"),cctFromRgb);
|
2022-03-08 02:16:33 +01:00
|
|
|
sappend('v',SET_F("CB"),strip.cctBlending);
|
|
|
|
sappend('v',SET_F("FR"),strip.getTargetFps());
|
2022-04-27 12:31:47 +02:00
|
|
|
sappend('v',SET_F("AW"),Bus::getAutoWhiteMode());
|
2022-08-05 23:03:38 +02:00
|
|
|
sappend('v',SET_F("LD"),strip.useLedsArray);
|
2021-01-21 01:21:16 +01:00
|
|
|
|
2021-05-20 19:54:07 +02:00
|
|
|
for (uint8_t s=0; s < busses.getNumBusses(); s++) {
|
2021-01-21 01:21:16 +01:00
|
|
|
Bus* bus = busses.getBus(s);
|
2021-10-25 20:15:42 +02:00
|
|
|
if (bus == nullptr) continue;
|
2021-01-26 01:58:34 +01:00
|
|
|
char lp[4] = "L0"; lp[2] = 48+s; lp[3] = 0; //ascii 0-9 //strip data pin
|
2021-01-26 00:19:41 +01:00
|
|
|
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
|
2021-05-17 16:23:46 +02:00
|
|
|
char sl[4] = "SL"; sl[2] = 48+s; sl[3] = 0; //skip 1st LED
|
2021-10-11 02:19:33 +02:00
|
|
|
char rf[4] = "RF"; rf[2] = 48+s; rf[3] = 0; //off refresh
|
2022-03-09 13:39:51 +01:00
|
|
|
char aw[4] = "AW"; aw[2] = 48+s; aw[3] = 0; //auto white mode
|
2022-04-30 12:45:38 +02:00
|
|
|
char wo[4] = "WO"; wo[2] = 48+s; wo[3] = 0; //swap channels
|
2021-01-17 00:20:31 +01:00
|
|
|
oappend(SET_F("addLEDs(1);"));
|
2021-01-21 01:21:16 +01:00
|
|
|
uint8_t pins[5];
|
|
|
|
uint8_t nPins = bus->getPins(pins);
|
2021-02-24 14:49:39 +01:00
|
|
|
for (uint8_t i = 0; i < nPins; i++) {
|
|
|
|
lp[1] = 48+i;
|
2021-10-06 14:30:41 +02:00
|
|
|
if (pinManager.isPinOk(pins[i]) || bus->getType()>=TYPE_NET_DDP_RGB) sappend('v',lp,pins[i]);
|
2021-02-24 14:49:39 +01:00
|
|
|
}
|
2021-09-30 16:30:44 +02:00
|
|
|
sappend('v',lc,bus->getLength());
|
2021-01-21 01:21:16 +01:00
|
|
|
sappend('v',lt,bus->getType());
|
2022-04-30 12:45:38 +02:00
|
|
|
sappend('v',co,bus->getColorOrder() & 0x0F);
|
2021-01-26 00:19:41 +01:00
|
|
|
sappend('v',ls,bus->getStart());
|
2021-01-31 00:38:27 +01:00
|
|
|
sappend('c',cv,bus->reversed);
|
2022-03-16 01:45:07 +01:00
|
|
|
sappend('v',sl,bus->skippedLeds());
|
2021-10-11 02:19:33 +02:00
|
|
|
sappend('c',rf,bus->isOffRefreshRequired());
|
2022-03-26 23:20:14 +01:00
|
|
|
sappend('v',aw,bus->getAWMode());
|
2022-04-30 12:45:38 +02:00
|
|
|
sappend('v',wo,bus->getColorOrder() >> 4);
|
2021-01-17 00:20:31 +01:00
|
|
|
}
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("MA"),strip.ablMilliampsMax);
|
|
|
|
sappend('v',SET_F("LA"),strip.milliampsPerLed);
|
2018-12-04 00:58:06 +01:00
|
|
|
if (strip.currentMilliamps)
|
|
|
|
{
|
2021-02-27 00:20:31 +01:00
|
|
|
sappends('m',SET_F("(\"pow\")[0]"),(char*)"");
|
2018-12-04 00:58:06 +01:00
|
|
|
olen -= 2; //delete ";
|
|
|
|
oappendi(strip.currentMilliamps);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F("mA\";"));
|
2018-12-04 00:58:06 +01:00
|
|
|
}
|
2019-12-04 02:01:47 +01:00
|
|
|
|
2022-01-26 00:42:04 +01:00
|
|
|
oappend(SET_F("resetCOM("));
|
|
|
|
oappend(itoa(WLED_MAX_COLOR_ORDER_MAPPINGS,nS,10));
|
|
|
|
oappend(SET_F(");"));
|
|
|
|
const ColorOrderMap& com = busses.getColorOrderMap();
|
|
|
|
for (uint8_t s=0; s < com.count(); s++) {
|
|
|
|
const ColorOrderMapEntry* entry = com.get(s);
|
|
|
|
if (entry == nullptr) break;
|
|
|
|
oappend(SET_F("addCOM("));
|
|
|
|
oappend(itoa(entry->start,nS,10)); oappend(",");
|
|
|
|
oappend(itoa(entry->len,nS,10)); oappend(",");
|
|
|
|
oappend(itoa(entry->colorOrder,nS,10)); oappend(");");
|
|
|
|
}
|
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("CA"),briS);
|
|
|
|
|
|
|
|
sappend('c',SET_F("BO"),turnOnAtBoot);
|
|
|
|
sappend('v',SET_F("BP"),bootPreset);
|
|
|
|
|
2022-09-04 20:17:05 +02:00
|
|
|
sappend('c',SET_F("GB"),gammaCorrectBri);
|
|
|
|
sappend('c',SET_F("GC"),gammaCorrectCol);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("TF"),fadeTransition);
|
|
|
|
sappend('v',SET_F("TD"),transitionDelayDefault);
|
|
|
|
sappend('c',SET_F("PF"),strip.paletteFade);
|
|
|
|
sappend('v',SET_F("BF"),briMultiplier);
|
|
|
|
sappend('v',SET_F("TB"),nightlightTargetBri);
|
|
|
|
sappend('v',SET_F("TL"),nightlightDelayMinsDefault);
|
|
|
|
sappend('v',SET_F("TW"),nightlightMode);
|
|
|
|
sappend('i',SET_F("PB"),strip.paletteBlend);
|
2021-01-17 00:20:31 +01:00
|
|
|
sappend('v',SET_F("RL"),rlyPin);
|
|
|
|
sappend('c',SET_F("RM"),rlyMde);
|
2021-05-20 19:54:07 +02:00
|
|
|
for (uint8_t i=0; i<WLED_MAX_BUTTONS; i++) {
|
|
|
|
oappend(SET_F("addBtn("));
|
|
|
|
oappend(itoa(i,nS,10)); oappend(",");
|
|
|
|
oappend(itoa(btnPin[i],nS,10)); oappend(",");
|
|
|
|
oappend(itoa(buttonType[i],nS,10));
|
|
|
|
oappend(SET_F(");"));
|
|
|
|
}
|
2022-11-26 23:56:55 +01:00
|
|
|
sappend('c',SET_F("IP"),disablePullUp);
|
2021-05-20 19:54:07 +02:00
|
|
|
sappend('v',SET_F("TT"),touchThreshold);
|
2021-01-17 00:20:31 +01:00
|
|
|
sappend('v',SET_F("IR"),irPin);
|
2021-05-20 19:54:07 +02:00
|
|
|
sappend('v',SET_F("IT"),irEnabled);
|
2022-02-26 01:37:09 +01:00
|
|
|
sappend('c',SET_F("MSO"),!irApplyToAllSelected);
|
2016-12-29 00:03:58 +01:00
|
|
|
}
|
2017-11-20 00:07:37 +01:00
|
|
|
|
2018-02-20 22:29:48 +01:00
|
|
|
if (subPage == 3)
|
2019-08-17 12:27:06 +02:00
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("DS"),serverDescription);
|
|
|
|
sappend('c',SET_F("ST"),syncToggleReceive);
|
2022-03-31 21:44:11 +02:00
|
|
|
#ifdef WLED_ENABLE_SIMPLE_UI
|
2022-03-07 09:44:35 +01:00
|
|
|
sappend('c',SET_F("SU"),simplifiedUI);
|
2022-12-13 22:25:12 +01:00
|
|
|
#else
|
|
|
|
oappend(SET_F("toggle('Simple');")); // hide Simplified UI settings
|
2022-03-31 21:44:11 +02:00
|
|
|
#endif
|
2017-11-20 00:07:37 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 4)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("UP"),udpPort);
|
2020-09-27 11:43:28 +02:00
|
|
|
sappend('v',SET_F("U2"),udpPort2);
|
2021-08-25 16:39:12 +02:00
|
|
|
sappend('v',SET_F("GS"),syncGroups);
|
|
|
|
sappend('v',SET_F("GR"),receiveGroups);
|
2021-08-19 18:24:41 +02:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("RB"),receiveNotificationBrightness);
|
|
|
|
sappend('c',SET_F("RC"),receiveNotificationColor);
|
|
|
|
sappend('c',SET_F("RX"),receiveNotificationEffects);
|
2021-12-17 20:33:48 +01:00
|
|
|
sappend('c',SET_F("SO"),receiveSegmentOptions);
|
2022-02-16 14:55:35 +01:00
|
|
|
sappend('c',SET_F("SG"),receiveSegmentBounds);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("SD"),notifyDirectDefault);
|
|
|
|
sappend('c',SET_F("SB"),notifyButton);
|
|
|
|
sappend('c',SET_F("SH"),notifyHue);
|
|
|
|
sappend('c',SET_F("SM"),notifyMacro);
|
2022-10-19 01:31:23 +02:00
|
|
|
sappend('v',SET_F("UR"),udpNumRetries);
|
2021-03-13 22:04:37 +01:00
|
|
|
|
|
|
|
sappend('c',SET_F("NL"),nodeListEnabled);
|
|
|
|
sappend('c',SET_F("NB"),nodeBroadcastEnabled);
|
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("RD"),receiveDirect);
|
2022-03-25 16:36:05 +01:00
|
|
|
sappend('c',SET_F("MO"),useMainSegmentOnly);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("EP"),e131Port);
|
|
|
|
sappend('c',SET_F("ES"),e131SkipOutOfSequence);
|
|
|
|
sappend('c',SET_F("EM"),e131Multicast);
|
|
|
|
sappend('v',SET_F("EU"),e131Universe);
|
|
|
|
sappend('v',SET_F("DA"),DMXAddress);
|
2022-11-19 14:10:40 +01:00
|
|
|
sappend('v',SET_F("XX"),DMXSegmentSpacing);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("DM"),DMXMode);
|
|
|
|
sappend('v',SET_F("ET"),realtimeTimeoutMs);
|
|
|
|
sappend('c',SET_F("FB"),arlsForceMaxBri);
|
|
|
|
sappend('c',SET_F("RG"),arlsDisableGammaCorrection);
|
|
|
|
sappend('v',SET_F("WO"),arlsOffset);
|
|
|
|
sappend('c',SET_F("AL"),alexaEnabled);
|
|
|
|
sappends('s',SET_F("AI"),alexaInvocationName);
|
|
|
|
sappend('c',SET_F("SA"),notifyAlexa);
|
2022-10-25 23:42:26 +02:00
|
|
|
sappend('v',SET_F("AP"),alexaNumPresets);
|
2022-11-11 20:20:11 +01:00
|
|
|
#ifdef WLED_DISABLE_ALEXA
|
|
|
|
oappend(SET_F("toggle('Alexa');")); // hide Alexa settings
|
|
|
|
#endif
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("BK"),(char*)((blynkEnabled)?SET_F("Hidden"):""));
|
2021-05-20 19:54:07 +02:00
|
|
|
#ifndef WLED_DISABLE_BLYNK
|
2020-12-22 00:44:16 +01:00
|
|
|
sappends('s',SET_F("BH"),blynkHost);
|
|
|
|
sappend('v',SET_F("BP"),blynkPort);
|
2022-11-11 20:20:11 +01:00
|
|
|
#else
|
|
|
|
oappend(SET_F("toggle('Blynk');")); // hide BLYNK settings
|
2021-05-20 19:54:07 +02:00
|
|
|
#endif
|
2019-12-11 00:59:15 +01:00
|
|
|
|
|
|
|
#ifdef WLED_ENABLE_MQTT
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("MQ"),mqttEnabled);
|
|
|
|
sappends('s',SET_F("MS"),mqttServer);
|
|
|
|
sappend('v',SET_F("MQPORT"),mqttPort);
|
|
|
|
sappends('s',SET_F("MQUSER"),mqttUser);
|
2019-08-18 18:14:17 +02:00
|
|
|
byte l = strlen(mqttPass);
|
|
|
|
char fpass[l+1]; //fill password field with ***
|
|
|
|
fpass[l] = 0;
|
|
|
|
memset(fpass,'*',l);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("MQPASS"),fpass);
|
|
|
|
sappends('s',SET_F("MQCID"),mqttClientID);
|
2021-12-31 14:09:48 +01:00
|
|
|
sappends('s',"MD",mqttDeviceTopic);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('s',SET_F("MG"),mqttGroupTopic);
|
2021-07-01 20:51:52 +02:00
|
|
|
sappend('c',SET_F("BM"),buttonPublishMqtt);
|
2022-11-11 20:20:11 +01:00
|
|
|
#else
|
|
|
|
oappend(SET_F("toggle('MQTT');")); // hide MQTT settings
|
2019-12-11 00:59:15 +01:00
|
|
|
#endif
|
|
|
|
|
2020-02-25 02:19:12 +01:00
|
|
|
#ifndef WLED_DISABLE_HUESYNC
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("H0"),hueIP[0]);
|
|
|
|
sappend('v',SET_F("H1"),hueIP[1]);
|
|
|
|
sappend('v',SET_F("H2"),hueIP[2]);
|
|
|
|
sappend('v',SET_F("H3"),hueIP[3]);
|
|
|
|
sappend('v',SET_F("HL"),huePollLightId);
|
|
|
|
sappend('v',SET_F("HI"),huePollIntervalMs);
|
|
|
|
sappend('c',SET_F("HP"),huePollingEnabled);
|
|
|
|
sappend('c',SET_F("HO"),hueApplyOnOff);
|
|
|
|
sappend('c',SET_F("HB"),hueApplyBri);
|
|
|
|
sappend('c',SET_F("HC"),hueApplyColor);
|
2020-02-25 02:19:12 +01:00
|
|
|
char hueErrorString[25];
|
|
|
|
switch (hueError)
|
|
|
|
{
|
2022-09-10 19:27:00 +02:00
|
|
|
case HUE_ERROR_INACTIVE : strcpy_P(hueErrorString,PSTR("Inactive")); break;
|
|
|
|
case HUE_ERROR_ACTIVE : strcpy_P(hueErrorString,PSTR("Active")); break;
|
|
|
|
case HUE_ERROR_UNAUTHORIZED : strcpy_P(hueErrorString,PSTR("Unauthorized")); break;
|
|
|
|
case HUE_ERROR_LIGHTID : strcpy_P(hueErrorString,PSTR("Invalid light ID")); break;
|
|
|
|
case HUE_ERROR_PUSHLINK : strcpy_P(hueErrorString,PSTR("Link button not pressed")); break;
|
|
|
|
case HUE_ERROR_JSON_PARSING : strcpy_P(hueErrorString,PSTR("JSON parsing error")); break;
|
|
|
|
case HUE_ERROR_TIMEOUT : strcpy_P(hueErrorString,PSTR("Timeout")); break;
|
|
|
|
default: sprintf_P(hueErrorString,PSTR("Bridge Error %i"),hueError);
|
2020-02-25 02:19:12 +01:00
|
|
|
}
|
2023-01-06 09:24:29 +01:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('m',SET_F("(\"sip\")[0]"),hueErrorString);
|
2022-11-11 20:20:11 +01:00
|
|
|
#else
|
|
|
|
oappend(SET_F("toggle('Hue');")); // hide Hue Sync settings
|
2019-12-11 00:59:15 +01:00
|
|
|
#endif
|
2022-02-01 20:02:46 +01:00
|
|
|
sappend('v',SET_F("BD"),serialBaud);
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
|
|
|
|
if (subPage == 5)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("NT"),ntpEnabled);
|
|
|
|
sappends('s',SET_F("NS"),ntpServerName);
|
|
|
|
sappend('c',SET_F("CF"),!useAMPM);
|
|
|
|
sappend('i',SET_F("TZ"),currentTimezone);
|
|
|
|
sappend('v',SET_F("UO"),utcOffsetSecs);
|
2019-03-16 02:09:37 +01:00
|
|
|
char tm[32];
|
2021-04-12 21:53:22 +02:00
|
|
|
dtostrf(longitude,4,2,tm);
|
|
|
|
sappends('s',SET_F("LN"),tm);
|
|
|
|
dtostrf(latitude,4,2,tm);
|
|
|
|
sappends('s',SET_F("LT"),tm);
|
2019-08-17 12:27:06 +02:00
|
|
|
getTimeString(tm);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappends('m',SET_F("(\"times\")[0]"),tm);
|
2021-04-12 21:53:22 +02:00
|
|
|
if ((int)(longitude*10.) || (int)(latitude*10.)) {
|
|
|
|
sprintf_P(tm, PSTR("Sunrise: %02d:%02d Sunset: %02d:%02d"), hour(sunrise), minute(sunrise), hour(sunset), minute(sunset));
|
|
|
|
sappends('m',SET_F("(\"times\")[1]"),tm);
|
|
|
|
}
|
2022-03-07 00:11:43 +01:00
|
|
|
sappend('c',SET_F("OL"),overlayCurrent);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("O1"),overlayMin);
|
|
|
|
sappend('v',SET_F("O2"),overlayMax);
|
|
|
|
sappend('v',SET_F("OM"),analogClock12pixel);
|
|
|
|
sappend('c',SET_F("OS"),analogClockSecondsTrail);
|
|
|
|
sappend('c',SET_F("O5"),analogClock5MinuteMarks);
|
2022-03-06 23:47:36 +01:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("CE"),countdownMode);
|
|
|
|
sappend('v',SET_F("CY"),countdownYear);
|
|
|
|
sappend('v',SET_F("CI"),countdownMonth);
|
|
|
|
sappend('v',SET_F("CD"),countdownDay);
|
|
|
|
sappend('v',SET_F("CH"),countdownHour);
|
|
|
|
sappend('v',SET_F("CM"),countdownMin);
|
|
|
|
sappend('v',SET_F("CS"),countdownSec);
|
2019-08-17 12:27:06 +02:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("A0"),macroAlexaOn);
|
|
|
|
sappend('v',SET_F("A1"),macroAlexaOff);
|
|
|
|
sappend('v',SET_F("MC"),macroCountdown);
|
|
|
|
sappend('v',SET_F("MN"),macroNl);
|
2021-05-20 19:54:07 +02:00
|
|
|
for (uint8_t i=0; i<WLED_MAX_BUTTONS; i++) {
|
|
|
|
oappend(SET_F("addRow("));
|
|
|
|
oappend(itoa(i,tm,10)); oappend(",");
|
|
|
|
oappend(itoa(macroButton[i],tm,10)); oappend(",");
|
|
|
|
oappend(itoa(macroLongPress[i],tm,10)); oappend(",");
|
|
|
|
oappend(itoa(macroDoublePress[i],tm,10));
|
|
|
|
oappend(SET_F(");"));
|
|
|
|
}
|
2018-09-22 22:49:24 +02:00
|
|
|
|
2020-11-06 22:12:48 +01:00
|
|
|
char k[4];
|
2018-09-22 22:49:24 +02:00
|
|
|
k[2] = 0; //Time macros
|
2021-04-12 21:53:22 +02:00
|
|
|
for (int i = 0; i<10; i++)
|
2018-09-22 22:49:24 +02:00
|
|
|
{
|
|
|
|
k[1] = 48+i; //ascii 0,1,2,3
|
2021-04-12 21:53:22 +02:00
|
|
|
if (i<8) { k[0] = 'H'; sappend('v',k,timerHours[i]); }
|
2018-09-22 22:49:24 +02:00
|
|
|
k[0] = 'N'; sappend('v',k,timerMinutes[i]);
|
|
|
|
k[0] = 'T'; sappend('v',k,timerMacro[i]);
|
2019-01-31 00:09:44 +01:00
|
|
|
k[0] = 'W'; sappend('v',k,timerWeekday[i]);
|
2021-12-31 14:09:48 +01:00
|
|
|
if (i<8) {
|
|
|
|
k[0] = 'M'; sappend('v',k,(timerMonth[i] >> 4) & 0x0F);
|
|
|
|
k[0] = 'P'; sappend('v',k,timerMonth[i] & 0x0F);
|
|
|
|
k[0] = 'D'; sappend('v',k,timerDay[i]);
|
|
|
|
k[0] = 'E'; sappend('v',k,timerDayEnd[i]);
|
|
|
|
}
|
2018-09-22 22:49:24 +02:00
|
|
|
}
|
2018-02-20 22:29:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (subPage == 6)
|
2016-11-19 19:39:17 +01:00
|
|
|
{
|
2022-04-27 12:31:47 +02:00
|
|
|
byte l = strlen(settingsPIN);
|
|
|
|
char fpass[l+1]; //fill PIN field with 0000
|
|
|
|
fpass[l] = 0;
|
|
|
|
memset(fpass,'0',l);
|
|
|
|
sappends('s',SET_F("PIN"),fpass);
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('c',SET_F("NO"),otaLock);
|
|
|
|
sappend('c',SET_F("OW"),wifiLock);
|
|
|
|
sappend('c',SET_F("AO"),aOtaEnabled);
|
|
|
|
sappends('m',SET_F("(\"sip\")[0]"),(char*)F("WLED "));
|
2018-07-20 19:35:31 +02:00
|
|
|
olen -= 2; //delete ";
|
|
|
|
oappend(versionString);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F(" (build "));
|
2018-07-20 19:35:31 +02:00
|
|
|
oappendi(VERSION);
|
2020-09-20 01:18:31 +02:00
|
|
|
oappend(SET_F(")\";"));
|
2022-08-05 12:09:13 +02:00
|
|
|
oappend(SET_F("sd=\""));
|
|
|
|
oappend(serverDescription);
|
|
|
|
oappend(SET_F("\";"));
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|
2023-01-06 09:24:29 +01:00
|
|
|
|
2020-02-23 22:24:51 +01:00
|
|
|
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
|
|
|
|
if (subPage == 7)
|
|
|
|
{
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("PU"),e131ProxyUniverse);
|
2023-01-06 09:24:29 +01:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('v',SET_F("CN"),DMXChannels);
|
|
|
|
sappend('v',SET_F("CG"),DMXGap);
|
|
|
|
sappend('v',SET_F("CS"),DMXStart);
|
|
|
|
sappend('v',SET_F("SL"),DMXStartLED);
|
2023-01-06 09:24:29 +01:00
|
|
|
|
2020-09-20 01:18:31 +02:00
|
|
|
sappend('i',SET_F("CH1"),DMXFixtureMap[0]);
|
|
|
|
sappend('i',SET_F("CH2"),DMXFixtureMap[1]);
|
|
|
|
sappend('i',SET_F("CH3"),DMXFixtureMap[2]);
|
|
|
|
sappend('i',SET_F("CH4"),DMXFixtureMap[3]);
|
|
|
|
sappend('i',SET_F("CH5"),DMXFixtureMap[4]);
|
|
|
|
sappend('i',SET_F("CH6"),DMXFixtureMap[5]);
|
|
|
|
sappend('i',SET_F("CH7"),DMXFixtureMap[6]);
|
|
|
|
sappend('i',SET_F("CH8"),DMXFixtureMap[7]);
|
|
|
|
sappend('i',SET_F("CH9"),DMXFixtureMap[8]);
|
|
|
|
sappend('i',SET_F("CH10"),DMXFixtureMap[9]);
|
|
|
|
sappend('i',SET_F("CH11"),DMXFixtureMap[10]);
|
|
|
|
sappend('i',SET_F("CH12"),DMXFixtureMap[11]);
|
|
|
|
sappend('i',SET_F("CH13"),DMXFixtureMap[12]);
|
|
|
|
sappend('i',SET_F("CH14"),DMXFixtureMap[13]);
|
|
|
|
sappend('i',SET_F("CH15"),DMXFixtureMap[14]);
|
2021-05-11 23:21:57 +02:00
|
|
|
}
|
2020-02-23 22:24:51 +01:00
|
|
|
#endif
|
2021-05-11 23:21:57 +02:00
|
|
|
|
|
|
|
if (subPage == 8) //usermods
|
|
|
|
{
|
2022-09-10 19:27:00 +02:00
|
|
|
appendGPIOinfo();
|
2021-05-11 23:21:57 +02:00
|
|
|
oappend(SET_F("numM="));
|
|
|
|
oappendi(usermods.getModCount());
|
|
|
|
oappend(";");
|
2022-08-07 16:43:29 +02:00
|
|
|
sappend('v',SET_F("SDA"),i2c_sda);
|
|
|
|
sappend('v',SET_F("SCL"),i2c_scl);
|
|
|
|
sappend('v',SET_F("MOSI"),spi_mosi);
|
2022-08-25 21:57:43 +02:00
|
|
|
sappend('v',SET_F("MISO"),spi_miso);
|
2022-08-07 16:43:29 +02:00
|
|
|
sappend('v',SET_F("SCLK"),spi_sclk);
|
2022-08-15 20:23:47 +02:00
|
|
|
oappend(SET_F("addInfo('SDA','")); oappendi(HW_PIN_SDA); oappend(SET_F("');"));
|
|
|
|
oappend(SET_F("addInfo('SCL','")); oappendi(HW_PIN_SCL); oappend(SET_F("');"));
|
|
|
|
oappend(SET_F("addInfo('MOSI','")); oappendi(HW_PIN_DATASPI); oappend(SET_F("');"));
|
2022-08-31 21:21:53 +02:00
|
|
|
oappend(SET_F("addInfo('MISO','")); oappendi(HW_PIN_MISOSPI); oappend(SET_F("');"));
|
2022-08-15 20:23:47 +02:00
|
|
|
oappend(SET_F("addInfo('SCLK','")); oappendi(HW_PIN_CLOCKSPI); oappend(SET_F("');"));
|
2022-06-11 18:55:23 +02:00
|
|
|
usermods.appendConfigData();
|
2021-05-11 23:21:57 +02:00
|
|
|
}
|
|
|
|
|
2022-03-07 09:44:35 +01:00
|
|
|
if (subPage == 9) // update
|
|
|
|
{
|
|
|
|
sappends('m',SET_F("(\"sip\")[0]"),(char*)F("WLED "));
|
|
|
|
olen -= 2; //delete ";
|
|
|
|
oappend(versionString);
|
2022-11-09 20:09:01 +01:00
|
|
|
oappend(SET_F("<br>("));
|
|
|
|
#if defined(ARDUINO_ARCH_ESP32)
|
|
|
|
oappend(ESP.getChipModel());
|
2022-03-07 09:44:35 +01:00
|
|
|
#else
|
2022-11-09 20:09:01 +01:00
|
|
|
oappend("esp8266");
|
2022-03-07 09:44:35 +01:00
|
|
|
#endif
|
|
|
|
oappend(SET_F(" build "));
|
|
|
|
oappendi(VERSION);
|
|
|
|
oappend(SET_F(")\";"));
|
|
|
|
}
|
2022-05-08 10:50:48 +02:00
|
|
|
|
|
|
|
if (subPage == 10) // 2D matrices
|
|
|
|
{
|
|
|
|
sappend('v',SET_F("SOMP"),strip.isMatrix);
|
2022-07-10 22:23:25 +02:00
|
|
|
#ifndef WLED_DISABLE_2D
|
2023-01-02 20:56:00 +01:00
|
|
|
oappend(SET_F("maxPanels=")); oappendi(WLED_MAX_PANELS); oappend(SET_F(";"));
|
2022-05-08 10:50:48 +02:00
|
|
|
oappend(SET_F("resetPanels();"));
|
|
|
|
if (strip.isMatrix) {
|
2023-01-02 20:56:00 +01:00
|
|
|
if(strip.panels>0){
|
|
|
|
sappend('v',SET_F("PW"),strip.panel[0].width); //Set generator Width and Height to first panel size for convenience
|
|
|
|
sappend('v',SET_F("PH"),strip.panel[0].height);
|
|
|
|
}
|
|
|
|
sappend('v',SET_F("MPC"),strip.panels);
|
2022-05-08 10:50:48 +02:00
|
|
|
sappend('v',SET_F("PB"),strip.matrix.bottomStart);
|
|
|
|
sappend('v',SET_F("PR"),strip.matrix.rightStart);
|
|
|
|
sappend('v',SET_F("PV"),strip.matrix.vertical);
|
|
|
|
sappend('c',SET_F("PS"),strip.matrix.serpentine);
|
|
|
|
// panels
|
2023-01-02 20:56:00 +01:00
|
|
|
for (uint8_t i=0; i<strip.panels; i++) {
|
2022-05-08 10:50:48 +02:00
|
|
|
char n[5];
|
|
|
|
oappend(SET_F("addPanel("));
|
|
|
|
oappend(itoa(i,n,10));
|
|
|
|
oappend(SET_F(");"));
|
2023-01-03 14:17:42 +01:00
|
|
|
char pO[8] = { '\0' };
|
2023-01-03 15:16:45 +01:00
|
|
|
snprintf_P(pO, 7, PSTR("P%d"), i); // MAX_PANELS is 64 so pO will always only be 4 characters or less
|
2023-01-03 14:17:42 +01:00
|
|
|
pO[7] = '\0';
|
|
|
|
uint8_t l = strlen(pO);
|
2023-01-03 15:16:45 +01:00
|
|
|
// create P0B, P1B, ..., P63B, etc for other PxxX
|
2022-05-08 10:50:48 +02:00
|
|
|
pO[l] = 'B'; sappend('v',pO,strip.panel[i].bottomStart);
|
|
|
|
pO[l] = 'R'; sappend('v',pO,strip.panel[i].rightStart);
|
|
|
|
pO[l] = 'V'; sappend('v',pO,strip.panel[i].vertical);
|
|
|
|
pO[l] = 'S'; sappend('c',pO,strip.panel[i].serpentine);
|
2023-01-02 20:56:00 +01:00
|
|
|
pO[l] = 'X'; sappend('v',pO,strip.panel[i].xOffset);
|
|
|
|
pO[l] = 'Y'; sappend('v',pO,strip.panel[i].yOffset);
|
|
|
|
pO[l] = 'W'; sappend('v',pO,strip.panel[i].width);
|
|
|
|
pO[l] = 'H'; sappend('v',pO,strip.panel[i].height);
|
2022-05-08 10:50:48 +02:00
|
|
|
}
|
|
|
|
}
|
2022-07-10 22:23:25 +02:00
|
|
|
#else
|
|
|
|
oappend(SET_F("gId(\"somp\").remove(1);")); // remove 2D option from dropdown
|
|
|
|
#endif
|
2022-05-08 10:50:48 +02:00
|
|
|
}
|
2016-11-19 19:39:17 +01:00
|
|
|
}
|