diff --git a/VortexEngine/src/Log/Log.cpp b/VortexEngine/src/Log/Log.cpp index 3f4660c2e4..c79ff42b06 100644 --- a/VortexEngine/src/Log/Log.cpp +++ b/VortexEngine/src/Log/Log.cpp @@ -11,6 +11,10 @@ #include "VortexLib.h" #endif +#ifdef VORTEX_EMBEDDED +#include +#endif + #if LOGGING_LEVEL > 0 void InfoMsg(const char *msg, ...) { diff --git a/VortexEngine/src/Patterns/Multi/MeteorPattern.cpp b/VortexEngine/src/Patterns/Multi/MeteorPattern.cpp index 528fb1a36f..004da9867c 100644 --- a/VortexEngine/src/Patterns/Multi/MeteorPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/MeteorPattern.cpp @@ -34,9 +34,10 @@ void MeteorPattern::blinkOff() void MeteorPattern::poststep() { - // when a new meteor is created it is incerted into the stash so the blinking pattern is not interrupted - Pair target = (Pair)m_randCtx.next8(PAIR_FIRST, PAIR_LAST); - RGBColor col = m_colorset.getNext(); - m_stash.setIndex(pairEven(target), col); - m_stash.setIndex(pairOdd(target), col); + for (uint8_t meteorCount = 0; meteorCount < (LED_COUNT / 2); ++meteorCount) { + // when a new meteor is created it is incerted into the stash so the blinking pattern is not interrupted + LedPos target = (LedPos)m_randCtx.next8(LED_FIRST, LED_LAST); + RGBColor col = m_colorset.getNext(); + m_stash.setIndex(target, col); + } } diff --git a/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp b/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp index 685950b48a..2ccb29025b 100644 --- a/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp @@ -1,5 +1,9 @@ #include "ChaserPattern.h" +// This controls the ratio of chaser dots to LED_COUNT. Default 1 chaser per 7 LEDs. Range: 1-LED_COUNT. +#define CHASER_RATIO 7 + + // This pattern aims to be a demonstration of the sequencer. // There are always many ways to implement a pattern, it's best // to choose the method that is most suitable for the pattern. @@ -7,44 +11,41 @@ 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 8 steps in the chaser, so iterate 8 times and generate + // 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 < 8; ++i) { - // Each step all fingers are dops except for one, so start with a - // Pattern Map that has dops on all fingers. A Pattern Map will map + 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 finger in the pattern map with the Solid0 pattern + // 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 - // step index like this: - // - // step -> finger index -> target leds -> LedMap - // ----------------------------------------------------- - // 0 0 0, 1 00 00 00 00 11 - // 1 1 2, 3 00 00 00 11 00 - // 2 2 4, 5 00 00 11 00 00 - // 3 3 6, 7 00 11 00 00 00 - // 4 4 8, 9 11 00 00 00 00 - // 5 3 6, 7 00 11 00 00 00 - // 6 2 4, 5 00 00 11 00 00 - // 7 1 2, 3 00 00 00 11 00 - LedMap overrideLeds = MAP_PAIR((Pair)((i < 5) ? i : (8 - i))); - // 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, overrideLeds); + 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 8 steps will be 300ms each. + // 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(300, patMap); + m_sequence.addStep(150, patMap); } } diff --git a/VortexEngine/src/Patterns/PatternBuilder.cpp b/VortexEngine/src/Patterns/PatternBuilder.cpp index 8579af9880..0f0b15587d 100644 --- a/VortexEngine/src/Patterns/PatternBuilder.cpp +++ b/VortexEngine/src/Patterns/PatternBuilder.cpp @@ -164,28 +164,28 @@ PatternArgs PatternBuilder::getDefaultArgs(PatternID id) // ===================== // Multi Led Patterns: #if VORTEX_SLIM == 0 - case PATTERN_HUE_SCROLL: return PatternArgs(1, 1); + case PATTERN_HUE_SCROLL: return PatternArgs(1, 1, 10); case PATTERN_THEATER_CHASE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 28); case PATTERN_CHASER: return PatternArgs(); - case PATTERN_ZIGZAG: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 55, 1, 55); - case PATTERN_ZIPFADE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 100, 4, 1); - case PATTERN_DRIP: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 250); + case PATTERN_ZIGZAG: return PatternArgs(DOPS_ON_DURATION, 3, 3, 5, 55); + case PATTERN_ZIPFADE: return PatternArgs(DOPS_ON_DURATION, 2, 75, 9, 230); + case PATTERN_DRIP: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 150); case PATTERN_DRIPMORPH: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 1); - case PATTERN_CROSSDOPS: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 100); + case PATTERN_CROSSDOPS: return PatternArgs(DOPS_ON_DURATION, 2, 25); case PATTERN_DOUBLESTROBE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 115); - case PATTERN_METEOR: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 55, 75); - case PATTERN_SPARKLETRACE: return PatternArgs(5, 0, 50); - case PATTERN_VORTEXWIPE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 130); - case PATTERN_WARP: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 150); - case PATTERN_WARPWORM: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 110); - case PATTERN_SNOWBALL: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 110); - case PATTERN_LIGHTHOUSE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 100, 25, 5); - case PATTERN_PULSISH: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, STROBE_ON_DURATION, STROBE_OFF_DURATION, 250); - case PATTERN_FILL: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 200); - case PATTERN_BOUNCE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 200, 10); + case PATTERN_METEOR: return PatternArgs(1, 1, 20, 130); + case PATTERN_SPARKLETRACE: return PatternArgs(1, 5, 3); + case PATTERN_VORTEXWIPE: return PatternArgs(DOPS_ON_DURATION, 3, 80); + case PATTERN_WARP: return PatternArgs(3, DOPS_OFF_DURATION, 50); + case PATTERN_WARPWORM: return PatternArgs(DOPS_ON_DURATION, 10, 100); + case PATTERN_SNOWBALL: return PatternArgs(3, 3, 33); + case PATTERN_LIGHTHOUSE: return PatternArgs(DOPS_ON_DURATION, 5, 22, 3, 3); + case PATTERN_PULSISH: return PatternArgs(DOPS_ON_DURATION, 6, 5, 1, 100); + case PATTERN_FILL: return PatternArgs(DOPS_ON_DURATION, 5, 50); + case PATTERN_BOUNCE: return PatternArgs(10, 5, 50, 10); case PATTERN_SPLITSTROBIE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 0, 16, 3, 10, PATTERN_DOPS, PATTERN_STROBIE); case PATTERN_BACKSTROBE: return PatternArgs(DOPS_ON_DURATION, DOPS_OFF_DURATION, 0, HYPERSTROBE_ON_DURATION, HYPERSTROBE_OFF_DURATION, 10, PATTERN_DOPS, PATTERN_HYPERSTROBE); - case PATTERN_VORTEX: return PatternArgs(STROBE_ON_DURATION, STROBE_OFF_DURATION, 130); + case PATTERN_VORTEX: return PatternArgs(1, 1, 130); case PATTERN_NONE: break; default: break; #else