Skip to content

Commit

Permalink
start of col select menu work
Browse files Browse the repository at this point in the history
  • Loading branch information
Unreal-Dan committed Nov 18, 2024
1 parent da7fcdf commit 8745335
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 23 deletions.
15 changes: 15 additions & 0 deletions VortexEngine/src/Leds/LedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,21 @@ inline LedPos ledmapGetNextLed(LedMap map, LedPos pos)
#define MAP_LINE_4 (MAP_LED(LED_3) | MAP_LED(LED_13) | MAP_LED(LED_18) | MAP_LED(LED_8))
#define MAP_LINE_5 (MAP_LED(LED_4) | MAP_LED(LED_14) | MAP_LED(LED_19) | MAP_LED(LED_9))

// radial led maps around the chromadeck
#define MAP_RADIAL_OUTER(n) (MAP_LED(LED_0 + ((n) % LED_10)))
#define MAP_RADIAL_INNER(n) (MAP_LED(LED_10 + ((n) % LED_10)))
#define MAP_RADIAL(n) (MAP_RADIAL_INNER(n) | MAP_RADIAL_OUTER(n))
#define MAP_RADIAL_0 MAP_RADIAL(0)
#define MAP_RADIAL_1 MAP_RADIAL(1)
#define MAP_RADIAL_2 MAP_RADIAL(2)
#define MAP_RADIAL_3 MAP_RADIAL(3)
#define MAP_RADIAL_4 MAP_RADIAL(4)
#define MAP_RADIAL_5 MAP_RADIAL(5)
#define MAP_RADIAL_6 MAP_RADIAL(6)
#define MAP_RADIAL_7 MAP_RADIAL(7)
#define MAP_RADIAL_8 MAP_RADIAL(8)
#define MAP_RADIAL_9 MAP_RADIAL(9)

// set a single led
inline void ledmapSetLed(LedMap &map, LedPos pos)
{
Expand Down
67 changes: 44 additions & 23 deletions VortexEngine/src/Menus/MenuList/ColorSelect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,31 +180,52 @@ void ColorSelect::onLongClickM()

void ColorSelect::showSlotSelection()
{
uint8_t exitIndex = m_colorset.numColors();
uint32_t holdDur = g_pButtonM->holdDuration();
bool withinNumColors = m_curSelection < exitIndex;
bool holdDurationCheck = g_pButtonM->isPressed() && holdDur >= DELETE_THRESHOLD_TICKS;
bool holdDurationModCheck = (holdDur % (DELETE_CYCLE_TICKS * 2)) > DELETE_CYCLE_TICKS;
const RGBColor &col = m_colorset[m_curSelection];
if (withinNumColors && holdDurationCheck && holdDurationModCheck) {
// breath red for delete slot
Leds::breatheIndex(LED_ALL, 0, holdDur);
} else if (withinNumColors) {
if (col.empty()) {
Leds::setAll(RGB_WHITE0);
}
// blink the selected slot color
Leds::blinkAll(150, 650, col);
} else if (exitIndex < MAX_COLOR_SLOTS) {
if (m_curSelection == exitIndex) {
// blink both leds and blink faster to indicate 'add' new color
Leds::blinkAll(100, 150, RGB_WHITE2);
// Render the colors on radial indices 0-7
for (uint8_t i = 0; i < 8; ++i) {
RGBColor col;
if (m_colorset.numColors() <= i) {
Leds::setMap(MAP_RADIAL_INNER(i), RGB_WHITE0);
//Leds::blinkMap(MAP_RADIAL(i + 8));
} else {
Leds::setMap(MAP_RADIAL_OUTER(i), m_colorset.get(i));
Leds::setMap(MAP_RADIAL_INNER(i), RGB_WHITE2);
}
exitIndex++;
}
if (m_curSelection == exitIndex) {
showFullSet(50, 100);
}

// Radial index 8: Exit
Leds::setMap(MAP_RADIAL_INNER(8), RGB_WHITE1);
Leds::setMap(MAP_RADIAL_OUTER(8), RGB_RED3);

//Leds::setMap(MAP_RADIAL_INNER(7), HSVColor(Time::getCurtime() / 10, 255, 255));
//Leds::setMap(MAP_RADIAL_OUTER(7), RGB_WHITE4);
//Leds::blinkMap(MAP_RADIAL(6));


//uint8_t exitIndex = m_colorset.numColors();
//uint32_t holdDur = g_pButtonM->holdDuration();
//bool withinNumColors = m_curSelection < exitIndex;
//bool holdDurationCheck = g_pButtonM->isPressed() && holdDur >= DELETE_THRESHOLD_TICKS;
//bool holdDurationModCheck = (holdDur % (DELETE_CYCLE_TICKS * 2)) > DELETE_CYCLE_TICKS;
//const RGBColor &col = m_colorset[m_curSelection];
//if (withinNumColors && holdDurationCheck && holdDurationModCheck) {
// // breath red for delete slot
// Leds::breatheIndex(LED_ALL, 0, holdDur);
//} else if (withinNumColors) {
// if (col.empty()) {
// Leds::setAll(RGB_WHITE0);
// }
// // blink the selected slot color
// Leds::blinkAll(150, 650, col);
//} else if (exitIndex < MAX_COLOR_SLOTS) {
// if (m_curSelection == exitIndex) {
// // blink both leds and blink faster to indicate 'add' new color
// Leds::blinkAll(100, 150, RGB_WHITE2);
// }
// exitIndex++;
//}
//if (m_curSelection == exitIndex) {
// showFullSet(50, 100);
//}
}

void ColorSelect::showSelection(ColorSelectState mode)
Expand Down
4 changes: 4 additions & 0 deletions VortexEngine/src/VortexEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ bool VortexEngine::init()
return false;
}

MainMenu::select();
Menus::openMenu(MENU_COLOR_SELECT);
Vortex::longClick(1);

#if COMPRESSION_TEST == 1
compressionTest();
#endif
Expand Down

0 comments on commit 8745335

Please sign in to comment.