Merge branch 'dev' of https://github.com/aircoookie/WLED into dev
Conflicts: wled00/cfg.cpp wled00/data/index.js wled00/fcn_declare.h wled00/html_ui.h wled00/json.cpp wled00/playlist.cpp wled00/wled.h
This commit is contained in:
commit
0f7e22d8b7
@ -2,6 +2,11 @@
|
||||
|
||||
### Development versions after 0.11.1 release
|
||||
|
||||
#### Build 2103130
|
||||
|
||||
- Added options for Auto Node discovery
|
||||
- Optimized strings (no string both F() and raw)
|
||||
|
||||
#### Build 2103090
|
||||
|
||||
- Added Auto Node discovery (PR #1683)
|
||||
|
159
wled00/cfg.cpp
159
wled00/cfg.cpp
@ -30,12 +30,12 @@ void deserializeConfig() {
|
||||
return;
|
||||
}
|
||||
|
||||
//int rev_major = doc[F("rev")][0]; // 1
|
||||
//int rev_minor = doc[F("rev")][1]; // 0
|
||||
//int rev_major = doc["rev"][0]; // 1
|
||||
//int rev_minor = doc["rev"][1]; // 0
|
||||
|
||||
//long vid = doc[F("vid")]; // 2010020
|
||||
|
||||
JsonObject id = doc[F("id")];
|
||||
JsonObject id = doc["id"];
|
||||
getStringFromJson(cmDNS, id[F("mdns")], 33);
|
||||
getStringFromJson(serverDescription, id[F("name")], 33);
|
||||
getStringFromJson(alexaInvocationName, id[F("inv")], 33);
|
||||
@ -47,9 +47,9 @@ void deserializeConfig() {
|
||||
//If it is present however, we will use it
|
||||
getStringFromJson(clientPass, nw_ins_0["psk"], 65);
|
||||
|
||||
JsonArray nw_ins_0_ip = nw_ins_0[F("ip")];
|
||||
JsonArray nw_ins_0_gw = nw_ins_0[F("gw")];
|
||||
JsonArray nw_ins_0_sn = nw_ins_0[F("sn")];
|
||||
JsonArray nw_ins_0_ip = nw_ins_0["ip"];
|
||||
JsonArray nw_ins_0_gw = nw_ins_0["gw"];
|
||||
JsonArray nw_ins_0_sn = nw_ins_0["sn"];
|
||||
|
||||
for (byte i = 0; i < 4; i++) {
|
||||
CJSON(staticIP[i], nw_ins_0_ip[i]);
|
||||
@ -57,7 +57,7 @@ void deserializeConfig() {
|
||||
CJSON(staticSubnet[i], nw_ins_0_sn[i]);
|
||||
}
|
||||
|
||||
JsonObject ap = doc[F("ap")];
|
||||
JsonObject ap = doc["ap"];
|
||||
getStringFromJson(apSSID, ap[F("ssid")], 33);
|
||||
getStringFromJson(apPass, ap["psk"] , 65); //normally not present due to security
|
||||
//int ap_pskl = ap[F("pskl")];
|
||||
@ -72,11 +72,11 @@ void deserializeConfig() {
|
||||
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
JsonObject ethernet = doc[F("eth")];
|
||||
CJSON(ethernetType, ethernet[F("type")]);
|
||||
CJSON(ethernetType, ethernet["type"]);
|
||||
#endif
|
||||
|
||||
/*
|
||||
JsonArray ap_ip = ap[F("ip")];
|
||||
JsonArray ap_ip = ap["ip"];
|
||||
for (byte i = 0; i < 4; i++) {
|
||||
apIP[i] = ap_ip;
|
||||
}
|
||||
@ -97,7 +97,7 @@ void deserializeConfig() {
|
||||
|
||||
CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]);
|
||||
CJSON(strip.milliampsPerLed, hw_led[F("ledma")]);
|
||||
//CJSON(strip.reverseMode, hw_led[F("rev")]);
|
||||
//CJSON(strip.reverseMode, hw_led["rev"]);
|
||||
CJSON(strip.rgbwMode, hw_led[F("rgbwm")]);
|
||||
|
||||
JsonArray ins = hw_led["ins"];
|
||||
@ -109,7 +109,7 @@ void deserializeConfig() {
|
||||
for (JsonObject elm : ins) {
|
||||
if (s >= WLED_MAX_BUSSES) break;
|
||||
uint8_t pins[5] = {255, 255, 255, 255, 255};
|
||||
JsonArray pinArr = elm[F("pin")];
|
||||
JsonArray pinArr = elm["pin"];
|
||||
if (pinArr.size() == 0) continue;
|
||||
uint8_t i = 0;
|
||||
for (int p : pinArr) {
|
||||
@ -126,8 +126,8 @@ void deserializeConfig() {
|
||||
uint8_t colorOrder = (int)elm[F("order")];
|
||||
//(this shouldn't have been in ins obj. but remains here for compatibility)
|
||||
skipFirstLed |= skipFirst = (bool) elm[F("skip")];
|
||||
uint8_t ledType = elm[F("type")] | TYPE_WS2812_RGB;
|
||||
bool reversed = elm[F("rev")];
|
||||
uint8_t ledType = elm["type"] | TYPE_WS2812_RGB;
|
||||
bool reversed = elm["rev"];
|
||||
//RGBW mode is enabled if at least one of the strips is RGBW
|
||||
if ((bool)elm[F("rgbw")]) SET_BIT(ledType,7); else UNSET_BIT(ledType,7); // hack bit 7 to indicate RGBW (as an override if necessary)
|
||||
useRGBW |= (bool)elm[F("rgbw")];
|
||||
@ -141,8 +141,8 @@ void deserializeConfig() {
|
||||
//strip.finalizeInit(); // will be done in WLED::beginStrip()
|
||||
|
||||
JsonObject hw_btn_ins_0 = hw[F("btn")][F("ins")][0];
|
||||
CJSON(buttonEnabled, hw_btn_ins_0[F("type")]);
|
||||
int hw_btn_pin = hw_btn_ins_0[F("pin")][0];
|
||||
CJSON(buttonEnabled, hw_btn_ins_0["type"]);
|
||||
int hw_btn_pin = hw_btn_ins_0["pin"][0];
|
||||
if (pinManager.allocatePin(hw_btn_pin,false)) {
|
||||
btnPin = hw_btn_pin;
|
||||
pinMode(btnPin, INPUT_PULLUP);
|
||||
@ -155,20 +155,20 @@ void deserializeConfig() {
|
||||
CJSON(macroLongPress,hw_btn_ins_0_macros[1]);
|
||||
CJSON(macroDoublePress, hw_btn_ins_0_macros[2]);
|
||||
|
||||
//int hw_btn_ins_0_type = hw_btn_ins_0[F("type")]; // 0
|
||||
//int hw_btn_ins_0_type = hw_btn_ins_0["type"]; // 0
|
||||
|
||||
#ifndef WLED_DISABLE_INFRARED
|
||||
int hw_ir_pin = hw[F("ir")][F("pin")]; // 4
|
||||
int hw_ir_pin = hw["ir"]["pin"]; // 4
|
||||
if (pinManager.allocatePin(hw_ir_pin,false)) {
|
||||
irPin = hw_ir_pin;
|
||||
} else {
|
||||
irPin = -1;
|
||||
}
|
||||
#endif
|
||||
CJSON(irEnabled, hw[F("ir")][F("type")]);
|
||||
CJSON(irEnabled, hw["ir"]["type"]);
|
||||
|
||||
JsonObject relay = hw[F("relay")];
|
||||
int hw_relay_pin = relay[F("pin")];
|
||||
int hw_relay_pin = relay["pin"];
|
||||
if (pinManager.allocatePin(hw_relay_pin,true)) {
|
||||
rlyPin = hw_relay_pin;
|
||||
pinMode(rlyPin, OUTPUT);
|
||||
@ -176,17 +176,17 @@ void deserializeConfig() {
|
||||
rlyPin = -1;
|
||||
}
|
||||
if (relay.containsKey("rev")) {
|
||||
rlyMde = !relay[F("rev")];
|
||||
rlyMde = !relay["rev"];
|
||||
}
|
||||
|
||||
//int hw_status_pin = hw[F("status")][F("pin")]; // -1
|
||||
//int hw_status_pin = hw[F("status")]["pin"]; // -1
|
||||
|
||||
JsonObject light = doc[F("light")];
|
||||
CJSON(briMultiplier, light[F("scale-bri")]);
|
||||
CJSON(strip.paletteBlend, light[F("pal-mode")]);
|
||||
|
||||
float light_gc_bri = light[F("gc")]["bri"];
|
||||
float light_gc_col = light[F("gc")][F("col")]; // 2.8
|
||||
float light_gc_col = light[F("gc")]["col"]; // 2.8
|
||||
if (light_gc_bri > 1.5) strip.gammaCorrectBri = true;
|
||||
else if (light_gc_bri > 0.5) strip.gammaCorrectBri = false;
|
||||
if (light_gc_col > 1.5) strip.gammaCorrectCol = true;
|
||||
@ -226,13 +226,13 @@ void deserializeConfig() {
|
||||
CJSON(udpPort, if_sync[F("port0")]); // 21324
|
||||
CJSON(udpPort2, if_sync[F("port1")]); // 65506
|
||||
|
||||
JsonObject if_sync_recv = if_sync[F("recv")];
|
||||
JsonObject if_sync_recv = if_sync["recv"];
|
||||
CJSON(receiveNotificationBrightness, if_sync_recv["bri"]);
|
||||
CJSON(receiveNotificationColor, if_sync_recv[F("col")]);
|
||||
CJSON(receiveNotificationColor, if_sync_recv["col"]);
|
||||
CJSON(receiveNotificationEffects, if_sync_recv[F("fx")]);
|
||||
receiveNotifications = (receiveNotificationBrightness || receiveNotificationColor || receiveNotificationEffects);
|
||||
|
||||
JsonObject if_sync_send = if_sync[F("send")];
|
||||
JsonObject if_sync_send = if_sync["send"];
|
||||
CJSON(notifyDirectDefault, if_sync_send[F("dir")]);
|
||||
notifyDirect = notifyDirectDefault;
|
||||
CJSON(notifyButton, if_sync_send[F("btn")]);
|
||||
@ -241,9 +241,13 @@ void deserializeConfig() {
|
||||
CJSON(notifyMacro, if_sync_send[F("macro")]);
|
||||
CJSON(notifyTwice, if_sync_send[F("twice")]);
|
||||
|
||||
JsonObject if_live = interfaces[F("live")];
|
||||
CJSON(receiveDirect, if_live[F("en")]);
|
||||
CJSON(e131Port, if_live[F("port")]); // 5568
|
||||
JsonObject if_nodes = interfaces["nodes"];
|
||||
CJSON(nodeListEnabled, if_nodes[F("list")]);
|
||||
CJSON(nodeBroadcastEnabled, if_nodes[F("bcast")]);
|
||||
|
||||
JsonObject if_live = interfaces["live"];
|
||||
CJSON(receiveDirect, if_live["en"]);
|
||||
CJSON(e131Port, if_live["port"]); // 5568
|
||||
CJSON(e131Multicast, if_live[F("mc")]);
|
||||
|
||||
JsonObject if_live_dmx = if_live[F("dmx")];
|
||||
@ -263,19 +267,19 @@ void deserializeConfig() {
|
||||
CJSON(macroAlexaOn, interfaces[F("va")][F("macros")][0]);
|
||||
CJSON(macroAlexaOff, interfaces[F("va")][F("macros")][1]);
|
||||
|
||||
const char* apikey = interfaces[F("blynk")][F("token")] | "Hidden";
|
||||
const char* apikey = interfaces["blynk"][F("token")] | "Hidden";
|
||||
tdd = strnlen(apikey, 36);
|
||||
if (tdd > 20 || tdd == 0)
|
||||
getStringFromJson(blynkApiKey, apikey, 36); //normally not present due to security
|
||||
|
||||
JsonObject if_blynk = interfaces[F("blynk")];
|
||||
JsonObject if_blynk = interfaces["blynk"];
|
||||
getStringFromJson(blynkHost, if_blynk[F("host")], 33);
|
||||
CJSON(blynkPort, if_blynk[F("port")]);
|
||||
CJSON(blynkPort, if_blynk["port"]);
|
||||
|
||||
JsonObject if_mqtt = interfaces[F("mqtt")];
|
||||
CJSON(mqttEnabled, if_mqtt[F("en")]);
|
||||
JsonObject if_mqtt = interfaces["mqtt"];
|
||||
CJSON(mqttEnabled, if_mqtt["en"]);
|
||||
getStringFromJson(mqttServer, if_mqtt[F("broker")], 33);
|
||||
CJSON(mqttPort, if_mqtt[F("port")]); // 1883
|
||||
CJSON(mqttPort, if_mqtt["port"]); // 1883
|
||||
getStringFromJson(mqttUser, if_mqtt[F("user")], 41);
|
||||
getStringFromJson(mqttPass, if_mqtt["psk"], 41); //normally not present due to security
|
||||
getStringFromJson(mqttClientID, if_mqtt[F("cid")], 41);
|
||||
@ -284,23 +288,23 @@ void deserializeConfig() {
|
||||
getStringFromJson(mqttGroupTopic, if_mqtt[F("topics")][F("group")], 33); // ""
|
||||
|
||||
JsonObject if_hue = interfaces[F("hue")];
|
||||
CJSON(huePollingEnabled, if_hue[F("en")]);
|
||||
CJSON(huePollLightId, if_hue[F("id")]);
|
||||
CJSON(huePollingEnabled, if_hue["en"]);
|
||||
CJSON(huePollLightId, if_hue["id"]);
|
||||
tdd = if_hue[F("iv")] | -1;
|
||||
if (tdd >= 2) huePollIntervalMs = tdd * 100;
|
||||
|
||||
JsonObject if_hue_recv = if_hue[F("recv")];
|
||||
JsonObject if_hue_recv = if_hue["recv"];
|
||||
CJSON(hueApplyOnOff, if_hue_recv["on"]);
|
||||
CJSON(hueApplyBri, if_hue_recv["bri"]);
|
||||
CJSON(hueApplyColor, if_hue_recv[F("col")]);
|
||||
CJSON(hueApplyColor, if_hue_recv["col"]);
|
||||
|
||||
JsonArray if_hue_ip = if_hue[F("ip")];
|
||||
JsonArray if_hue_ip = if_hue["ip"];
|
||||
|
||||
for (byte i = 0; i < 4; i++)
|
||||
CJSON(hueIP[i], if_hue_ip[i]);
|
||||
|
||||
JsonObject if_ntp = interfaces[F("ntp")];
|
||||
CJSON(ntpEnabled, if_ntp[F("en")]);
|
||||
CJSON(ntpEnabled, if_ntp["en"]);
|
||||
getStringFromJson(ntpServerName, if_ntp[F("host")], 33); // "1.wled.pool.ntp.org"
|
||||
CJSON(currentTimezone, if_ntp[F("tz")]);
|
||||
CJSON(utcOffsetSecs, if_ntp[F("offset")]);
|
||||
@ -348,7 +352,7 @@ void deserializeConfig() {
|
||||
CJSON(timerWeekday[it], timer[F("dow")]);
|
||||
if (timerWeekday[it] != dowPrev) { //present in JSON
|
||||
timerWeekday[it] <<= 1; //add active bit
|
||||
int act = timer[F("en")] | actPrev;
|
||||
int act = timer["en"] | actPrev;
|
||||
if (act) timerWeekday[it]++;
|
||||
}
|
||||
|
||||
@ -395,7 +399,6 @@ void serializeConfig() {
|
||||
|
||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||
|
||||
//{ //scope this to reduce stack size
|
||||
JsonArray rev = doc.createNestedArray("rev");
|
||||
rev.add(1); //major settings revision
|
||||
rev.add(0); //minor settings revision
|
||||
@ -444,7 +447,7 @@ void serializeConfig() {
|
||||
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
JsonObject ethernet = doc.createNestedObject("eth");
|
||||
ethernet[F("type")] = ethernetType;
|
||||
ethernet["type"] = ethernetType;
|
||||
#endif
|
||||
|
||||
JsonObject hw = doc.createNestedObject("hw");
|
||||
@ -453,7 +456,7 @@ void serializeConfig() {
|
||||
hw_led[F("total")] = ledCount;
|
||||
hw_led[F("maxpwr")] = strip.ablMilliampsMax;
|
||||
hw_led[F("ledma")] = strip.milliampsPerLed;
|
||||
hw_led[F("rev")] = false; //strip.reverseMode; // not used anymore, reversing per-strip
|
||||
hw_led["rev"] = false; //strip.reverseMode; // not used anymore, reversing per-strip
|
||||
hw_led[F("rgbwm")] = strip.rgbwMode;
|
||||
|
||||
JsonArray hw_led_ins = hw_led.createNestedArray("ins");
|
||||
@ -462,7 +465,7 @@ void serializeConfig() {
|
||||
Bus *bus = busses.getBus(s);
|
||||
if (!bus || bus->getLength()==0) break;
|
||||
JsonObject ins = hw_led_ins.createNestedObject();
|
||||
ins[F("en")] = true;
|
||||
ins["en"] = true;
|
||||
ins[F("start")] = bus->getStart();
|
||||
ins[F("len")] = bus->getLength();
|
||||
JsonArray ins_pin = ins.createNestedArray("pin");
|
||||
@ -470,9 +473,9 @@ void serializeConfig() {
|
||||
uint8_t nPins = bus->getPins(pins);
|
||||
for (uint8_t i = 0; i < nPins; i++) ins_pin.add(pins[i]);
|
||||
ins[F("order")] = bus->getColorOrder();
|
||||
ins[F("rev")] = bus->reversed;
|
||||
ins["rev"] = bus->reversed;
|
||||
ins[F("skip")] = skipFirstLed ? 1 : 0;
|
||||
ins[F("type")] = bus->getType();
|
||||
ins["type"] = bus->getType();
|
||||
ins[F("rgbw")] = bus->isRgbw();
|
||||
}
|
||||
|
||||
@ -482,7 +485,7 @@ void serializeConfig() {
|
||||
|
||||
// button BTNPIN
|
||||
JsonObject hw_btn_ins_0 = hw_btn_ins.createNestedObject();
|
||||
hw_btn_ins_0[F("type")] = (buttonEnabled) ? BTN_TYPE_PUSH : BTN_TYPE_NONE;
|
||||
hw_btn_ins_0["type"] = (buttonEnabled) ? BTN_TYPE_PUSH : BTN_TYPE_NONE;
|
||||
|
||||
JsonArray hw_btn_ins_0_pin = hw_btn_ins_0.createNestedArray("pin");
|
||||
hw_btn_ins_0_pin.add(btnPin);
|
||||
@ -495,28 +498,28 @@ void serializeConfig() {
|
||||
#ifndef WLED_DISABLE_INFRARED
|
||||
if (irPin>=0) {
|
||||
JsonObject hw_ir = hw.createNestedObject("ir");
|
||||
hw_ir[F("pin")] = irPin;
|
||||
hw_ir[F("type")] = irEnabled; // the byte 'irEnabled' does contain the IR-Remote Type ( 0=disabled )
|
||||
hw_ir["pin"] = irPin;
|
||||
hw_ir["type"] = irEnabled; // the byte 'irEnabled' does contain the IR-Remote Type ( 0=disabled )
|
||||
}
|
||||
#endif
|
||||
|
||||
JsonObject hw_relay = hw.createNestedObject("relay");
|
||||
hw_relay[F("pin")] = rlyPin;
|
||||
hw_relay[F("rev")] = !rlyMde;
|
||||
JsonObject hw_relay = hw.createNestedObject(F("relay"));
|
||||
hw_relay["pin"] = rlyPin;
|
||||
hw_relay["rev"] = !rlyMde;
|
||||
|
||||
//JsonObject hw_status = hw.createNestedObject("status");
|
||||
//hw_status[F("pin")] = -1;
|
||||
//hw_status["pin"] = -1;
|
||||
|
||||
JsonObject hw_aux = hw.createNestedObject("aux");
|
||||
hw_aux[F("pin")] = auxPin;
|
||||
hw_aux["pin"] = auxPin;
|
||||
|
||||
JsonObject light = doc.createNestedObject("light");
|
||||
JsonObject light = doc.createNestedObject(F("light"));
|
||||
light[F("scale-bri")] = briMultiplier;
|
||||
light[F("pal-mode")] = strip.paletteBlend;
|
||||
|
||||
JsonObject light_gc = light.createNestedObject("gc");
|
||||
light_gc["bri"] = (strip.gammaCorrectBri) ? 2.8 : 1.0;
|
||||
light_gc[F("col")] = (strip.gammaCorrectCol) ? 2.8 : 1.0;
|
||||
light_gc["col"] = (strip.gammaCorrectCol) ? 2.8 : 1.0;
|
||||
|
||||
JsonObject light_tr = light.createNestedObject("tr");
|
||||
light_tr[F("mode")] = fadeTransition;
|
||||
@ -539,7 +542,7 @@ void serializeConfig() {
|
||||
JsonObject def_cy = def.createNestedObject("cy");
|
||||
def_cy["on"] = presetCyclingEnabled;
|
||||
|
||||
JsonArray def_cy_range = def_cy.createNestedArray("range");
|
||||
JsonArray def_cy_range = def_cy.createNestedArray(F("range"));
|
||||
def_cy_range.add(presetCycleMin);
|
||||
def_cy_range.add(presetCycleMax);
|
||||
def_cy[F("dur")] = presetCycleTime;
|
||||
@ -553,7 +556,7 @@ void serializeConfig() {
|
||||
|
||||
JsonObject if_sync_recv = if_sync.createNestedObject("recv");
|
||||
if_sync_recv["bri"] = receiveNotificationBrightness;
|
||||
if_sync_recv[F("col")] = receiveNotificationColor;
|
||||
if_sync_recv["col"] = receiveNotificationColor;
|
||||
if_sync_recv[F("fx")] = receiveNotificationEffects;
|
||||
|
||||
JsonObject if_sync_send = if_sync.createNestedObject("send");
|
||||
@ -564,9 +567,13 @@ void serializeConfig() {
|
||||
if_sync_send[F("macro")] = notifyMacro;
|
||||
if_sync_send[F("twice")] = notifyTwice;
|
||||
|
||||
JsonObject if_nodes = interfaces.createNestedObject("nodes");
|
||||
if_nodes[F("list")] = nodeListEnabled;
|
||||
if_nodes[F("bcast")] = nodeBroadcastEnabled;
|
||||
|
||||
JsonObject if_live = interfaces.createNestedObject("live");
|
||||
if_live[F("en")] = receiveDirect;
|
||||
if_live[F("port")] = e131Port;
|
||||
if_live["en"] = receiveDirect;
|
||||
if_live["port"] = e131Port;
|
||||
if_live[F("mc")] = e131Multicast;
|
||||
|
||||
JsonObject if_live_dmx = if_live.createNestedObject("dmx");
|
||||
@ -588,29 +595,29 @@ void serializeConfig() {
|
||||
JsonObject if_blynk = interfaces.createNestedObject("blynk");
|
||||
if_blynk[F("token")] = strlen(blynkApiKey) ? "Hidden":"";
|
||||
if_blynk[F("host")] = blynkHost;
|
||||
if_blynk[F("port")] = blynkPort;
|
||||
if_blynk["port"] = blynkPort;
|
||||
|
||||
JsonObject if_mqtt = interfaces.createNestedObject("mqtt");
|
||||
if_mqtt[F("en")] = mqttEnabled;
|
||||
if_mqtt["en"] = mqttEnabled;
|
||||
if_mqtt[F("broker")] = mqttServer;
|
||||
if_mqtt[F("port")] = mqttPort;
|
||||
if_mqtt["port"] = mqttPort;
|
||||
if_mqtt[F("user")] = mqttUser;
|
||||
if_mqtt[F("pskl")] = strlen(mqttPass);
|
||||
if_mqtt[F("cid")] = mqttClientID;
|
||||
|
||||
JsonObject if_mqtt_topics = if_mqtt.createNestedObject("topics");
|
||||
JsonObject if_mqtt_topics = if_mqtt.createNestedObject(F("topics"));
|
||||
if_mqtt_topics[F("device")] = mqttDeviceTopic;
|
||||
if_mqtt_topics[F("group")] = mqttGroupTopic;
|
||||
|
||||
JsonObject if_hue = interfaces.createNestedObject("hue");
|
||||
if_hue[F("en")] = huePollingEnabled;
|
||||
if_hue[F("id")] = huePollLightId;
|
||||
if_hue["en"] = huePollingEnabled;
|
||||
if_hue["id"] = huePollLightId;
|
||||
if_hue[F("iv")] = huePollIntervalMs / 100;
|
||||
|
||||
JsonObject if_hue_recv = if_hue.createNestedObject("recv");
|
||||
if_hue_recv["on"] = hueApplyOnOff;
|
||||
if_hue_recv["bri"] = hueApplyBri;
|
||||
if_hue_recv[F("col")] = hueApplyColor;
|
||||
if_hue_recv["col"] = hueApplyColor;
|
||||
|
||||
JsonArray if_hue_ip = if_hue.createNestedArray("ip");
|
||||
for (byte i = 0; i < 4; i++) {
|
||||
@ -618,7 +625,7 @@ void serializeConfig() {
|
||||
}
|
||||
|
||||
JsonObject if_ntp = interfaces.createNestedObject("ntp");
|
||||
if_ntp[F("en")] = ntpEnabled;
|
||||
if_ntp["en"] = ntpEnabled;
|
||||
if_ntp[F("host")] = ntpServerName;
|
||||
if_ntp[F("tz")] = currentTimezone;
|
||||
if_ntp[F("offset")] = utcOffsetSecs;
|
||||
@ -636,10 +643,10 @@ void serializeConfig() {
|
||||
ol[F("o5m")] = analogClock5MinuteMarks;
|
||||
ol[F("osec")] = analogClockSecondsTrail;
|
||||
|
||||
JsonObject timers = doc.createNestedObject("timers");
|
||||
JsonObject timers = doc.createNestedObject(F("timers"));
|
||||
|
||||
JsonObject cntdwn = timers.createNestedObject("cntdwn");
|
||||
JsonArray goal = cntdwn.createNestedArray("goal");
|
||||
JsonObject cntdwn = timers.createNestedObject(F("cntdwn"));
|
||||
JsonArray goal = cntdwn.createNestedArray(F("goal"));
|
||||
goal.add(countdownYear); goal.add(countdownMonth); goal.add(countdownDay);
|
||||
goal.add(countdownHour); goal.add(countdownMin); goal.add(countdownSec);
|
||||
cntdwn[F("macro")] = macroCountdown;
|
||||
@ -649,7 +656,7 @@ void serializeConfig() {
|
||||
for (byte i = 0; i < 10; i++) {
|
||||
if (timerMacro[i] == 0 && timerHours[i] == 0 && timerMinutes[i] == 0) continue; // sunrise/sunset get saved always (timerHours=255)
|
||||
JsonObject timers_ins0 = timers_ins.createNestedObject();
|
||||
timers_ins0[F("en")] = (timerWeekday[i] & 0x01);
|
||||
timers_ins0["en"] = (timerWeekday[i] & 0x01);
|
||||
timers_ins0[F("hour")] = timerHours[i];
|
||||
timers_ins0[F("min")] = timerMinutes[i];
|
||||
timers_ins0[F("macro")] = timerMacro[i];
|
||||
@ -669,7 +676,7 @@ void serializeConfig() {
|
||||
dmx[F("start")] = DMXStart;
|
||||
dmx[F("start-led")] = DMXStartLED;
|
||||
|
||||
JsonArray dmx_fixmap = dmx.createNestedArray("fixmap");
|
||||
JsonArray dmx_fixmap = dmx.createNestedArray(F("fixmap"));
|
||||
for (byte i = 0; i < 15; i++)
|
||||
dmx_fixmap.add(DMXFixtureMap[i]);
|
||||
#endif
|
||||
@ -695,7 +702,7 @@ bool deserializeConfigSec() {
|
||||
JsonObject nw_ins_0 = doc["nw"][F("ins")][0];
|
||||
getStringFromJson(clientPass, nw_ins_0["psk"], 65);
|
||||
|
||||
JsonObject ap = doc[F("ap")];
|
||||
JsonObject ap = doc["ap"];
|
||||
getStringFromJson(apPass, ap["psk"] , 65);
|
||||
|
||||
JsonObject interfaces = doc["if"];
|
||||
@ -705,7 +712,7 @@ bool deserializeConfigSec() {
|
||||
if (tdd > 20 || tdd == 0)
|
||||
getStringFromJson(blynkApiKey, apikey, 36);
|
||||
|
||||
JsonObject if_mqtt = interfaces[F("mqtt")];
|
||||
JsonObject if_mqtt = interfaces["mqtt"];
|
||||
getStringFromJson(mqttPass, if_mqtt["psk"], 41);
|
||||
|
||||
getStringFromJson(hueApiKey, interfaces[F("hue")][F("key")], 47);
|
||||
|
@ -249,4 +249,12 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WLED_ENABLE_DMX
|
||||
#if (LEDPIN == 2)
|
||||
#undef LEDPIN
|
||||
#define LEDPIN 3
|
||||
#warning "Pin conflict compiling with DMX and LEDs on pin 2. The default LED pin has been changed to pin 3."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1053,12 +1053,6 @@ input[type="text"].fnd:not(:placeholder-shown) {
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 770px) {
|
||||
#buttonNodes {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (max-width: 1249px) {
|
||||
#buttonPcm, #buttonNo {
|
||||
display: none;
|
||||
|
@ -55,7 +55,7 @@ var cpick = new iro.ColorPicker("#picker", {
|
||||
});
|
||||
|
||||
function handleVisibilityChange() {
|
||||
if (!document.hidden && new Date () - lastUpdate > 3000) {
|
||||
if (!d.hidden && new Date () - lastUpdate > 3000) {
|
||||
requestJson(null);
|
||||
}
|
||||
}
|
||||
@ -318,13 +318,13 @@ function qlName(i) {
|
||||
}
|
||||
|
||||
function cpBck() {
|
||||
var copyText = document.getElementById("bck");
|
||||
var copyText = d.getElementById("bck");
|
||||
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 999999);
|
||||
|
||||
document.execCommand("copy");
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 999999);
|
||||
|
||||
d.execCommand("copy");
|
||||
|
||||
showToast("Copied to clipboard!");
|
||||
}
|
||||
|
||||
@ -686,8 +686,12 @@ function populateNodes(i,n)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nnodes == 0) cn += `No other instances found.`;
|
||||
cn += `<table class="infot">${urows}${inforow("Current instance:",i.name)}</table>`;
|
||||
if (i.ndc < 0) cn += `Instance List is disabled.`;
|
||||
else if (nnodes == 0) cn += `No other instances found.`;
|
||||
cn += `<table class="infot">
|
||||
${urows}
|
||||
${inforow("Current instance:",i.name)}
|
||||
</table>`;
|
||||
d.getElementById('kn').innerHTML = cn;
|
||||
}
|
||||
|
||||
@ -1082,10 +1086,9 @@ function requestJson(command, rinfo = true, verbose = true, callback = null) {
|
||||
syncTglRecv = info.str;
|
||||
maxSeg = info.leds.maxseg;
|
||||
pmt = info.fs.pmt;
|
||||
if (!command && pmt != pmtLast) {
|
||||
setTimeout(loadPresets,99);
|
||||
}
|
||||
if (!command && pmt != pmtLast) setTimeout(loadPresets,99);
|
||||
pmtLast = pmt;
|
||||
d.getElementById('buttonNodes').style.display = (info.ndc > 0 && window.innerWidth > 770) ? "block":"none";
|
||||
lastinfo = info;
|
||||
if (isInfo) populateInfo(info);
|
||||
s = json.state;
|
||||
@ -1648,13 +1651,7 @@ function rSegs()
|
||||
|
||||
function loadPalettesData()
|
||||
{
|
||||
if (palettesData) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (getPalettesDataCached()) {
|
||||
return;
|
||||
}
|
||||
if (palettesData || getPalettesDataCached()) return;
|
||||
|
||||
var dateExpiration = new Date();
|
||||
palettesData = {};
|
||||
@ -1687,9 +1684,7 @@ function getPalettesDataCached() {
|
||||
function getPalettesData(page, callback)
|
||||
{
|
||||
var url = `/json/palx?page=${page}`;
|
||||
if (loc) {
|
||||
url = `http://${locip}${url}`;
|
||||
}
|
||||
if (loc) url = `http://${locip}${url}`;
|
||||
|
||||
fetch(url, {
|
||||
method: 'get',
|
||||
@ -1769,7 +1764,7 @@ function unfocusSliders() {
|
||||
}
|
||||
|
||||
//sliding UI
|
||||
const _C = document.querySelector('.container'), N = 4;
|
||||
const _C = d.querySelector('.container'), N = 4;
|
||||
|
||||
let iSlide = 0, x0 = null, scrollS = 0, locked = false, w;
|
||||
|
||||
@ -1820,6 +1815,7 @@ function move(e) {
|
||||
|
||||
function size() {
|
||||
w = window.innerWidth;
|
||||
d.getElementById('buttonNodes').style.display = (lastinfo.ndc > 0 && w > 770) ? "block":"none";
|
||||
var h = d.getElementById('top').clientHeight;
|
||||
sCol('--th', h + "px");
|
||||
sCol('--bh', d.getElementById('bot').clientHeight + "px");
|
||||
|
@ -34,7 +34,7 @@ Infrared remote:
|
||||
<h3>WLED Broadcast</h3>
|
||||
UDP Port: <input name="UP" type="number" min="1" max="65535" class="d5" required><br>
|
||||
2nd Port: <input name="U2" type="number" min="1" max="65535" class="d5" required><br>
|
||||
Receive <input type="checkbox" name="RB">Brightness, <input type="checkbox" name="RC">Color, and <input type="checkbox" name="RX">Effects<br>
|
||||
Receive: <input type="checkbox" name="RB">Brightness, <input type="checkbox" name="RC">Color, and <input type="checkbox" name="RX">Effects<br>
|
||||
Send notifications on direct change: <input type="checkbox" name="SD"><br>
|
||||
Send notifications on button press or IR: <input type="checkbox" name="SB"><br>
|
||||
Send Alexa notifications: <input type="checkbox" name="SA"><br>
|
||||
@ -42,6 +42,9 @@ Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
|
||||
Send Macro notifications: <input type="checkbox" name="SM"><br>
|
||||
Send notifications twice: <input type="checkbox" name="S2"><br>
|
||||
<i>Reboot required to apply changes. </i>
|
||||
<h3>Instance List</h3>
|
||||
Enable instance list: <input type="checkbox" name="NL"><br>
|
||||
Make this instance discoverable: <input type="checkbox" name="NB"><br>
|
||||
<h3>Realtime</h3>
|
||||
Receive UDP realtime: <input type="checkbox" name="RD"><br><br>
|
||||
<i>Network DMX input</i><br>
|
||||
|
@ -60,6 +60,7 @@ input[type="checkbox"] {
|
||||
-webkit-transform: scale(2); /* Safari and Chrome */
|
||||
-o-transform: scale(2); /* Opera */
|
||||
transform: scale(2);
|
||||
margin-right: 10px;
|
||||
}
|
||||
select {
|
||||
background: #333;
|
||||
|
@ -62,10 +62,6 @@ void initDMX() {
|
||||
dmx.init(512); // initialize with bus length
|
||||
}
|
||||
|
||||
#if (LEDPIN == 2)
|
||||
#pragma message "Pin conflict compiling with DMX and LEDs on pin 2. Please set a different LEDPIN."
|
||||
#endif
|
||||
|
||||
#else
|
||||
void handleDMX() {}
|
||||
void initDMX() {}
|
||||
|
@ -6,7 +6,7 @@
|
||||
*/
|
||||
|
||||
// Autogenerated from wled00/data/style.css, do not edit!!
|
||||
const char PAGE_settingsCss[] PROGMEM = R"=====(<style>body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%;margin:0}hr{border-color:#666}button{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;border-radius:24px;display:inline-block;font-size:20px;margin:12px 8px 8px;padding:8px 12px;min-width:48px}.toprow{top:0;position:sticky;background-color:#222;z-index:1}.helpB{text-align:left;position:absolute;width:60px}input{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}input[type=number]{width:4em;font-size:medium;margin:2px}input[type=number].big{width:80px}input[type=number].small{width:40px}select{margin:2px;font-size:medium}input[type=checkbox]{-ms-transform:scale(2);-moz-transform:scale(2);-webkit-transform:scale(2);-o-transform:scale(2);transform:scale(2)}select{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}td{padding:2px}.d5{width:4.5em!important}</style>)=====";
|
||||
const char PAGE_settingsCss[] PROGMEM = R"=====(<style>body{font-family:Verdana,sans-serif;text-align:center;background:#222;color:#fff;line-height:200%;margin:0}hr{border-color:#666}button{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.3ch solid #333;border-radius:24px;display:inline-block;font-size:20px;margin:12px 8px 8px;padding:8px 12px;min-width:48px}.toprow{top:0;position:sticky;background-color:#222;z-index:1}.helpB{text-align:left;position:absolute;width:60px}input{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}input[type=number]{width:4em;font-size:medium;margin:2px}input[type=number].big{width:80px}input[type=number].small{width:40px}select{margin:2px;font-size:medium}input[type=checkbox]{-ms-transform:scale(2);-moz-transform:scale(2);-webkit-transform:scale(2);-o-transform:scale(2);transform:scale(2);margin-right:10px}select{background:#333;color:#fff;font-family:Verdana,sans-serif;border:.5ch solid #333}td{padding:2px}.d5{width:4.5em!important}</style>)=====";
|
||||
|
||||
|
||||
// Autogenerated from wled00/data/settings.htm, do not edit!!
|
||||
@ -227,7 +227,7 @@ value="6">6-key black</option><option value="7">9-key red</option></select><br>
|
||||
<a href="https://github.com/Aircoookie/WLED/wiki/Infrared-Control"
|
||||
target="_blank">IR info</a><h3>WLED Broadcast</h3>UDP Port: <input name="UP"
|
||||
type="number" min="1" max="65535" class="d5" required><br>2nd Port: <input
|
||||
name="U2" type="number" min="1" max="65535" class="d5" required><br>Receive
|
||||
name="U2" type="number" min="1" max="65535" class="d5" required><br>Receive:
|
||||
<input type="checkbox" name="RB">Brightness, <input type="checkbox" name="RC">
|
||||
Color, and <input type="checkbox" name="RX">Effects<br>
|
||||
Send notifications on direct change: <input type="checkbox" name="SD"><br>
|
||||
@ -236,22 +236,24 @@ Send Alexa notifications: <input type="checkbox" name="SA"><br>
|
||||
Send Philips Hue change notifications: <input type="checkbox" name="SH"><br>
|
||||
Send Macro notifications: <input type="checkbox" name="SM"><br>
|
||||
Send notifications twice: <input type="checkbox" name="S2"><br><i>
|
||||
Reboot required to apply changes.</i><h3>Realtime</h3>Receive UDP realtime:
|
||||
<input type="checkbox" name="RD"><br><br><i>Network DMX input</i><br>Type:
|
||||
<select name="DI" onchange="SP(),adj()"><option value="5568">E1.31 (sACN)
|
||||
</option><option value="6454">Art-Net</option><option value="4048">DDP</option>
|
||||
<option value="0" selected="selected">Custom port</option></select><br><div
|
||||
id="xp">Port: <input name="EP" type="number" min="1" max="65535" value="5568"
|
||||
class="d5" required><br></div>Multicast: <input type="checkbox" name="EM"><br>
|
||||
Start universe: <input name="EU" type="number" min="0" max="63999" required><br>
|
||||
<i>Reboot required.</i> Check out <a href="https://github.com/LedFx/LedFx"
|
||||
target="_blank">LedFx</a>!<br>Skip out-of-sequence packets: <input
|
||||
type="checkbox" name="ES"><br>DMX start address: <input name="DA" type="number"
|
||||
min="0" max="510" required><br>DMX mode: <select name="DM"><option value="0">
|
||||
Disabled</option><option value="1">Single RGB</option><option value="2">
|
||||
Single DRGB</option><option value="3">Effect</option><option value="4">Multi RGB
|
||||
</option><option value="5">Dimmer + Multi RGB</option><option value="6">
|
||||
Multi RGBW</option></select><br><a
|
||||
Reboot required to apply changes.</i><h3>Instance List</h3>
|
||||
Enable instance list: <input type="checkbox" name="NL"><br>
|
||||
Make this instance discoverable: <input type="checkbox" name="NB"><br><h3>
|
||||
Realtime</h3>Receive UDP realtime: <input type="checkbox" name="RD"><br><br><i>
|
||||
Network DMX input</i><br>Type: <select name="DI" onchange="SP(),adj()"><option
|
||||
value="5568">E1.31 (sACN)</option><option value="6454">Art-Net</option><option
|
||||
value="4048">DDP</option><option value="0" selected="selected">Custom port
|
||||
</option></select><br><div id="xp">Port: <input name="EP" type="number" min="1"
|
||||
max="65535" value="5568" class="d5" required><br></div>Multicast: <input
|
||||
type="checkbox" name="EM"><br>Start universe: <input name="EU" type="number"
|
||||
min="0" max="63999" required><br><i>Reboot required.</i> Check out <a
|
||||
href="https://github.com/LedFx/LedFx" target="_blank">LedFx</a>!<br>
|
||||
Skip out-of-sequence packets: <input type="checkbox" name="ES"><br>
|
||||
DMX start address: <input name="DA" type="number" min="0" max="510" required>
|
||||
<br>DMX mode: <select name="DM"><option value="0">Disabled</option><option
|
||||
value="1">Single RGB</option><option value="2">Single DRGB</option><option
|
||||
value="3">Effect</option><option value="4">Multi RGB</option><option value="5">
|
||||
Dimmer + Multi RGB</option><option value="6">Multi RGBW</option></select><br><a
|
||||
href="https://github.com/Aircoookie/WLED/wiki/E1.31-DMX" target="_blank">
|
||||
E1.31 info</a><br>Timeout: <input name="ET" type="number" min="1" max="65000"
|
||||
required> ms<br>Force max brightness: <input type="checkbox" name="FB"><br>
|
||||
|
3197
wled00/html_ui.h
3197
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
@ -101,7 +101,7 @@ void onHueData(void* arg, AsyncClient* client, void *data, size_t len)
|
||||
hueError = HUE_ERROR_JSON_PARSING; return;
|
||||
}
|
||||
|
||||
int hueErrorCode = root[0][F("error")][F("type")];
|
||||
int hueErrorCode = root[0][F("error")]["type"];
|
||||
if (hueErrorCode)//hue bridge returned error
|
||||
{
|
||||
hueError = hueErrorCode;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
void deserializeSegment(JsonObject elem, byte it)
|
||||
{
|
||||
byte id = elem[F("id")] | it;
|
||||
byte id = elem["id"] | it;
|
||||
if (id < strip.getMaxSegments())
|
||||
{
|
||||
WS2812FX::Segment& seg = strip.getSegment(id);
|
||||
@ -33,7 +33,7 @@ void deserializeSegment(JsonObject elem, byte it)
|
||||
|
||||
seg.setOption(SEG_OPTION_ON, elem["on"] | seg.getOption(SEG_OPTION_ON), id);
|
||||
|
||||
JsonArray colarr = elem[F("col")];
|
||||
JsonArray colarr = elem["col"];
|
||||
if (!colarr.isNull())
|
||||
{
|
||||
for (uint8_t i = 0; i < 3; i++)
|
||||
@ -89,7 +89,7 @@ void deserializeSegment(JsonObject elem, byte it)
|
||||
|
||||
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal);
|
||||
seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED));
|
||||
seg.setOption(SEG_OPTION_REVERSED, elem[F("rev")] | seg.getOption(SEG_OPTION_REVERSED));
|
||||
seg.setOption(SEG_OPTION_REVERSED, elem["rev"] | seg.getOption(SEG_OPTION_REVERSED));
|
||||
seg.setOption(SEG_OPTION_MIRROR , elem[F("mi")] | seg.getOption(SEG_OPTION_MIRROR ));
|
||||
|
||||
//temporary, strip object gets updated via colorUpdated()
|
||||
@ -198,8 +198,8 @@ bool deserializeState(JsonObject root)
|
||||
nightlightTargetBri = nl[F("tbri")] | nightlightTargetBri;
|
||||
|
||||
JsonObject udpn = root["udpn"];
|
||||
notifyDirect = udpn[F("send")] | notifyDirect;
|
||||
receiveNotifications = udpn[F("recv")] | receiveNotifications;
|
||||
notifyDirect = udpn["send"] | notifyDirect;
|
||||
receiveNotifications = udpn["recv"] | receiveNotifications;
|
||||
bool noNotification = udpn[F("nn")]; //send no notification just for this request
|
||||
|
||||
unsigned long timein = root[F("time")] | UINT32_MAX;
|
||||
@ -227,7 +227,7 @@ bool deserializeState(JsonObject root)
|
||||
JsonVariant segVar = root["seg"];
|
||||
if (segVar.is<JsonObject>())
|
||||
{
|
||||
int id = segVar[F("id")] | -1;
|
||||
int id = segVar["id"] | -1;
|
||||
|
||||
if (id < 0) { //set all selected segments
|
||||
bool didSet = false;
|
||||
@ -281,7 +281,8 @@ bool deserializeState(JsonObject root)
|
||||
|
||||
JsonObject playlist = root[F("playlist")];
|
||||
if (!playlist.isNull()) {
|
||||
loadPlaylist(playlist); return stateResponse; //maybe we need not return here
|
||||
loadPlaylist(playlist);
|
||||
noNotification = true; //do not notify both for this request and the first playlist entry
|
||||
}
|
||||
|
||||
colorUpdated(noNotification ? NOTIFIER_CALL_MODE_NO_NOTIFY : NOTIFIER_CALL_MODE_DIRECT_CHANGE);
|
||||
@ -291,7 +292,7 @@ bool deserializeState(JsonObject root)
|
||||
|
||||
void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool forPreset, bool segmentBounds)
|
||||
{
|
||||
root[F("id")] = id;
|
||||
root["id"] = id;
|
||||
if (segmentBounds) {
|
||||
root[F("start")] = seg.start;
|
||||
root["stop"] = seg.stop;
|
||||
@ -329,7 +330,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool fo
|
||||
root[F("ix")] = seg.intensity;
|
||||
root[F("pal")] = seg.palette;
|
||||
root[F("sel")] = seg.isSelected();
|
||||
root[F("rev")] = seg.getOption(SEG_OPTION_REVERSED);
|
||||
root["rev"] = seg.getOption(SEG_OPTION_REVERSED);
|
||||
root[F("mi")] = seg.getOption(SEG_OPTION_MIRROR);
|
||||
}
|
||||
|
||||
@ -370,8 +371,8 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
|
||||
}
|
||||
|
||||
JsonObject udpn = root.createNestedObject("udpn");
|
||||
udpn[F("send")] = notifyDirect;
|
||||
udpn[F("recv")] = receiveNotifications;
|
||||
udpn["send"] = notifyDirect;
|
||||
udpn["recv"] = receiveNotifications;
|
||||
|
||||
root[F("lor")] = realtimeOverride;
|
||||
}
|
||||
@ -484,7 +485,7 @@ void serializeInfo(JsonObject root)
|
||||
fs_info["t"] = fsBytesTotal / 1000;
|
||||
fs_info[F("pmt")] = presetsModifiedTime;
|
||||
|
||||
root[F("ndc")] = Nodes.size();
|
||||
root[F("ndc")] = nodeListEnabled ? (int)Nodes.size() : -1;
|
||||
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
#ifdef WLED_DEBUG
|
||||
@ -719,10 +720,10 @@ void serializeNodes(JsonObject root)
|
||||
{
|
||||
JsonObject node = nodes.createNestedObject();
|
||||
node[F("name")] = it->second.nodeName;
|
||||
node[F("type")] = it->second.nodeType;
|
||||
node[F("ip")] = it->second.ip.toString();
|
||||
node["type"] = it->second.nodeType;
|
||||
node["ip"] = it->second.ip.toString();
|
||||
node[F("age")] = it->second.age;
|
||||
node[F("vid")] = it->second.build;
|
||||
node[F("vid")] = it->second.build;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,46 +34,6 @@ void shufflePlaylist() {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The same thing as saving and loading playlist can be achieved using JSON API saved in a preset.
|
||||
*
|
||||
void deserializePlaylist() {
|
||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE);
|
||||
|
||||
DEBUG_PRINTLN(F("Reading playlist from /playlist.json..."));
|
||||
|
||||
if (!readObjectFromFile("/playlist.json", nullptr, &doc)) return; //if file does not exist just exit
|
||||
|
||||
JsonObject playlist = doc[F("playlist")];
|
||||
if (!playlist.isNull()) loadPlaylist(playlist);
|
||||
}
|
||||
|
||||
|
||||
void serializePlaylist() {
|
||||
DynamicJsonDocument doc(JSON_BUFFER_SIZE/8); // we don't need big buffer (>1k is ok)
|
||||
|
||||
DEBUG_PRINTLN(F("Writing playlist to /playlist.json..."));
|
||||
|
||||
PlaylistEntry* entries = reinterpret_cast<PlaylistEntry*>(playlistEntries);
|
||||
|
||||
JsonObject playlist = doc.createNestedObject(F("playlist"));
|
||||
JsonArray ps = playlist.createNestedArray(F("ps"));
|
||||
JsonArray dur = playlist.createNestedArray(F("dur"));
|
||||
JsonArray tr = playlist.createNestedArray(F("transition"));
|
||||
for (uint8_t i=0; i<playlistLen; i++) {
|
||||
ps.add(entries[i].preset);
|
||||
dur.add(entries[i].dur);
|
||||
tr.add(entries[i].tr);
|
||||
}
|
||||
playlist[F("repeat")] = playlistRepeat; // TODO: this one is decreasing with each loop
|
||||
playlist[F("end")] = playlistEndPreset;
|
||||
|
||||
File f = WLED_FS.open("/playlist.json", "w");
|
||||
if (f) serializeJson(doc, f);
|
||||
f.close();
|
||||
}
|
||||
*/
|
||||
|
||||
void unloadPlaylist() {
|
||||
if (playlistEntries != nullptr) {
|
||||
delete[] playlistEntries;
|
||||
@ -84,7 +44,6 @@ void unloadPlaylist() {
|
||||
}
|
||||
|
||||
void loadPlaylist(JsonObject playlistObj) {
|
||||
|
||||
unloadPlaylist();
|
||||
|
||||
JsonArray presets = playlistObj["ps"];
|
||||
@ -147,9 +106,7 @@ void handlePlaylist() {
|
||||
++playlistIndex %= playlistLen; // -1 at 1st run (limit to playlistLen)
|
||||
|
||||
if (!playlistRepeat && !playlistIndex) { //stop if repeat == 0 and restart of playlist
|
||||
currentPlaylist = -1;
|
||||
delete[] playlistEntries;
|
||||
playlistEntries = nullptr;
|
||||
unloadPlaylist();
|
||||
if (playlistEndPreset) applyPreset(playlistEndPreset);
|
||||
return;
|
||||
}
|
||||
|
@ -221,6 +221,10 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
notifyMacro = request->hasArg(F("SM"));
|
||||
notifyTwice = request->hasArg(F("S2"));
|
||||
|
||||
nodeListEnabled = request->hasArg(F("NL"));
|
||||
if (!nodeListEnabled) Nodes.clear();
|
||||
nodeBroadcastEnabled = request->hasArg(F("NB"));
|
||||
|
||||
receiveDirect = request->hasArg(F("RD"));
|
||||
e131SkipOutOfSequence = request->hasArg(F("ES"));
|
||||
e131Multicast = request->hasArg(F("EM"));
|
||||
|
@ -169,7 +169,7 @@ void handleNotifications()
|
||||
|
||||
// WLED nodes info notifications
|
||||
if (isSupp && udpIn[0] == 255 && udpIn[1] == 1 && len >= 40) {
|
||||
if (notifier2Udp.remoteIP() == Network.localIP()) return;
|
||||
if (!nodeListEnabled || notifier2Udp.remoteIP() == Network.localIP()) return;
|
||||
|
||||
uint8_t unit = udpIn[39];
|
||||
NodesMap::iterator it = Nodes.find(unit);
|
||||
|
@ -258,7 +258,7 @@ void WLED::loop()
|
||||
yield();
|
||||
// refresh WLED nodes list
|
||||
refreshNodeList();
|
||||
sendSysInfoUDP();
|
||||
if (nodeBroadcastEnabled) sendSysInfoUDP();
|
||||
}
|
||||
|
||||
yield();
|
||||
@ -313,10 +313,13 @@ void WLED::setup()
|
||||
DEBUG_PRINTLN(ESP.getFreeHeap());
|
||||
registerUsermods();
|
||||
|
||||
|
||||
//DEBUG_PRINT(F("LEDs inited. heap usage ~"));
|
||||
//DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap());
|
||||
|
||||
#ifdef WLED_USE_DMX //reserve GPIO2 as hardcoded DMX pin
|
||||
pinManager.allocatePin(2);
|
||||
#endif
|
||||
|
||||
bool fsinit = false;
|
||||
DEBUGFS_PRINTLN(F("Mount FS"));
|
||||
#ifdef ARDUINO_ARCH_ESP32
|
||||
@ -351,7 +354,9 @@ void WLED::setup()
|
||||
if (strcmp(clientSSID, DEFAULT_CLIENT_SSID) == 0)
|
||||
showWelcomePage = true;
|
||||
WiFi.persistent(false);
|
||||
#ifdef WLED_USE_ETHERNET
|
||||
WiFi.onEvent(WiFiEvent);
|
||||
#endif
|
||||
|
||||
Serial.println(F("Ada"));
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
// version code in format yymmddb (b = daily build)
|
||||
#define VERSION 2103100
|
||||
#define VERSION 2103130
|
||||
|
||||
//uncomment this if you have a "my_config.h" file you'd like to use
|
||||
//#define WLED_USE_MY_CONFIG
|
||||
@ -253,6 +253,8 @@ WLED_GLOBAL bool syncToggleReceive _INIT(false); // UIs which only have a
|
||||
|
||||
// Sync CONFIG
|
||||
WLED_GLOBAL NodesMap Nodes;
|
||||
WLED_GLOBAL bool nodeListEnabled _INIT(true);
|
||||
WLED_GLOBAL bool nodeBroadcastEnabled _INIT(true);
|
||||
|
||||
WLED_GLOBAL bool buttonEnabled _INIT(true);
|
||||
WLED_GLOBAL byte irEnabled _INIT(0); // Infrared receiver
|
||||
|
@ -282,6 +282,9 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
}
|
||||
if (i) oappend(SET_F(","));
|
||||
oappend(SET_F("6,7,8,9,10,11")); // flash memory pins
|
||||
#ifdef WLED_ENABLE_DMX
|
||||
oappend(SET_F(",2")); // DMX hardcoded pin
|
||||
#endif
|
||||
#ifdef WLED_DEBUG
|
||||
oappend(SET_F(",1")); // debug output (TX) pin
|
||||
#endif
|
||||
@ -376,6 +379,10 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('c',SET_F("SH"),notifyHue);
|
||||
sappend('c',SET_F("SM"),notifyMacro);
|
||||
sappend('c',SET_F("S2"),notifyTwice);
|
||||
|
||||
sappend('c',SET_F("NL"),nodeListEnabled);
|
||||
sappend('c',SET_F("NB"),nodeBroadcastEnabled);
|
||||
|
||||
sappend('c',SET_F("RD"),receiveDirect);
|
||||
sappend('v',SET_F("EP"),e131Port);
|
||||
sappend('c',SET_F("ES"),e131SkipOutOfSequence);
|
||||
|
Loading…
Reference in New Issue
Block a user