@petros, I’d be glad to help get your lights running, and to answer what questions I can.
Here’s the deal with the multisegment pattern. Right now there’s no way for a pattern to save all its variables between runs. The multisegment pattern is actually made to be used with home automation systems running on larger computers - the home automation platform handles all the saving and restoring of segment configuration and state. Setting up the Web UI version for long term use is a little more involved.
If you know how you want your segments configured on pattern load/startup, it’s actually fairly easy to modify the code to do that.
- at around line 39, change the
__n_segments = 4;
to the number of segments you want - comment out the default initialization loop (lines 283-290 – the block that starts with
// Initialize all segments to...
) - Set startup values for each of your segments, using the following function calls:
SetSegState(<segment number>,true) ; – turns the segment “on” (false is off)
SetSegEffect(<segment number>,<effect number>) - sets the animation for the segment. (0 is none)
SetSegHSB(<segment number>,h,s,v); - sets the initial color for the segment
SetSegSpeed(<segment number>,1); - sets initial speed for animations
SetSegSize(<segment number>,<pixels>); - sets the number of pixels in the segment. It will automatically figure out start/end locations. Comments around line 203 explain the rules for that.
Once you’ve done this for each segment,and saved the pattern that’s it. The pattern will come up initialized your way when you load it or restart your Pixelblaze. I do suggest saving with the
“Enable Web UI” slider set to off, because it’s possible that saved slider settings might mess up your first segment on load. To use the web UI, just turn it back on when you load!
You also might want to pick up the latest version at https://github.com/zranger1/PixelblazePatterns/blob/master/multisegmentdemo.js . I’ve probably updated some of the effects since I last uploaded to the library.