Skip to content

Commit 1d5bb5f

Browse files
authored
Bypass led select and foreach macro fix (#292)
1 parent 2b8e6da commit 1d5bb5f

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

VortexEngine/src/Leds/LedTypes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ typedef uint64_t LedMap;
106106
#define MAP_IS_ONE_LED(map) (map && !(map & (map-1)))
107107

108108
// foreach led macro (only iterates singles)
109-
#define MAP_FOREACH_LED(map) for (LedPos pos = ledmapGetFirstLed(map); pos < LED_COUNT; pos = ledmapGetNextLed(map, pos))
109+
#define MAP_FOREACH_LED(map) for (LedPos pos = ledmapGetFirstLed(map); pos != LED_COUNT; pos = ledmapGetNextLed(map, pos))
110110

111111
// convert a map to the first Led position in the map
112112
inline LedPos ledmapGetFirstLed(LedMap map)

VortexEngine/src/Menus/Menu.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,13 @@ void Menu::nextBulbSelection()
157157
}
158158
}
159159

160+
void Menu::bypassLedSelection(LedMap map)
161+
{
162+
m_ledSelected = true;
163+
m_targetLeds = map;
164+
onLedSelected();
165+
}
166+
160167
void Menu::onLedSelected()
161168
{
162169
}

VortexEngine/src/Menus/Menu.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class Menu
4444
// iterate to next bulb selection
4545
void nextBulbSelection();
4646

47+
// skip led selection
48+
void bypassLedSelection(LedMap map);
4749
// an overridable api that allows derived menus to decide which led selections
4850
// should be available before they have actually opened
4951
virtual bool isValidLedSelection(LedMap selection) const { return true; }

VortexEngine/src/Menus/MenuList/ColorSelect.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ bool ColorSelect::init()
4545
return false;
4646
}
4747
if (cur->isMultiLed()) {
48-
m_targetLeds = MAP_LED(LED_MULTI);
49-
m_ledSelected = true;
48+
bypassLedSelection(MAP_LED(LED_MULTI));
5049
}
5150
m_state = STATE_INIT;
5251
DEBUG_LOG("Entered color select");

VortexEngine/src/Menus/MenuList/Randomizer.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,14 @@ bool Randomizer::reRoll()
147147
if (!reRollMulti()) {
148148
return false;
149149
}
150+
} else if (!reRollSingles()) {
151+
return false;
150152
}
151-
#endif
153+
#else
152154
if (!reRollSingles()) {
153155
return false;
154156
}
157+
#endif
155158
// initialize the mode with the new pattern and colorset
156159
m_previewMode.init();
157160
return true;

0 commit comments

Comments
 (0)