Skip to content

Commit

Permalink
Merge branch 'master' into handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Dec 6, 2023
2 parents 0f1b6e4 + 456f71e commit 648ca67
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions VortexEngine/src/Leds/LedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,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) {
Expand Down
1 change: 1 addition & 0 deletions VortexEngine/src/Menus/MenuList/ColorSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 14 additions & 3 deletions VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 2 additions & 0 deletions VortexEngine/src/Patterns/Multi/Sequencer/SequencedPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class SequencedPattern : public CompoundPattern
void bindSequence(const Sequence &sequence);

protected:
void playSequenceStep(const SequenceStep &step);

// static data
Sequence m_sequence;

Expand Down

0 comments on commit 648ca67

Please sign in to comment.