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

start of col select menu work #262

Open
wants to merge 2 commits into
base: chromadeck
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading