Skip to content

Commit

Permalink
previous pattern for pattern select (not finished)
Browse files Browse the repository at this point in the history
  • Loading branch information
LivingSynthesis committed Nov 17, 2023
1 parent 7bc8396 commit b089475
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions VortexEngine/src/Menus/MenuList/PatternSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,33 +148,35 @@ void PatternSelect::nextPattern()

void PatternSelect::previousPattern()
{
Mode *cur = Modes::curMode();
LedPos srcLed = LED_MULTI;
if (!cur->isMultiLed()) {
if (!m_previewMode.isMultiLed()) {
srcLed = mapGetFirstLed(m_targetLeds);
}
PatternID newID = (PatternID)(cur->getPatternID(srcLed) - 1);
if (newID == PATTERN_SOLID) {
newID = (PatternID)(newID - 1);
}
PatternID newID = (PatternID)(m_previewMode.getPatternID(srcLed) - 1);
PatternID endList = PATTERN_SINGLE_LAST;
PatternID beginList = PATTERN_SINGLE_FIRST;
#if VORTEX_SLIM == 0
if (m_targetLeds == MAP_LED_ALL || m_targetLeds == MAP_LED(LED_MULTI)) {
endList = PATTERN_MULTI_LAST;
}
if (m_targetLeds == MAP_LED(LED_MULTI)) {
beginList = PATTERN_MULTI_FIRST;
}
#endif
if (newID > endList || newID < beginList) {
newID = endList;
}
if (!m_started) {
m_started = true;
m_newPatternID = PATTERN_FIRST;
}
// set the new pattern id
if (isMultiLedPatternID(newID)) {
cur->setPattern(newID);
m_previewMode.setPattern(newID);
} else {
cur->setPatternMap(m_targetLeds, newID);
m_previewMode.setPatternMap(m_targetLeds, newID);
}
cur->init();
m_previewMode.init();
DEBUG_LOGF("Iterated to pattern id %d", newID);
}

Expand Down

0 comments on commit b089475

Please sign in to comment.