Skip to content

Commit

Permalink
fixed orbit after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Nov 27, 2024
1 parent d16e9cf commit 07a8d40
Showing 1 changed file with 51 additions and 11 deletions.
62 changes: 51 additions & 11 deletions VortexEngine/src/Menus/MenuList/PatternSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void PatternSelect::nextPattern()
DEBUG_LOGF("Iterated to pattern id %d", m_newPatternID);
}

void PatternSelect::previousPatternID()
void PatternSelect::previousPatternID()
{
// increment to next pattern
PatternID endList = PATTERN_SINGLE_LAST;
Expand All @@ -186,7 +186,7 @@ void PatternSelect::previousPatternID()
}
}

void PatternSelect::previousPattern()
void PatternSelect::previousPattern()
{
if (m_started) {
previousPatternID();
Expand All @@ -212,13 +212,53 @@ void PatternSelect::previousPattern()
void PatternSelect::onLongClick()
{
bool needsSave = false;
Mode *cur = Modes::curMode();
needsSave = !cur->equals(&m_previewMode);
if (needsSave) {
// update the current mode with the new pattern
Modes::updateCurMode(&m_previewMode);
}
DEBUG_LOGF("Saving pattern %u", m_newPatternID);
// done in the pattern select menu
leaveMenu(needsSave);
switch (m_state) {
case STATE_PICK_LIST:
if (m_curSelection == QUADRANT_5) {
leaveMenu();
return;
}
// if targeted multi then start at multis and only iterate multis
if ((m_targetLeds == MAP_LED(LED_MULTI))) {
// the selected multi only iterate multis
m_newPatternID = (PatternID)(PATTERN_MULTI_FIRST + (m_curSelection * (PATTERN_MULTI_COUNT / 4)));
} else if ((m_targetLeds != MAP_LED_ALL)) {
// they selected some singles, only iterate single led patterns
m_newPatternID = (PatternID)(PATTERN_SINGLE_FIRST + (m_curSelection * (PATTERN_SINGLE_COUNT / 4)));
} else {
// otherwise they selected all divide the entire list
m_newPatternID = (PatternID)(PATTERN_FIRST + (m_curSelection * (PATTERN_COUNT / 4)));
}
m_state = STATE_PICK_PATTERN;
break;
case STATE_PICK_PATTERN:
// need to save the new pattern if it's different from current
needsSave = !Modes::curMode()->equals(&m_previewMode);
if (needsSave) {
// update the current mode with the new pattern
Modes::updateCurMode(&m_previewMode);
}
DEBUG_LOGF("Saving pattern %u", m_newPatternID);
// go back to beginning for next time
m_state = STATE_PICK_LIST;
// done in the pattern select menu
leaveMenu(needsSave);
break;
}
// reset selection after choosing anything
m_curSelection = QUADRANT_FIRST;
}

void PatternSelect::onLongClick2()
{
leaveMenu(false);
}

void PatternSelect::showExit()
{
// don't show the exit when picking pattern
if (m_state == STATE_PICK_PATTERN) {
return;
}
Menu::showExit();
}

0 comments on commit 07a8d40

Please sign in to comment.