Saving and loading of grouping and spacing.
This commit is contained in:
parent
55e2bc27c6
commit
2dce4462a0
@ -50,6 +50,8 @@ void WS2812FX::init(bool supportWhite, uint16_t countPixels, uint8_t group, uint
|
||||
_locked = new byte[_length];
|
||||
|
||||
_segments[0].start = 0;
|
||||
_segments[0].group = _group;
|
||||
_segments[0].spacing = _spacing;
|
||||
_segments[0].stop = getUsableCount();
|
||||
_segments[0].rawLength = _length;
|
||||
|
||||
|
Binary file not shown.
@ -151,8 +151,9 @@ Palette blending:
|
||||
</select><br>
|
||||
Reverse LED order (rotate 180): <input type=checkbox name=RV><br>
|
||||
Skip first LED: <input type=checkbox name=SL><br>
|
||||
Disable repeating N LEDs: <input type=number min=0 max=255 name=DL><br>
|
||||
(Turns off N LEDs between each lit one, spacing out effects)<hr>
|
||||
LED spacing: <input type=number min=0 max=255 name=SP><br>
|
||||
(Turns off N LEDs between each lit one, spacing out effects)<br>
|
||||
LED grouping: <input type=number min=1 max=255 name=GR><hr>
|
||||
<button type=button onclick=B()>Back</button><button type=submit>Save</button>
|
||||
</form></body></html>)=====";
|
||||
|
||||
|
@ -150,6 +150,7 @@ uint16_t transitionDelay = 750; //default crossfade duration in ms
|
||||
//bool strip.reverseMode = false; //flip entire LED strip (reverses all effect directions) --> edit in WS2812FX.h
|
||||
bool skipFirstLed = false; //ignore first LED in strip (useful if you need the LED as signal repeater)
|
||||
uint8_t spacing = 0; //disables N LEDs between active nodes. (Useful for spacing out lights for more traditional christmas light look)
|
||||
uint8_t group = 1; //Group LEDs into one logical LED
|
||||
byte briMultiplier = 100; //% of brightness to set (to limit power, if you set it to 50 and set bri to 255, actual brightness will be 127)
|
||||
|
||||
|
||||
|
@ -230,6 +230,7 @@ void saveSettingsToEEPROM()
|
||||
}
|
||||
|
||||
EEPROM.write(2213, spacing);
|
||||
EEPROM.write(2214, group);
|
||||
|
||||
writeStringToEEPROM(2220, blynkApiKey, 35);
|
||||
|
||||
@ -481,6 +482,7 @@ void loadSettingsFromEEPROM(bool first)
|
||||
}
|
||||
|
||||
spacing = EEPROM.read(2213);
|
||||
group = max(1, EEPROM.read(2214));
|
||||
|
||||
bootPreset = EEPROM.read(389);
|
||||
wifiLock = EEPROM.read(393);
|
||||
|
@ -237,7 +237,8 @@ void getSettingsJS(byte subPage, char* dest)
|
||||
sappend('i',"PB",strip.paletteBlend);
|
||||
sappend('c',"RV",strip.reverseMode);
|
||||
sappend('c',"SL",skipFirstLed);
|
||||
sappend('v',"DL",spacing);
|
||||
sappend('v',"SP",spacing);
|
||||
sappend('v',"GR",group);
|
||||
}
|
||||
|
||||
if (subPage == 3)
|
||||
|
@ -93,7 +93,8 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
if (t >= 0 && t < 4) strip.paletteBlend = t;
|
||||
strip.reverseMode = request->hasArg("RV");
|
||||
skipFirstLed = request->hasArg("SL");
|
||||
spacing = request->arg("DL").toInt();
|
||||
spacing = request->arg("SP").toInt();
|
||||
group = request->arg("GR").toInt();
|
||||
t = request->arg("BF").toInt();
|
||||
if (t > 0) briMultiplier = t;
|
||||
}
|
||||
@ -274,7 +275,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
|
||||
}
|
||||
if (subPage != 6 || !doReboot) saveSettingsToEEPROM(); //do not save if factory reset
|
||||
if (subPage == 2) {
|
||||
strip.init(useRGBW,ledCount,1,spacing,skipFirstLed);
|
||||
strip.init(useRGBW,ledCount,group,spacing,skipFirstLed);
|
||||
}
|
||||
if (subPage == 4) alexaInit();
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ void wledInit()
|
||||
spacing = EEPROM.read(2213);
|
||||
//this was reading 255 after inital flash causing bootloop. Don't know why.
|
||||
spacing = spacing!= 255 ? spacing : 0;
|
||||
group = max(1, EEPROM.read(2214));
|
||||
|
||||
#ifdef ESP8266
|
||||
#if LEDPIN == 3
|
||||
@ -30,7 +31,7 @@ void wledInit()
|
||||
DEBUG_PRINT("heap ");
|
||||
DEBUG_PRINTLN(ESP.getFreeHeap());
|
||||
|
||||
strip.init(EEPROM.read(372),ledCount,1,spacing,EEPROM.read(2204)); //init LEDs quickly
|
||||
strip.init(EEPROM.read(372),ledCount,group,spacing,EEPROM.read(2204)); //init LEDs quickly
|
||||
strip.setBrightness(0);
|
||||
|
||||
DEBUG_PRINT("LEDs inited. heap usage ~");
|
||||
|
@ -8,14 +8,12 @@ void deserializeSegment(JsonObject elem, byte it)
|
||||
if (id < strip.getMaxSegments())
|
||||
{
|
||||
WS2812FX::Segment& seg = strip.getSegment(id);
|
||||
uint16_t start = elem["start"] | seg.start;
|
||||
int stop = elem["stop"] | -1;
|
||||
uint16_t start = elem.containsKey("start") ? elem["start"] : seg.start;
|
||||
uint16_t len = elem.containsKey("len") ? elem["len"] : seg.rawLength;
|
||||
uint8_t group = max(1, elem["grp"] | seg.group);
|
||||
uint8_t spacing = elem.containsKey("spc") ? elem["spc"] : seg.spacing;
|
||||
|
||||
if (stop < 0) {
|
||||
uint16_t len = elem["len"];
|
||||
stop = (len > 0) ? start + len : seg.stop;
|
||||
}
|
||||
strip.setSegment(id, start, stop, 1, 0);
|
||||
strip.setSegment(id, start, len, group, spacing);
|
||||
|
||||
JsonArray colarr = elem["col"];
|
||||
if (!colarr.isNull())
|
||||
@ -158,7 +156,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id)
|
||||
root["id"] = id;
|
||||
root["start"] = seg.start;
|
||||
root["stop"] = seg.stop;
|
||||
root["len"] = seg.stop - seg.start;
|
||||
root["len"] = seg.rawLength;
|
||||
|
||||
JsonArray colarr = root.createNestedArray("col");
|
||||
|
||||
@ -178,6 +176,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id)
|
||||
root["pal"] = seg.palette;
|
||||
root["sel"] = seg.isSelected();
|
||||
root["grp"] = seg.group;
|
||||
root["spc"] = seg.spacing;
|
||||
root["rev"] = seg.getOption(1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user