Merge remote-tracking branch 'upstream/main' into mdev

Some additions:

pio.ini: add debug entries
cfg.cpp, set.cpp, xml/cpp: keep storing basic 2D setup

index.js: use ledmapFileNames

settings_2D.htm: keep using basic and advanced

FX_2Dfcn.cpp: use gaptable and also MM ledmaps

FX_fcn.cpp: extend enumerateledmaps with AC ledmapNames (but not used in UI)
This commit is contained in:
Ewoud
2023-02-22 16:09:27 +01:00
62 changed files with 2521 additions and 8104 deletions

View File

@@ -100,18 +100,20 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
JsonObject matrix = hw_led[F("matrix")];
if (!matrix.isNull()) {
strip.isMatrix = true;
//WLEDMM: keep storing basic 2d setup
CJSON(strip.panels, matrix[F("mpc")]);
CJSON(strip.bOrA, matrix["ba"]); //WLEDMM basic or advanced
CJSON(strip.panelsV, matrix[F("mpv")]); //WLEDMM needs to be stored as well
CJSON(strip.panelsH, matrix[F("mph")]); //WLEDMM needs to be stored as well
CJSON(strip.panelsV, matrix[F("mpv")]);
CJSON(strip.panelsH, matrix[F("mph")]);
CJSON(strip.matrix.bottomStart, matrix[F("pb")]);
CJSON(strip.matrix.rightStart, matrix[F("pr")]);
CJSON(strip.matrix.vertical, matrix[F("pv")]);
CJSON(strip.matrix.serpentine, matrix["ps"]);
CJSON(strip.panelO.bottomStart, matrix[F("pbl")]); //WLEDMM
CJSON(strip.panelO.rightStart, matrix[F("prl")]); //WLEDMM
CJSON(strip.panelO.vertical, matrix[F("pvl")]); //WLEDMM
CJSON(strip.panelO.serpentine, matrix["psl"]); //WLEDMM
CJSON(strip.panelO.bottomStart, matrix[F("pbl")]);
CJSON(strip.panelO.rightStart, matrix[F("prl")]);
CJSON(strip.panelO.vertical, matrix[F("pvl")]);
CJSON(strip.panelO.serpentine, matrix["psl"]);
strip.panel.clear();
JsonArray panels = matrix[F("panels")];
@@ -140,8 +142,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
p.options = 0;
strip.panel.push_back(p);
}
strip.setUpMatrix();
// cannot call strip.setUpMatrix() here due to already locked JSON buffer
}
#endif
@@ -342,12 +343,20 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
CJSON(strip.paletteBlend, light[F("pal-mode")]);
CJSON(autoSegments, light[F("aseg")]);
CJSON(gammaCorrectVal, light["gc"]["val"]); // default 2.8
float light_gc_bri = light["gc"]["bri"];
float light_gc_col = light["gc"]["col"]; // 2.8
if (light_gc_bri > 1.5) gammaCorrectBri = true;
else if (light_gc_bri > 0.5) gammaCorrectBri = false;
if (light_gc_col > 1.5) gammaCorrectCol = true;
else if (light_gc_col > 0.5) gammaCorrectCol = false;
float light_gc_col = light["gc"]["col"];
if (light_gc_bri > 1.0f) gammaCorrectBri = true;
else gammaCorrectBri = false;
if (light_gc_col > 1.0f) gammaCorrectCol = true;
else gammaCorrectCol = false;
if (gammaCorrectVal > 1.0f && gammaCorrectVal <= 3) {
if (gammaCorrectVal != 2.8f) calcGammaTable(gammaCorrectVal);
} else {
gammaCorrectVal = 1.0f; // no gamma correction
gammaCorrectBri = false;
gammaCorrectCol = false;
}
JsonObject light_tr = light["tr"];
CJSON(fadeTransition, light_tr["mode"]);
@@ -415,6 +424,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
if (!DMXAddress || DMXAddress > 510) DMXAddress = 1;
CJSON(DMXSegmentSpacing, if_live_dmx[F("dss")]);
if (DMXSegmentSpacing > 150) DMXSegmentSpacing = 0;
CJSON(e131Priority, if_live_dmx[F("e131prio")]);
if (e131Priority > 200) e131Priority = 200;
CJSON(DMXMode, if_live_dmx["mode"]);
tdd = if_live[F("timeout")] | -1;
@@ -430,17 +441,6 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
CJSON(alexaNumPresets, interfaces["va"]["p"]);
#ifndef WLED_DISABLE_BLYNK
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["blynk"];
getStringFromJson(blynkHost, if_blynk[F("host")], 33);
CJSON(blynkPort, if_blynk["port"]);
#endif
#ifdef WLED_ENABLE_MQTT
JsonObject if_mqtt = interfaces["mqtt"];
CJSON(mqttEnabled, if_mqtt["en"]);
@@ -717,9 +717,11 @@ void serializeConfig() {
if (strip.isMatrix) {
JsonObject matrix = hw_led.createNestedObject(F("matrix"));
matrix[F("mpc")] = strip.panels;
//WLEDMM: keep storing basic 2d setup
matrix[F("ba")] = strip.bOrA; //WLEDMM basic or advanced
matrix[F("mph")] = strip.panelsH; //WLEDMM needs to be stored as well
matrix[F("mpv")] = strip.panelsV; //WLEDMM needs to be stored as well
matrix[F("mph")] = strip.panelsH;
matrix[F("mpv")] = strip.panelsV;
matrix[F("pb")] = strip.matrix.bottomStart;
matrix[F("pr")] = strip.matrix.rightStart;
matrix[F("pv")] = strip.matrix.vertical;
@@ -822,8 +824,9 @@ void serializeConfig() {
light[F("aseg")] = autoSegments;
JsonObject light_gc = light.createNestedObject("gc");
light_gc["bri"] = (gammaCorrectBri) ? 2.8 : 1.0;
light_gc["col"] = (gammaCorrectCol) ? 2.8 : 1.0;
light_gc["bri"] = (gammaCorrectBri) ? gammaCorrectVal : 1.0f; // keep compatibility
light_gc["col"] = (gammaCorrectCol) ? gammaCorrectVal : 1.0f; // keep compatibility
light_gc["val"] = gammaCorrectVal;
JsonObject light_tr = light.createNestedObject("tr");
light_tr["mode"] = fadeTransition;
@@ -877,6 +880,7 @@ void serializeConfig() {
JsonObject if_live_dmx = if_live.createNestedObject("dmx");
if_live_dmx[F("uni")] = e131Universe;
if_live_dmx[F("seqskip")] = e131SkipOutOfSequence;
if_live_dmx[F("e131prio")] = e131Priority;
if_live_dmx[F("addr")] = DMXAddress;
if_live_dmx[F("dss")] = DMXSegmentSpacing;
if_live_dmx["mode"] = DMXMode;
@@ -895,13 +899,6 @@ void serializeConfig() {
if_va["p"] = alexaNumPresets;
#ifndef WLED_DISABLE_BLYNK
JsonObject if_blynk = interfaces.createNestedObject("blynk");
if_blynk[F("token")] = strlen(blynkApiKey) ? "Hidden":"";
if_blynk[F("host")] = blynkHost;
if_blynk["port"] = blynkPort;
#endif
#ifdef WLED_ENABLE_MQTT
JsonObject if_mqtt = interfaces.createNestedObject("mqtt");
if_mqtt["en"] = mqttEnabled;
@@ -1032,13 +1029,6 @@ bool deserializeConfigSec() {
JsonObject interfaces = doc["if"];
#ifndef WLED_DISABLE_BLYNK
const char* apikey = interfaces["blynk"][F("token")] | "Hidden";
int tdd = strnlen(apikey, 36);
if (tdd > 20 || tdd == 0)
getStringFromJson(blynkApiKey, apikey, 36);
#endif
#ifdef WLED_ENABLE_MQTT
JsonObject if_mqtt = interfaces["mqtt"];
getStringFromJson(mqttPass, if_mqtt["psk"], 65);
@@ -1077,10 +1067,6 @@ void serializeConfigSec() {
ap["psk"] = apPass;
JsonObject interfaces = doc.createNestedObject("if");
#ifndef WLED_DISABLE_BLYNK
JsonObject if_blynk = interfaces.createNestedObject("blynk");
if_blynk[F("token")] = blynkApiKey;
#endif
#ifdef WLED_ENABLE_MQTT
JsonObject if_mqtt = interfaces.createNestedObject("mqtt");
if_mqtt["psk"] = mqttPass;