Quick Segment Reference Notes - AlbertGBarber/PixelSpork GitHub Wiki
Rules, Limits, and Other Quick Notes:
This page lists a number of rules and notes for segments sets, segments, and sections.
For a full introduction to segment sets see segment basics.
For the full, raw code specs of segment sets, segments, and sections, see Segment Set Class Notes, Segment Class Notes, and Section Struct Notes.
-
Segment sets are composed of an array of segments, who are, in turn composed of an array of sections. Sections contain the addresses of a group of LEDs
-
You can use the Segment Set Check utility effect to check your segment set layout.
-
Segment Sets can have 65535 segments.
-
Segments can have 256 sections, but they must be all one type, continuous or mixed.
-
Sections have a maximum length of 32,768.
-
Mixed sections have a minimum length of 0.
-
Continuous sections have a minimum length of -32,768. Negative lengths can be used to create reversed sections. (see Advanced Segment Usage)
-
-
While the individual size limits of Segment Sets, Segments, and Sections, are quite large, when combined, this limit is reduced because of their 2D aspects. Overall you must keep the ( "number of Segments in your Set" X "The number of LEDs in the longest Segment" ) less than 65,534. This amounts to a 256 x 256 matrix as a maximum size. However, note that I never intended for Pixel Spork to control anything close to that large, so it may become buggy or perform badly.
-
You can use a shorthand when creating sections: const PROGMEM segmentSecCont ringSec1[] = { {24, 16}, {40, 10} }; creates an section array with two sections, which we can plug directly into a segment. However, you cannot do the same with segments in segment sets. You must create each segment as its own variable.
-
There's no reason you can't have overlapping segments or sections, but the code doesn't expect this, so it may lead to weirdness or crashes, idk.
-
Sections are stored in program memory and cannot be changed during runtime.
-
Segments and Segment Sets can be changed at runtime.
-
Most Segment Set settings can be changed freely and shouldn't break most effects.
-
You shouldn't modify what sections are in a segment, but you can re-arrange them.
-
You can change what segments are in a set, but doing so may require you to reset effects.
-
-
The order of segments in a segment set is the same order that effects will use when drawing. Ie the first segment comes before the second segment and will be drawn on first. The same is true for sections within a segment.
-
Segments have a direction (
direct
). A value oftrue
means the segment is oriented starting with the first LED in the first section and running to the last LED in the last section. -
Segment directions determine effect directions. There are functions for changing them here.
-
You should use the segDrawUtils functions for drawing pixels directly.
-
Each effect requires a segment set to draw on. You can change that segment set at runtime, but this may require resetting or adjusting the effect.
-
Segment sets with a single segment are a "1D' line, any segment set with multiple segments is "2D".
-
The number of segment lines in a set is always equal to the length of the longest segment.
-
Any effect tagged with Seg Line or Seg will always try to draw the effect in 2D.
-
Minimizing the number of sections you have will improve performance, but may require more memory if consolidating from continuous to mixed sections.
-
Segment sets have color modes.
-
Each of these topics are covered in Advanced Segment Usage.
-
Segment sets have their own brightness, but this is not intended to be used for effects, more as a global setting.
-
You can configure a segment to be treated as a single LED. This is covered in Advanced Segment Usage.
-
Multiple effects can share one segment set, but this isn't fully supported -- effects will freely overwrite each other.
-
You can use "dummy" LEDs to "fill out" a segment set so that all segments have an equal number of LEDs (and therefore segment lines).
-