Skip to content

Commit

Permalink
Merge branch 'master' into gloves
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Dec 10, 2023
2 parents 4a7c54a + 3600a70 commit 67a50c3
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,41 +11,15 @@ ChaserPattern::ChaserPattern(const PatternArgs &args) :
SequencedPattern(args)
{
setArgs(args);

// Makes sure there is at least 1 chaser
uint32_t numChasers = LED_COUNT / CHASER_RATIO;
if (!numChasers) {
numChasers = 1;
}
// set the pattern ID
//m_patternID = PATTERN_CHASER;
// There are LED_COUNT steps in the chaser, so iterate LED_COUNT times and generate
// a pattern map for each step. A colorset map can also be applied
// to override certain colors for specific steps, but that's not
// what is being done here
for (uint8_t i = 0; i < (LED_COUNT / numChasers); ++i) {
// Each step all LEDs are dops except for one, so start with a
// Pattern Map that has dops on all LEDs. A Pattern Map will map
// a Pattern ID to each LED on the device, then we will override a
// different entry each step with the Pattern ID for Solid0.
PatternMap patMap(PATTERN_DOPS);
// Override a single LED in the pattern map with the Solid0 pattern
// which will use the 0th color from the colorset as the solid color.
// An LedMap is a bitmap that indicates which leds are turned on or off
// at any given time. This will generate an Led Map based on the current
LedMap overrideLeds = MAP_LED_NONE;
// This creates an led map with 1 chaser per CHASER_RATIO (default 7) leds in LED_COUNT
for (uint8_t chaserCount = 0; chaserCount < numChasers; ++chaserCount) {
// Then this API is used to override specific positions in the Pattern Map
// with a different pattern ID, we use the Led Map generated above to tell
// setPatternAt() which indices to override with Solid0
patMap.setPatternAt(PATTERN_SOLID, MAP_LED((i + (chaserCount * CHASER_RATIO)) % LED_COUNT));
}
// Then finally we add this pattern mapping to the sequence in a new step
// that will last 300ms, this means all LED_COUNT steps will be 300ms each.
// The last parameter of addStep() is omitted, that parameter could be used
// to override the colorset for specific Leds on any given step. Since it
// is omitted that means this pattern will use whichever colorset is chosen
m_sequence.addStep(150, patMap);
}
}

0 comments on commit 67a50c3

Please sign in to comment.