Un-F()-ed some strings

(that were either occuring at least 4 times, or were F()-ed in some places and not in others)
This commit is contained in:
cschwinne 2022-02-04 10:10:37 +01:00
parent b33c5798ee
commit 04d5932252
2 changed files with 24 additions and 24 deletions

View File

@ -76,7 +76,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
JsonObject hw = doc[F("hw")]; JsonObject hw = doc[F("hw")];
// initialize LED pins and lengths prior to other HW (except for ethernet) // initialize LED pins and lengths prior to other HW (except for ethernet)
JsonObject hw_led = hw[F("led")]; JsonObject hw_led = hw["led"];
CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]); CJSON(strip.ablMilliampsMax, hw_led[F("maxpwr")]);
CJSON(strip.milliampsPerLed, hw_led[F("ledma")]); CJSON(strip.milliampsPerLed, hw_led[F("ledma")]);
@ -105,7 +105,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
if (i>4) break; if (i>4) break;
} }
uint16_t length = elm[F("len")] | 1; uint16_t length = elm["len"] | 1;
uint8_t colorOrder = (int)elm[F("order")]; uint8_t colorOrder = (int)elm[F("order")];
uint8_t skipFirst = elm[F("skip")]; uint8_t skipFirst = elm[F("skip")];
uint16_t start = elm["start"] | 0; uint16_t start = elm["start"] | 0;
@ -130,8 +130,8 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
uint8_t s = 0; uint8_t s = 0;
for (JsonObject entry : hw_com) { for (JsonObject entry : hw_com) {
if (s > WLED_MAX_COLOR_ORDER_MAPPINGS) break; if (s > WLED_MAX_COLOR_ORDER_MAPPINGS) break;
uint16_t start = entry[F("start")] | 0; uint16_t start = entry["start"] | 0;
uint16_t len = entry[F("len")] | 0; uint16_t len = entry["len"] | 0;
uint8_t colorOrder = (int)entry[F("order")]; uint8_t colorOrder = (int)entry[F("order")];
com.add(start, len, colorOrder); com.add(start, len, colorOrder);
s++; s++;
@ -229,29 +229,29 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
if (light_gc_col > 1.5) strip.gammaCorrectCol = true; if (light_gc_col > 1.5) strip.gammaCorrectCol = true;
else if (light_gc_col > 0.5) strip.gammaCorrectCol = false; else if (light_gc_col > 0.5) strip.gammaCorrectCol = false;
JsonObject light_tr = light[F("tr")]; JsonObject light_tr = light["tr"];
CJSON(fadeTransition, light_tr[F("mode")]); CJSON(fadeTransition, light_tr["mode"]);
int tdd = light_tr["dur"] | -1; int tdd = light_tr["dur"] | -1;
if (tdd >= 0) transitionDelayDefault = tdd * 100; if (tdd >= 0) transitionDelayDefault = tdd * 100;
CJSON(strip.paletteFade, light_tr["pal"]); CJSON(strip.paletteFade, light_tr["pal"]);
JsonObject light_nl = light["nl"]; JsonObject light_nl = light["nl"];
CJSON(nightlightMode, light_nl[F("mode")]); CJSON(nightlightMode, light_nl["mode"]);
byte prev = nightlightDelayMinsDefault; byte prev = nightlightDelayMinsDefault;
CJSON(nightlightDelayMinsDefault, light_nl[F("dur")]); CJSON(nightlightDelayMinsDefault, light_nl["dur"]);
if (nightlightDelayMinsDefault != prev) nightlightDelayMins = nightlightDelayMinsDefault; if (nightlightDelayMinsDefault != prev) nightlightDelayMins = nightlightDelayMinsDefault;
CJSON(nightlightTargetBri, light_nl[F("tbri")]); CJSON(nightlightTargetBri, light_nl[F("tbri")]);
CJSON(macroNl, light_nl["macro"]); CJSON(macroNl, light_nl["macro"]);
JsonObject def = doc[F("def")]; JsonObject def = doc["def"];
CJSON(bootPreset, def["ps"]); CJSON(bootPreset, def["ps"]);
CJSON(turnOnAtBoot, def["on"]); // true CJSON(turnOnAtBoot, def["on"]); // true
CJSON(briS, def["bri"]); // 128 CJSON(briS, def["bri"]); // 128
JsonObject interfaces = doc["if"]; JsonObject interfaces = doc["if"];
JsonObject if_sync = interfaces[F("sync")]; JsonObject if_sync = interfaces["sync"];
CJSON(udpPort, if_sync[F("port0")]); // 21324 CJSON(udpPort, if_sync[F("port0")]); // 21324
CJSON(udpPort2, if_sync[F("port1")]); // 65506 CJSON(udpPort2, if_sync[F("port1")]); // 65506
@ -289,7 +289,7 @@ bool deserializeConfig(JsonObject doc, bool fromFS) {
CJSON(e131Universe, if_live_dmx[F("uni")]); CJSON(e131Universe, if_live_dmx[F("uni")]);
CJSON(e131SkipOutOfSequence, if_live_dmx[F("seqskip")]); CJSON(e131SkipOutOfSequence, if_live_dmx[F("seqskip")]);
CJSON(DMXAddress, if_live_dmx[F("addr")]); CJSON(DMXAddress, if_live_dmx[F("addr")]);
CJSON(DMXMode, if_live_dmx[F("mode")]); CJSON(DMXMode, if_live_dmx["mode"]);
tdd = if_live[F("timeout")] | -1; tdd = if_live[F("timeout")] | -1;
if (tdd >= 0) realtimeTimeoutMs = tdd * 100; if (tdd >= 0) realtimeTimeoutMs = tdd * 100;
@ -581,7 +581,7 @@ void serializeConfig() {
if (!bus || bus->getLength()==0) break; if (!bus || bus->getLength()==0) break;
JsonObject ins = hw_led_ins.createNestedObject(); JsonObject ins = hw_led_ins.createNestedObject();
ins["start"] = bus->getStart(); ins["start"] = bus->getStart();
ins[F("len")] = bus->getLength(); ins["len"] = bus->getLength();
JsonArray ins_pin = ins.createNestedArray("pin"); JsonArray ins_pin = ins.createNestedArray("pin");
uint8_t pins[5]; uint8_t pins[5];
uint8_t nPins = bus->getPins(pins); uint8_t nPins = bus->getPins(pins);
@ -591,7 +591,7 @@ void serializeConfig() {
ins[F("skip")] = bus->skippedLeds(); ins[F("skip")] = bus->skippedLeds();
ins["type"] = bus->getType() & 0x7F; ins["type"] = bus->getType() & 0x7F;
ins["ref"] = bus->isOffRefreshRequired(); ins["ref"] = bus->isOffRefreshRequired();
ins[F("rgbw")] = bus->isRgbw(); //ins[F("rgbw")] = bus->isRgbw();
} }
JsonArray hw_com = hw.createNestedArray(F("com")); JsonArray hw_com = hw.createNestedArray(F("com"));
@ -601,8 +601,8 @@ void serializeConfig() {
if (!entry) break; if (!entry) break;
JsonObject co = hw_com.createNestedObject(); JsonObject co = hw_com.createNestedObject();
co[F("start")] = entry->start; co["start"] = entry->start;
co[F("len")] = entry->len; co["len"] = entry->len;
co[F("order")] = entry->colorOrder; co[F("order")] = entry->colorOrder;
} }
@ -649,12 +649,12 @@ void serializeConfig() {
light_gc["col"] = (strip.gammaCorrectCol) ? 2.8 : 1.0; light_gc["col"] = (strip.gammaCorrectCol) ? 2.8 : 1.0;
JsonObject light_tr = light.createNestedObject("tr"); JsonObject light_tr = light.createNestedObject("tr");
light_tr[F("mode")] = fadeTransition; light_tr["mode"] = fadeTransition;
light_tr["dur"] = transitionDelayDefault / 100; light_tr["dur"] = transitionDelayDefault / 100;
light_tr["pal"] = strip.paletteFade; light_tr["pal"] = strip.paletteFade;
JsonObject light_nl = light.createNestedObject("nl"); JsonObject light_nl = light.createNestedObject("nl");
light_nl[F("mode")] = nightlightMode; light_nl["mode"] = nightlightMode;
light_nl["dur"] = nightlightDelayMinsDefault; light_nl["dur"] = nightlightDelayMinsDefault;
light_nl[F("tbri")] = nightlightTargetBri; light_nl[F("tbri")] = nightlightTargetBri;
light_nl["macro"] = macroNl; light_nl["macro"] = macroNl;
@ -699,7 +699,7 @@ void serializeConfig() {
if_live_dmx[F("uni")] = e131Universe; if_live_dmx[F("uni")] = e131Universe;
if_live_dmx[F("seqskip")] = e131SkipOutOfSequence; if_live_dmx[F("seqskip")] = e131SkipOutOfSequence;
if_live_dmx[F("addr")] = DMXAddress; if_live_dmx[F("addr")] = DMXAddress;
if_live_dmx[F("mode")] = DMXMode; if_live_dmx["mode"] = DMXMode;
if_live[F("timeout")] = realtimeTimeoutMs / 100; if_live[F("timeout")] = realtimeTimeoutMs / 100;
if_live[F("maxbri")] = arlsForceMaxBri; if_live[F("maxbri")] = arlsForceMaxBri;

View File

@ -33,7 +33,7 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
uint16_t start = elem["start"] | seg.start; uint16_t start = elem["start"] | seg.start;
int stop = elem["stop"] | -1; int stop = elem["stop"] | -1;
if (stop < 0) { if (stop < 0) {
uint16_t len = elem[F("len")]; uint16_t len = elem["len"];
stop = (len > 0) ? start + len : seg.stop; stop = (len > 0) ? start + len : seg.stop;
} }
@ -281,8 +281,8 @@ bool deserializeState(JsonObject root, byte callMode, byte presetId)
JsonObject nl = root["nl"]; JsonObject nl = root["nl"];
nightlightActive = nl["on"] | nightlightActive; nightlightActive = nl["on"] | nightlightActive;
nightlightDelayMins = nl[F("dur")] | nightlightDelayMins; nightlightDelayMins = nl["dur"] | nightlightDelayMins;
nightlightMode = nl[F("mode")] | nightlightMode; nightlightMode = nl["mode"] | nightlightMode;
nightlightTargetBri = nl[F("tbri")] | nightlightTargetBri; nightlightTargetBri = nl[F("tbri")] | nightlightTargetBri;
JsonObject udpn = root["udpn"]; JsonObject udpn = root["udpn"];
@ -403,7 +403,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool fo
root["start"] = seg.start; root["start"] = seg.start;
root["stop"] = seg.stop; root["stop"] = seg.stop;
} }
if (!forPreset) root[F("len")] = seg.stop - seg.start; if (!forPreset) root["len"] = seg.stop - seg.start;
root["grp"] = seg.grouping; root["grp"] = seg.grouping;
root[F("spc")] = seg.spacing; root[F("spc")] = seg.spacing;
root[F("of")] = seg.offset; root[F("of")] = seg.offset;
@ -465,8 +465,8 @@ void serializeState(JsonObject root, bool forPreset, bool includeBri, bool segme
JsonObject nl = root.createNestedObject("nl"); JsonObject nl = root.createNestedObject("nl");
nl["on"] = nightlightActive; nl["on"] = nightlightActive;
nl[F("dur")] = nightlightDelayMins; nl["dur"] = nightlightDelayMins;
nl[F("mode")] = nightlightMode; nl["mode"] = nightlightMode;
nl[F("tbri")] = nightlightTargetBri; nl[F("tbri")] = nightlightTargetBri;
if (nightlightActive) { if (nightlightActive) {
nl[F("rem")] = (nightlightDelayMs - (millis() - nightlightStartTime)) / 1000; // seconds remaining nl[F("rem")] = (nightlightDelayMs - (millis() - nightlightStartTime)) / 1000; // seconds remaining