diff --git a/VortexEngine/src/Leds/LedTypes.h b/VortexEngine/src/Leds/LedTypes.h index b81135b1c0..59f519be88 100644 --- a/VortexEngine/src/Leds/LedTypes.h +++ b/VortexEngine/src/Leds/LedTypes.h @@ -198,6 +198,13 @@ inline LedPos ledmapGetNextLed(LedMap map, LedPos pos) #define MAP_LINE_4 (MAP_LED(LED_3) | MAP_LED(LED_13) | MAP_LED(LED_18) | MAP_LED(LED_8)) #define MAP_LINE_5 (MAP_LED(LED_4) | MAP_LED(LED_14) | MAP_LED(LED_19) | MAP_LED(LED_9)) +//Chromadeck bitmap +#define MAP_OPPOSITES_1 (MAP_LED(LED_0) | MAP_LED(LED_5) | MAP_LED(LED_10) | MAP_LED(LED_15)) +#define MAP_OPPOSITES_2 (MAP_LED(LED_1) | MAP_LED(LED_6) | MAP_LED(LED_11) | MAP_LED(LED_16)) +#define MAP_OPPOSITES_3 (MAP_LED(LED_2) | MAP_LED(LED_7) | MAP_LED(LED_12) | MAP_LED(LED_17)) +#define MAP_OPPOSITES_4 (MAP_LED(LED_3) | MAP_LED(LED_8) | MAP_LED(LED_13) | MAP_LED(LED_18)) +#define MAP_OPPOSITES_5 (MAP_LED(LED_4) | MAP_LED(LED_9) | MAP_LED(LED_14) | MAP_LED(LED_19)) + // set a single led inline void ledmapSetLed(LedMap &map, LedPos pos) { diff --git a/VortexEngine/src/Menus/MainMenu.cpp b/VortexEngine/src/Menus/MainMenu.cpp index cc4345c78e..138a2a0d14 100644 --- a/VortexEngine/src/Menus/MainMenu.cpp +++ b/VortexEngine/src/Menus/MainMenu.cpp @@ -36,6 +36,9 @@ bool MainMenu::run() if (g_pButtonM->onShortClick()) { select(); } + if (g_pButtonM->onLongClick()) { + select(); + } // press > if (g_pButtonR->onShortClick()) { pressRight(); diff --git a/VortexEngine/src/Menus/Menu.cpp b/VortexEngine/src/Menus/Menu.cpp index c82b6f1a40..9deb117cd6 100644 --- a/VortexEngine/src/Menus/Menu.cpp +++ b/VortexEngine/src/Menus/Menu.cpp @@ -122,7 +122,7 @@ Menu::MenuAction Menu::run() m_ledSelection = (m_ledSelection > 0) ? (m_ledSelection - 1) : (NUM_PERMUTATIONS - 1); } // on a long press of the button, lock in the target led - if (g_pButtonM->onLongClick()) { + if (g_pButtonM->onLongClick() || g_pButtonM->onShortClick()) { // if no target, set at least cur mask if (m_targetLeds == 0) { //if (m_targetLeds == MAP_LED_NONE) { diff --git a/VortexEngine/src/Menus/MenuList/FactoryReset.cpp b/VortexEngine/src/Menus/MenuList/FactoryReset.cpp index 6da188033d..5106462e02 100644 --- a/VortexEngine/src/Menus/MenuList/FactoryReset.cpp +++ b/VortexEngine/src/Menus/MenuList/FactoryReset.cpp @@ -57,11 +57,16 @@ Menu::MenuAction FactoryReset::run() return MENU_CONTINUE; } -void FactoryReset::onShortClickM() +void FactoryReset::onShortClickL() { m_curSelection = (uint8_t)!m_curSelection; } +void FactoryReset::onShortClickR() +{ + onShortClickL(); +} + void FactoryReset::onLongClickM() { if (m_curSelection == 0) { @@ -96,32 +101,50 @@ void FactoryReset::onLongClickM() void FactoryReset::showReset() { + // if we're on exit just set the rest to blank if (m_curSelection == 0) { Leds::clearAll(); Leds::blinkAll(350, 350, RGB_WHITE0); return; } - bool isPressed = g_pButtonM->isPressed(); - if (!isPressed) { - Leds::clearAll(); - Leds::blinkAll(50, 50, RGB_RED4); + // otherwise we're not on exit, if the button isn't pressed + if (!g_pButtonM->isPressed()) { + // just idle blink from clear to blank + Leds::clearRange(LED_FIRST, LED_LAST); + Leds::blinkRange(LED_FIRST, LED_LAST, 250, 150, RGB_RED0); return; } - // don't start the fill until the button has been held for a bit - uint32_t holdDur = g_pButtonM->holdDuration(); - if (holdDur < MS_TO_TICKS(100)) { + + // the button is pressed so show the reset countdown timer + + // the progress is how long the hold duration has been held + // relative to the factory reset threshold time + float progress = (float)g_pButtonM->holdDuration() / FACTORY_RESET_THRESHOLD_TICKS; + // prevents the countdown timer from showing unless button is held longer than 3% of the reset Threshold (this is for short clicks) + if (progress < 0.03) { return; } - uint16_t progress = ((holdDur * 100) / FACTORY_RESET_THRESHOLD_TICKS); - DEBUG_LOGF("progress: %d", progress); - if (progress >= 100) { - Leds::setAll(RGB_WHITE); + // the ledProgress is just an LED from pinky tip to index top based on progress + LedPos ledProgress = (LedPos)(progress * LED_LAST); + // max the led progress at index top (don't include thumb) + if (ledProgress > LED_LAST) { + // when we reach the end of the progress bar just blink white + Leds::blinkRange(LED_FIRST, LED_LAST, 80, 60, RGB_WHITE6); return; } - uint8_t offMs = 100; - uint8_t onMs = (progress > 60) ? 30 : 100; - uint8_t sat = (uint8_t)((progress * 5) >> 1); // Using bit shift for division by 2 - Leds::clearAll(); - Leds::blinkAll(offMs, onMs, HSVColor(0, 255 - sat, 180)); + + // the off/on ms blink faster based on the progress + uint32_t offMs = 150 - ((65 / LED_COUNT) * ledProgress); + uint32_t onMs = 200 - ((25 / LED_COUNT) * ledProgress); + // the 'endled' is the tip of the reset progress bar, since the progress + // bar starts full red and empties down to the pinky that means it is + // inverted from the 'ledProgress' which starts at 0 and grows + LedPos endLed = (LedPos)(LED_LAST - ledProgress); + // clear all the leds so that 'blinkRange' will blink from off to the designated color + Leds::clearRange(LED_FIRST, LED_LAST); + // blink to the calculated redish hue from pinky to the end led + Leds::blinkRange(LED_FIRST, endLed, offMs, onMs, HSVColor(0, 255 - (progress * 170), 180)); + // and blink the background the regular blank color + Leds::blinkRange((LedPos)(endLed + 1), LED_LAST, offMs, onMs, RGB_WHITE0); } diff --git a/VortexEngine/src/Menus/MenuList/FactoryReset.h b/VortexEngine/src/Menus/MenuList/FactoryReset.h index 5d1a0864a8..f4469a1af2 100644 --- a/VortexEngine/src/Menus/MenuList/FactoryReset.h +++ b/VortexEngine/src/Menus/MenuList/FactoryReset.h @@ -13,7 +13,8 @@ class FactoryReset : public Menu MenuAction run() override; // handlers for clicks - void onShortClickM() override; + void onShortClickL() override; + void onShortClickR() override; void onLongClickM() override; private: diff --git a/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp b/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp index 633b32fcff..3bcb9b8897 100644 --- a/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp +++ b/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp @@ -49,12 +49,27 @@ Menu::MenuAction GlobalBrightness::run() return MENU_CONTINUE; } -void GlobalBrightness::onShortClickM() +void GlobalBrightness::onShortClickR() { // include one extra option for the exit slot m_curSelection = (m_curSelection + 1) % (NUM_BRIGHTNESS_OPTIONS + 1); } +void GlobalBrightness::onShortClickL() +{ + // include one extra option for the exit slot + if (!m_curSelection) { + m_curSelection = NUM_BRIGHTNESS_OPTIONS; + } else { + m_curSelection = m_curSelection - 1; + } +} + +void GlobalBrightness::onShortClickM() +{ + onLongClickM(); +} + void GlobalBrightness::onLongClickM() { if (m_curSelection >= NUM_BRIGHTNESS_OPTIONS) { diff --git a/VortexEngine/src/Menus/MenuList/GlobalBrightness.h b/VortexEngine/src/Menus/MenuList/GlobalBrightness.h index ce14160184..875303fb9a 100644 --- a/VortexEngine/src/Menus/MenuList/GlobalBrightness.h +++ b/VortexEngine/src/Menus/MenuList/GlobalBrightness.h @@ -13,6 +13,8 @@ class GlobalBrightness : public Menu MenuAction run() override; // handlers for clicks + void onShortClickL() override; + void onShortClickR() override; void onShortClickM() override; void onLongClickM() override; diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp index 3033ea4ad6..81ae047bdd 100644 --- a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp +++ b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp @@ -52,11 +52,21 @@ void PatternSelect::onLedSelected() m_srcLed = ledmapGetFirstLed(m_targetLeds); } -void PatternSelect::onShortClickM() +void PatternSelect::onShortClickR() { nextPattern(); } +void PatternSelect::onShortClickL() +{ + previousPattern(); +} + +void PatternSelect::onShortClickM() +{ + onLongClickM(); +} + void PatternSelect::nextPatternID() { // increment to next pattern @@ -72,7 +82,7 @@ void PatternSelect::nextPatternID() beginList = PATTERN_MULTI_FIRST; } #endif - m_newPatternID = (PatternID)((m_newPatternID + 1) % endList); + m_newPatternID = (PatternID)((m_newPatternID + 1) % (endList + 1)); if (m_newPatternID > endList || m_newPatternID < beginList) { m_newPatternID = beginList; } @@ -101,6 +111,51 @@ void PatternSelect::nextPattern() DEBUG_LOGF("Iterated to pattern id %d", m_newPatternID); } +void PatternSelect::previousPatternID() +{ + // increment to next pattern + PatternID endList = PATTERN_SINGLE_LAST; + PatternID beginList = PATTERN_SINGLE_FIRST; +#if VORTEX_SLIM == 0 + // if targeted multi led or all singles, iterate through multis + if ((m_targetLeds == MAP_LED_ALL) || (m_targetLeds == MAP_LED(LED_MULTI))) { + endList = PATTERN_MULTI_LAST; + } + // if targeted multi then start at multis and only iterate multis + if ((m_targetLeds == MAP_LED(LED_MULTI))) { + beginList = PATTERN_MULTI_FIRST; + } +#endif + if (m_newPatternID > beginList) { + m_newPatternID = (PatternID)(m_newPatternID - 1); + } else { + m_newPatternID = endList; + } +} + +void PatternSelect::previousPattern() +{ + if (m_started) { + previousPatternID(); + } else { + m_started = true; + // Do not modify m_newPatternID Here! It has been set in the long click handler + // to be the start of the list we want to iterate + } + // set the new pattern id + if (isMultiLedPatternID(m_newPatternID)) { + m_previewMode.setPattern(m_newPatternID); + } else { + // if the user selected multi then just put singles on all leds + LedMap setLeds = (m_targetLeds == MAP_LED(LED_MULTI)) ? LED_ALL : m_targetLeds; + m_previewMode.setPatternMap(setLeds, m_newPatternID); + // TODO: clear multi a better way + m_previewMode.clearPattern(LED_MULTI); + } + m_previewMode.init(); + DEBUG_LOGF("Iterated to pattern id %d", m_newPatternID); +} + void PatternSelect::onLongClickM() { bool needsSave = false; diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.h b/VortexEngine/src/Menus/MenuList/PatternSelect.h index 29a61ef3dc..7690dc6e32 100644 --- a/VortexEngine/src/Menus/MenuList/PatternSelect.h +++ b/VortexEngine/src/Menus/MenuList/PatternSelect.h @@ -19,12 +19,16 @@ class PatternSelect : public Menu void onLedSelected() override; // handlers for clicks + void onShortClickL() override; + void onShortClickR() override; void onShortClickM() override; void onLongClickM() override; private: void nextPatternID(); void nextPattern(); + void previousPatternID(); + void previousPattern(); // the patternid of the current demo PatternID m_newPatternID; diff --git a/VortexEngine/src/Modes/DefaultModes.cpp b/VortexEngine/src/Modes/DefaultModes.cpp index a0f4be8b7c..ef535e5b0f 100644 --- a/VortexEngine/src/Modes/DefaultModes.cpp +++ b/VortexEngine/src/Modes/DefaultModes.cpp @@ -122,6 +122,27 @@ const default_mode_entry default_modes[MAX_MODES] = { RGB_GREEN, RGB_BLUE } + }, + { + PATTERN_STROBE, 2, { + RGB_RED, + RGB_GREEN, + } + }, + { + PATTERN_DRIP, 4, { + RGB_RED, + RGB_GREEN, + RGB_BLUE, + RGB_YELLOW + } + }, + { + PATTERN_DASHCYCLE, 3, { + RGB_RED, + RGB_GREEN, + RGB_BLUE + } } }; diff --git a/VortexEngine/src/Patterns/Multi/BouncePattern.cpp b/VortexEngine/src/Patterns/Multi/BouncePattern.cpp index a4afaa1f71..dbf4590bcf 100644 --- a/VortexEngine/src/Patterns/Multi/BouncePattern.cpp +++ b/VortexEngine/src/Patterns/Multi/BouncePattern.cpp @@ -6,7 +6,7 @@ #include "../../Log/Log.h" // safety to prevent divide by 0 -#define TOTAL_STEPS (((PAIR_COUNT * 2) - 2) ? ((PAIR_COUNT * 2) - 2) : 1) +#define TOTAL_STEPS (((LED_COUNT * 2) - 2) ? ((LED_COUNT * 2) - 2) : 1) #define HALF_STEPS (TOTAL_STEPS / 2) BouncePattern::BouncePattern(const PatternArgs &args) : @@ -36,10 +36,10 @@ void BouncePattern::init() void BouncePattern::blinkOn() { Leds::setAll(m_colorset.cur()); - if (m_progress < PAIR_COUNT) { - Leds::setPair((Pair)m_progress, m_colorset.peekNext()); + if (m_progress < LED_COUNT) { + Leds::setIndex((LedPos)m_progress, m_colorset.peekNext()); } else { - Leds::setPair((Pair)(TOTAL_STEPS - m_progress), m_colorset.peekNext()); + Leds::setIndex((LedPos)(TOTAL_STEPS - m_progress), m_colorset.peekNext()); } } diff --git a/VortexEngine/src/Patterns/Multi/FillPattern.cpp b/VortexEngine/src/Patterns/Multi/FillPattern.cpp index 87e034e4c1..50a88eefa3 100644 --- a/VortexEngine/src/Patterns/Multi/FillPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/FillPattern.cpp @@ -28,13 +28,13 @@ void FillPattern::init() void FillPattern::blinkOn() { - Leds::setPairs(PAIR_FIRST, (Pair)m_progress, m_colorset.peekNext()); - Leds::setPairs((Pair)m_progress, PAIR_COUNT, m_colorset.cur()); + Leds::setRange(LED_FIRST, (LedPos)m_progress, m_colorset.peekNext()); + Leds::setRange((LedPos)m_progress, LED_LAST, m_colorset.cur()); } void FillPattern::poststep() { - m_progress = (m_progress + 1) % PAIR_COUNT; + m_progress = (m_progress + 1) % LED_COUNT; if (m_progress == 0) { m_colorset.getNext(); } diff --git a/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp b/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp index d86a35810f..800e1173bb 100644 --- a/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/HueShiftPattern.cpp @@ -75,9 +75,17 @@ void HueShiftPattern::play() m_cur.hue += sign; } HSVColor showColor = HSVColor(m_cur.hue, 255, 255); - // set the target led with the current HSV color - for (LedPos pos = LED_FIRST; pos < LED_COUNT; ++pos) { - Leds::setIndex(pos, hsv_to_rgb_generic(showColor)); - showColor.hue = (showColor.hue + 5) % 256; + + // variable amount to shift, more LEDs should have smaller shifts + uint8_t shiftAmount = 108 / LED_COUNT; + // if you increment color with each led index there's a sharp contrast between the first and last led + // instead this creates a perfectly looped gradient between the first and last led which is better + for (LedPos pos = LED_FIRST; pos < (LED_COUNT / 2) + 1; ++pos) { + if (((LED_COUNT / 2) + pos) != LED_COUNT) { + // set the target led with the current HSV color + Leds::setIndex((LedPos)((LED_COUNT / 2) + pos), hsv_to_rgb_generic(showColor)); + } + Leds::setIndex((LedPos)((LED_COUNT / 2) - pos), hsv_to_rgb_generic(showColor)); + showColor.hue = (showColor.hue + shiftAmount) % 256; } } diff --git a/VortexEngine/src/Patterns/Multi/PulsishPattern.cpp b/VortexEngine/src/Patterns/Multi/PulsishPattern.cpp index 9c9e9b49b9..93c5fc6da6 100644 --- a/VortexEngine/src/Patterns/Multi/PulsishPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/PulsishPattern.cpp @@ -55,16 +55,16 @@ void PulsishPattern::play() { // when the step timer triggers if (m_stepTimer.alarm() == 0) { - m_progress = (m_progress + 1) % PAIR_COUNT; + m_progress = (m_progress + 1) % LED_COUNT; } switch (m_blinkTimer.alarm()) { case -1: // just return return; case 0: // turn on the leds - for (Pair pair = PAIR_FIRST; pair < PAIR_COUNT; ++pair) { - if (pair != m_progress) { - Leds::setPair(pair, m_colorset.cur()); + for (LedPos pos = LED_FIRST; pos < LED_COUNT; ++pos) { + if (pos != m_progress) { + Leds::setIndex(pos, m_colorset.cur()); } } m_colorset.skip(); @@ -73,9 +73,9 @@ void PulsishPattern::play() } break; case 1: - for (Pair pair = PAIR_FIRST; pair < PAIR_COUNT; ++pair) { - if (pair != m_progress) { - Leds::clearPair(pair); + for (LedPos pos = LED_FIRST; pos < LED_COUNT; ++pos) { + if (pos != m_progress) { + Leds::clearIndex(pos); } } break; @@ -85,10 +85,10 @@ void PulsishPattern::play() case -1: // just return return; case 0: // turn on the leds - Leds::setPair((Pair)m_progress, m_colorset.get(0)); + Leds::setIndex((LedPos)m_progress, m_colorset.get(0)); break; case 1: - Leds::clearPair((Pair)m_progress); + Leds::clearIndex((LedPos)m_progress); break; } } diff --git a/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp b/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp index 2868c09e97..45fec63ead 100644 --- a/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/Sequencer/ChaserPattern.cpp @@ -1,7 +1,7 @@ #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 +#define CHASER_RATIO 5 // This pattern aims to be a demonstration of the sequencer. diff --git a/VortexEngine/src/Patterns/Multi/SnowballPattern.cpp b/VortexEngine/src/Patterns/Multi/SnowballPattern.cpp index 32d7121c17..92667b4ca2 100644 --- a/VortexEngine/src/Patterns/Multi/SnowballPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/SnowballPattern.cpp @@ -2,7 +2,7 @@ #include "../../Leds/Leds.h" -#define WORM_SIZE 6 +#define WORM_SIZE LED_COUNT / 3 SnowballPattern::SnowballPattern(const PatternArgs &args) : BlinkStepPattern(args), diff --git a/VortexEngine/src/Patterns/Multi/SparkleTracePattern.cpp b/VortexEngine/src/Patterns/Multi/SparkleTracePattern.cpp index 2221850d58..e5efe62cf4 100644 --- a/VortexEngine/src/Patterns/Multi/SparkleTracePattern.cpp +++ b/VortexEngine/src/Patterns/Multi/SparkleTracePattern.cpp @@ -21,10 +21,17 @@ void SparkleTracePattern::blinkOn() Leds::setAll(m_colorset.get(0)); } +void SparkleTracePattern::blinkOff() +{ + //this empty overriden function must be here to prevent the base + //blinkOff function from causing the ribbon in the blinkOn function + //to strobe instead +} + void SparkleTracePattern::poststep() { - for (uint8_t dot = 0; dot < 4; ++dot) { - Leds::setPair((Pair)m_randCtx.next8(PAIR_FIRST, PAIR_LAST), m_colorset.cur()); + for (uint8_t dot = 0; dot < LED_COUNT / 6; ++dot) { + Leds::setIndex((LedPos)m_randCtx.next8(LED_FIRST, LED_LAST), m_colorset.cur()); } m_colorset.skip(); if (m_colorset.curIndex() == 0) { diff --git a/VortexEngine/src/Patterns/Multi/SparkleTracePattern.h b/VortexEngine/src/Patterns/Multi/SparkleTracePattern.h index ef03a71827..13f8804021 100644 --- a/VortexEngine/src/Patterns/Multi/SparkleTracePattern.h +++ b/VortexEngine/src/Patterns/Multi/SparkleTracePattern.h @@ -13,6 +13,7 @@ class SparkleTracePattern : public BlinkStepPattern protected: virtual void blinkOn() override; + virtual void blinkOff() override; virtual void poststep() override; Random m_randCtx; diff --git a/VortexEngine/src/Patterns/Multi/TheaterChasePattern.cpp b/VortexEngine/src/Patterns/Multi/TheaterChasePattern.cpp index fbd527c7db..08f9cd8437 100644 --- a/VortexEngine/src/Patterns/Multi/TheaterChasePattern.cpp +++ b/VortexEngine/src/Patterns/Multi/TheaterChasePattern.cpp @@ -2,7 +2,7 @@ #include "../../Leds/Leds.h" -#define THEATER_CHASE_STEPS 10 +#define THEATER_CHASE_STEPS (LED_COUNT / 4) TheaterChasePattern::TheaterChasePattern(const PatternArgs &args) : BlinkStepPattern(args), @@ -21,7 +21,7 @@ void TheaterChasePattern::init() { BlinkStepPattern::init(); // starts on odd evens - m_ledPositions = MAP_PAIR_ODD_EVENS; + m_ledPositions = MAP_OPPOSITES_1; m_stepCounter = 0; } @@ -32,12 +32,20 @@ void TheaterChasePattern::blinkOn() void TheaterChasePattern::poststep() { - // the first 5 steps are odd evens/odds alternating each step - if (m_stepCounter < 5) { - m_ledPositions = (m_stepCounter % 2) ? MAP_PAIR_ODD_ODDS : MAP_PAIR_ODD_EVENS; - } else { - // the end 5 steps are even evens/odds alternating each step - m_ledPositions = (m_stepCounter % 2) ? MAP_PAIR_EVEN_ODDS : MAP_PAIR_EVEN_EVENS; + if (m_stepCounter == 0) { + m_ledPositions = MAP_OPPOSITES_1; + } + if (m_stepCounter == 1) { + m_ledPositions = MAP_OPPOSITES_2; + } + if (m_stepCounter == 2) { + m_ledPositions = MAP_OPPOSITES_3; + } + if (m_stepCounter == 3) { + m_ledPositions = MAP_OPPOSITES_4; + } + if (m_stepCounter == 4) { + m_ledPositions = MAP_OPPOSITES_5; } // increment step counter m_stepCounter = (m_stepCounter + 1) % THEATER_CHASE_STEPS; diff --git a/VortexEngine/src/Patterns/Multi/VortexPattern.cpp b/VortexEngine/src/Patterns/Multi/VortexPattern.cpp index b879687b11..52be6c91ab 100644 --- a/VortexEngine/src/Patterns/Multi/VortexPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/VortexPattern.cpp @@ -33,8 +33,9 @@ void VortexPattern::init() void VortexPattern::blinkOn() { // Sets an LED at opposite ends of the strip and progresses towards the center - Leds::setIndex((LedPos)m_progress, m_colorset.peekNext()); - Leds::setIndex((LedPos)(LED_LAST - m_progress), m_colorset.peekNext()); + Leds::setIndex((LedPos)(m_progress), m_colorset.peekNext()); + int offset = (m_progress != 0) ? m_progress : 10; + Leds::setIndex((LedPos)(LED_COUNT - (offset)), m_colorset.peekNext()); } void VortexPattern::poststep() diff --git a/VortexEngine/src/Patterns/Multi/VortexWipePattern.cpp b/VortexEngine/src/Patterns/Multi/VortexWipePattern.cpp index 1a2b19b185..595f0587d3 100644 --- a/VortexEngine/src/Patterns/Multi/VortexWipePattern.cpp +++ b/VortexEngine/src/Patterns/Multi/VortexWipePattern.cpp @@ -5,19 +5,7 @@ #include "../../Leds/Leds.h" #include "../../Log/Log.h" -const LedPos VortexWipePattern::ledStepPositions[] = { - LED_9, - LED_7, - LED_5, - LED_3, - LED_1, - - LED_0, - LED_2, - LED_4, - LED_6, - LED_8 -}; +#define VORTEX_WIPE_STEPS (LED_COUNT/2) VortexWipePattern::VortexWipePattern(const PatternArgs &args) : BlinkStepPattern(args), @@ -43,17 +31,15 @@ void VortexWipePattern::init() void VortexWipePattern::blinkOn() { - for (int index = 0; index < m_progress; ++index) { - Leds::setIndex(ledStepPositions[index], m_colorset.peekNext()); - } - for (int index = m_progress; index < LED_COUNT; ++index) { - Leds::setIndex(ledStepPositions[index], m_colorset.cur()); - } + Leds::setRange(LED_FIRST, (LedPos)m_progress, m_colorset.peekNext()); + Leds::setRange((LedPos)(LED_COUNT/2), (LedPos)((LED_COUNT/2) + m_progress), m_colorset.peekNext()); + Leds::setRange((LedPos)m_progress, (LedPos)((LED_COUNT/2) - 1), m_colorset.cur()); + Leds::setRange((LedPos)((LED_COUNT / 2) + m_progress), (LedPos)(LED_COUNT - 1), m_colorset.cur()); } void VortexWipePattern::poststep() { - m_progress = (m_progress + 1) % LED_COUNT; + m_progress = (m_progress + 1) % VORTEX_WIPE_STEPS; if (m_progress == 0) { m_colorset.getNext(); } diff --git a/VortexEngine/src/Patterns/Multi/VortexWipePattern.h b/VortexEngine/src/Patterns/Multi/VortexWipePattern.h index 17030f3f6d..4795802380 100644 --- a/VortexEngine/src/Patterns/Multi/VortexWipePattern.h +++ b/VortexEngine/src/Patterns/Multi/VortexWipePattern.h @@ -19,9 +19,6 @@ class VortexWipePattern : public BlinkStepPattern virtual void poststep() override; private: - // path for leds to take, index this with m_step up to LED_COUNT steps - static const LedPos ledStepPositions[]; - // how much the fill has progressed uint8_t m_progress; }; diff --git a/VortexEngine/src/Patterns/Multi/WarpPattern.cpp b/VortexEngine/src/Patterns/Multi/WarpPattern.cpp index 24770e4328..318250b313 100644 --- a/VortexEngine/src/Patterns/Multi/WarpPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/WarpPattern.cpp @@ -30,12 +30,12 @@ void WarpPattern::init() void WarpPattern::blinkOn() { Leds::setAll(m_colorset.cur()); - Leds::setPair((Pair)m_progress, m_colorset.peekNext()); + Leds::setIndex((LedPos)m_progress, m_colorset.peekNext()); } void WarpPattern::poststep() { - m_progress = (m_progress + 1) % PAIR_COUNT; + m_progress = (m_progress + 1) % LED_COUNT; if (m_progress == 0) { m_colorset.getNext(); } diff --git a/VortexEngine/src/Patterns/Multi/WarpWormPattern.cpp b/VortexEngine/src/Patterns/Multi/WarpWormPattern.cpp index b6311ad339..d50190ddd8 100644 --- a/VortexEngine/src/Patterns/Multi/WarpWormPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/WarpWormPattern.cpp @@ -29,7 +29,7 @@ void WarpWormPattern::init() void WarpWormPattern::blinkOn() { - int wormSize = 6; + int wormSize = LED_COUNT / 3; Leds::setAll(m_colorset.get(0)); for (int body = 0; body < wormSize; ++body) { if (body + m_progress < LED_COUNT) { diff --git a/VortexEngine/src/Patterns/Multi/ZigzagPattern.cpp b/VortexEngine/src/Patterns/Multi/ZigzagPattern.cpp index 02062917eb..fdcbaa8b27 100644 --- a/VortexEngine/src/Patterns/Multi/ZigzagPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/ZigzagPattern.cpp @@ -13,7 +13,17 @@ const LedPos ZigzagPattern::ledStepPositions[] = { LED_5, LED_7, LED_9, - + LED_11, + LED_13, + LED_15, + LED_17, + LED_19, + + LED_18, + LED_16, + LED_14, + LED_12, + LED_10, LED_8, LED_6, LED_4,