diff --git a/VortexEngine/src/Leds/LedTypes.h b/VortexEngine/src/Leds/LedTypes.h index 2be91ef5d4..6d2b03d229 100644 --- a/VortexEngine/src/Leds/LedTypes.h +++ b/VortexEngine/src/Leds/LedTypes.h @@ -84,15 +84,15 @@ static_assert(LED_COUNT == (PAIR_COUNT * 2), "Incorrect number of Pairs for Leds #define PAIR_4 PAIR_1 // check if an led is even or odd -#define isEven(pos) (pos < 3) -#define isOdd(pos) (pos >= 3) +#define isEven(pos) ((pos % 2) == 0) +#define isOdd(pos) ((pos % 2) != 0) // convert a pair to even or odd led position -#define pairEven(pair) (LedPos)((uint32_t)pair) -#define pairOdd(pair) (LedPos)(((uint32_t)pair) + 3) +#define pairEven(pair) (LedPos)((uint32_t)pair * 2) +#define pairOdd(pair) (LedPos)(((uint32_t)pair * 2) + 1) // convert an led position to a pair -#define ledToPair(pos) (Pair)((uint32_t)pos >= 3 ? 1 : 0) +#define ledToPair(pos) (Pair)((uint32_t)pos / 2) // LedMap is a bitmap of leds, used for expressing whether to turn certain leds on // or off with a single integer diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp index 34170b2eab..9f4e1582af 100644 --- a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp +++ b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp @@ -15,8 +15,8 @@ PatternSelect::PatternSelect(const RGBColor &col, bool advanced) : Menu(col, advanced), + m_newPatternID(PATTERN_FIRST), m_srcLed(LED_FIRST), - m_argIndex(0), m_started(false) { } @@ -43,7 +43,7 @@ Menu::MenuAction PatternSelect::run() // run the current mode m_previewMode.play(); // show dimmer selections in advanced mode - Menus::showSelection(m_advanced ? RGB_GREEN0 : RGB_WHITE5); + Menus::showSelection(RGB_WHITE5); return MENU_CONTINUE; } @@ -54,48 +54,8 @@ void PatternSelect::onLedSelected() void PatternSelect::onShortClick() { - if (m_advanced) { - // double click = skip 10 - bool doSkip = g_pButton->onConsecutivePresses(2); - MAP_FOREACH_LED(m_targetLeds) { - Pattern *pat = m_previewMode.getPattern(pos); - if (pat->getNumArgs() <= m_argIndex) { - continue; - } - uint8_t &arg = pat->argRef(m_argIndex); - if (doSkip) { - arg += 10 - (arg % 10); - } else { - arg++; - } - // on/off/gap/dash duration max 100 - uint8_t max = 100; - if (m_argIndex == 6) { - // blend number of numflips - max = 4; - } else if (m_argIndex > 3) { - // group size, solid index, blendspeed - max = 20; - } - if (arg > max) { - // red flash indicates reaching end - Leds::holdAll(RGB_RED); - arg %= (max + 1); - } - // do not let argument0 be reset to 0 - if (!m_argIndex && !arg) { - arg = 1; - } - } - m_previewMode.init(); - if (doSkip) { - // hold white for a moment to show they are skipping 25 - Leds::holdAll(RGB_YELLOW1); - } - return; - } nextPattern(); - } +} void PatternSelect::nextPatternID() { @@ -141,19 +101,11 @@ void PatternSelect::nextPattern() DEBUG_LOGF("Iterated to pattern id %d", m_newPatternID); } - void PatternSelect::onLongClick() { bool needsSave = false; - if (m_advanced) { - m_argIndex++; - if (m_argIndex < m_previewMode.getPattern(m_srcLed)->getNumArgs()) { - // if we haven't reached number of args yet then just return and kee pgoing - return; - } - Leds::holdAll(m_menuColor); - } - needsSave = !Modes::curMode()->equals(&m_previewMode); + Mode *cur = Modes::curMode(); + needsSave = !cur || !cur->equals(&m_previewMode); if (needsSave) { // update the current mode with the new pattern Modes::updateCurMode(&m_previewMode); diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.h b/VortexEngine/src/Menus/MenuList/PatternSelect.h index d74e26739f..e967559467 100644 --- a/VortexEngine/src/Menus/MenuList/PatternSelect.h +++ b/VortexEngine/src/Menus/MenuList/PatternSelect.h @@ -32,9 +32,6 @@ class PatternSelect : public Menu // helpful member LedPos m_srcLed; - // used for adv pat select - uint8_t m_argIndex; - // the pat select starts by showing the current pattern // then the first click begin cycling the list of pats bool m_started; diff --git a/VortexEngine/tests/tests_general.tar.gz b/VortexEngine/tests/tests_general.tar.gz index e8128c74bf..8faf2c0dbc 100644 Binary files a/VortexEngine/tests/tests_general.tar.gz and b/VortexEngine/tests/tests_general.tar.gz differ