diff --git a/VortexEngine/src/Leds/LedTypes.h b/VortexEngine/src/Leds/LedTypes.h index 117e726f0a..48b8cb7a86 100644 --- a/VortexEngine/src/Leds/LedTypes.h +++ b/VortexEngine/src/Leds/LedTypes.h @@ -108,6 +108,9 @@ typedef uint64_t LedMap; // convert a map to the first Led position in the map inline LedPos mapGetFirstLed(LedMap map) { + if (map == MAP_LED(LED_MULTI)) { + return LED_MULTI; + } LedPos pos = LED_FIRST; while (map && pos < LED_COUNT) { if (map & 1) { diff --git a/VortexEngine/src/Menus/MenuList/ColorSelect.cpp b/VortexEngine/src/Menus/MenuList/ColorSelect.cpp index ba8c76504c..c1caf53cab 100644 --- a/VortexEngine/src/Menus/MenuList/ColorSelect.cpp +++ b/VortexEngine/src/Menus/MenuList/ColorSelect.cpp @@ -45,6 +45,7 @@ bool ColorSelect::init() return false; } if (cur->isMultiLed()) { + m_targetLeds = MAP_LED(LED_MULTI); m_ledSelected = true; } m_state = STATE_INIT; diff --git a/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.cpp b/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.cpp index b4bd86f151..d65e64bc7f 100644 --- a/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.cpp +++ b/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.cpp @@ -47,16 +47,27 @@ void SequencedPattern::init() m_timer.start(); - // TODO: Play first sequence step in init? + // Play first sequence step in init, if there is one + if (m_sequence.numSteps() > 0) { + playSequenceStep(m_sequence[0]); + } } // pure virtual must the play function void SequencedPattern::play() { - if (m_timer.alarm() != -1 && !m_timer.onStart()) { + if (m_timer.alarm() != -1) { m_curSequence = (m_curSequence + 1) % m_sequence.numSteps(); } - const SequenceStep &step = m_sequence[m_curSequence]; + // only index the sequence if the current sequence index is valid + if (m_curSequence < m_sequence.numSteps()) { + // play the sequence step + playSequenceStep(m_sequence[m_curSequence]); + } +} + +void SequencedPattern::playSequenceStep(const SequenceStep &step) +{ for (LedPos pos = LED_FIRST; pos < LED_COUNT; ++pos) { // the current initialized pattern for this LED SingleLedPattern *curPat = m_ledPatterns[pos]; diff --git a/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.h b/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.h index a73d6130fe..d1f6786ce3 100644 --- a/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.h +++ b/VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.h @@ -32,6 +32,8 @@ class SequencedPattern : public CompoundPattern void bindSequence(const Sequence &sequence); protected: + void playSequenceStep(const SequenceStep &step); + // static data Sequence m_sequence;