Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shane/spark/spark menu updates #264

Closed
wants to merge 11 commits into from
2 changes: 1 addition & 1 deletion VortexEngine/src/Buttons/Buttons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define BUTTON_PIN 47
#else
// orbit is on 7
#define BUTTON_PIN 7
#define BUTTON_PIN 5
#endif

// Since there is only one button I am just going to expose a global pointer to
Expand Down
5 changes: 5 additions & 0 deletions VortexEngine/src/Leds/LedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ inline LedPos ledmapGetNextLed(LedMap map, LedPos pos)
#define MAP_PAIR_EVEN_EVENS (MAP_PAIR_EVEN(PAIR_3) | MAP_PAIR_EVEN(PAIR_1))
#define MAP_PAIR_EVEN_ODDS (MAP_PAIR_ODD(PAIR_3) | MAP_PAIR_ODD(PAIR_1))

// bitmaps specific to Sparks
#define MAP_OPPOSITES_1 (MAP_LED(LED_0) | MAP_LED(LED_3))
#define MAP_OPPOSITES_2 (MAP_LED(LED_1) | MAP_LED(LED_4))
#define MAP_OPPOSITES_3 (MAP_LED(LED_2) | MAP_LED(LED_5))

// set a single led
inline void ledmapSetLed(LedMap &map, LedPos pos)
{
Expand Down
28 changes: 17 additions & 11 deletions VortexEngine/src/Leds/Leds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ RGBColor Leds::m_ledColors[LED_COUNT] = { RGB_OFF };
bool Leds::init()
{
#ifdef VORTEX_EMBEDDED
FastLED.addLeds<WS2812B, LED_PIN, GRB>((CRGB *)m_ledColors, LED_COUNT);
FastLED.addLeds<WS2812B, LED_PIN, RGB>((CRGB *)m_ledColors, LED_COUNT);
FastLED.setMaxRefreshRate(0);
pinMode(MOSFET_PIN, OUTPUT);
digitalWrite(MOSFET_PIN, HIGH);
#endif
#ifdef VORTEX_LIB
Vortex::vcallbacks()->ledsInit(m_ledColors, LED_COUNT);
Expand Down Expand Up @@ -91,8 +89,10 @@ void Leds::setRangeEvens(Pair first, Pair last, RGBColor col)

void Leds::setAllEvens(RGBColor col)
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
setIndex(pairEven(pos), col);
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isEven(pos)) {
setIndex(pos, col);
}
}
}

Expand All @@ -105,8 +105,10 @@ void Leds::setRangeOdds(Pair first, Pair last, RGBColor col)

void Leds::setAllOdds(RGBColor col)
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
setIndex(pairOdd(pos), col);
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isOdd(pos)) {
setIndex(pos, col);
}
}
}

Expand All @@ -119,8 +121,10 @@ void Leds::clearRangeEvens(Pair first, Pair last)

void Leds::clearAllEvens()
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
clearIndex(pairEven(pos));
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isEven(pos)) {
clearIndex(pos);
}
}
}

Expand All @@ -133,8 +137,10 @@ void Leds::clearRangeOdds(Pair first, Pair last)

void Leds::clearAllOdds()
{
for (Pair pos = PAIR_FIRST; pos <= PAIR_LAST; pos++) {
clearIndex(pairOdd(pos));
for (LedPos pos = LED_FIRST; pos <= LED_LAST; pos++) {
if (isOdd(pos)) {
clearIndex(pos);
}
}
}

Expand Down
17 changes: 13 additions & 4 deletions VortexEngine/src/Menus/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,27 @@ void Menu::nextBulbSelection()
// do not allow multi led to select anything else
//break;
}
m_targetLeds = MAP_LED(LED_FIRST);
m_targetLeds = MAP_LED(LED_MULTI);
break;
case MAP_LED(LED_LAST):
case MAP_LED(LED_MULTI):
m_targetLeds = MAP_PAIR_EVENS;
break;
case MAP_PAIR_EVENS:
m_targetLeds = MAP_PAIR_ODDS;
break;
case MAP_PAIR_ODDS:
m_targetLeds = MAP_LED(LED_MULTI);
m_targetLeds = MAP_OPPOSITES_1;
break;
case MAP_LED(LED_MULTI):
case MAP_OPPOSITES_1:
m_targetLeds = MAP_OPPOSITES_2;
break;
case MAP_OPPOSITES_2:
m_targetLeds = MAP_OPPOSITES_3;
break;
case MAP_OPPOSITES_3:
m_targetLeds = MAP_LED(LED_FIRST);
break;
case MAP_LED(LED_LAST):
m_targetLeds = MAP_LED_ALL;
break;
default: // LED_FIRST through LED_LAST
Expand Down
Loading
Loading