diff --git a/VortexEngine/src/Leds/Leds.cpp b/VortexEngine/src/Leds/Leds.cpp index f9f5a7f5e8..38851915d6 100644 --- a/VortexEngine/src/Leds/Leds.cpp +++ b/VortexEngine/src/Leds/Leds.cpp @@ -271,8 +271,7 @@ void Leds::holdAll(RGBColor col) void Leds::update() { #ifdef VORTEX_EMBEDDED - // TODO: fixme - FastLED.show(5); + FastLED.show(m_brightness); #endif #ifdef VORTEX_LIB Vortex::vcallbacks()->ledsShow(); diff --git a/VortexEngine/src/Menus/Menu.cpp b/VortexEngine/src/Menus/Menu.cpp index 822134e9ab..c82b6f1a40 100644 --- a/VortexEngine/src/Menus/Menu.cpp +++ b/VortexEngine/src/Menus/Menu.cpp @@ -182,15 +182,32 @@ void Menu::onLedSelected() { } -void Menu::onShortClick() +void Menu::onShortClickL() { } -void Menu::onLongClick() +void Menu::onShortClickM() +{ +} + +void Menu::onShortClickR() +{ +} + +void Menu::onLongClickL() { leaveMenu(false); } +void Menu::onLongClickM() +{ + leaveMenu(false); +} + +void Menu::onLongClickR() +{ +} + void Menu::leaveMenu(bool doSave) { m_shouldClose = true; diff --git a/VortexEngine/src/Menus/Menu.h b/VortexEngine/src/Menus/Menu.h index 986b924836..34bb7715ef 100644 --- a/VortexEngine/src/Menus/Menu.h +++ b/VortexEngine/src/Menus/Menu.h @@ -31,8 +31,12 @@ class Menu virtual void onLedSelected(); // optional handlers for clicks - virtual void onShortClick(); - virtual void onLongClick(); + virtual void onShortClickL(); + virtual void onShortClickM(); + virtual void onShortClickR(); + virtual void onLongClickL(); + virtual void onLongClickM(); + virtual void onLongClickR(); // close the current menu virtual void leaveMenu(bool doSave = false); diff --git a/VortexEngine/src/Menus/MenuList/ColorSelect.cpp b/VortexEngine/src/Menus/MenuList/ColorSelect.cpp index b281251bb7..e1ce189e96 100644 --- a/VortexEngine/src/Menus/MenuList/ColorSelect.cpp +++ b/VortexEngine/src/Menus/MenuList/ColorSelect.cpp @@ -98,7 +98,7 @@ void ColorSelect::onLedSelected() } } -void ColorSelect::onShortClick() +void ColorSelect::onShortClickM() { // increment selection m_curSelection++; @@ -109,7 +109,7 @@ void ColorSelect::onShortClick() } } -void ColorSelect::onLongClick() +void ColorSelect::onLongClickM() { // if we're on 'exit' and we're on any menu past the slot selection if (m_curSelection == 4 && m_state > STATE_PICK_SLOT) { diff --git a/VortexEngine/src/Menus/MenuList/ColorSelect.h b/VortexEngine/src/Menus/MenuList/ColorSelect.h index 6bda0fd1c3..c28cd89de8 100644 --- a/VortexEngine/src/Menus/MenuList/ColorSelect.h +++ b/VortexEngine/src/Menus/MenuList/ColorSelect.h @@ -18,8 +18,8 @@ class ColorSelect : public Menu void onLedSelected() override; // handlers for clicks - void onShortClick() override; - void onLongClick() override; + void onShortClickM() override; + void onLongClickM() override; private: // override the led selection api to choose which led maps can be selected diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp index 8cc7b2ccdc..17e209f8cd 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp @@ -437,7 +437,7 @@ bool EditorConnection::pushModeChromalink() return true; } -void EditorConnection::onShortClick() +void EditorConnection::onShortClickM() { // if the device has received any commands do not reset! if (!m_allowReset) { @@ -451,7 +451,7 @@ void EditorConnection::onShortClick() m_allowReset = false; } -void EditorConnection::onLongClick() +void EditorConnection::onLongClickM() { leaveMenu(true); } diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.h b/VortexEngine/src/Menus/MenuList/EditorConnection.h index 943dc7b08b..ca9307c5fa 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.h +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.h @@ -26,8 +26,8 @@ class EditorConnection : public Menu bool pushModeChromalink(); // handlers for clicks - void onShortClick() override; - void onLongClick() override; + void onShortClickM() override; + void onLongClickM() override; // menu conn void leaveMenu(bool doSave = false) override; diff --git a/VortexEngine/src/Menus/MenuList/FactoryReset.cpp b/VortexEngine/src/Menus/MenuList/FactoryReset.cpp index afe8f1f508..6da188033d 100644 --- a/VortexEngine/src/Menus/MenuList/FactoryReset.cpp +++ b/VortexEngine/src/Menus/MenuList/FactoryReset.cpp @@ -57,12 +57,12 @@ Menu::MenuAction FactoryReset::run() return MENU_CONTINUE; } -void FactoryReset::onShortClick() +void FactoryReset::onShortClickM() { m_curSelection = (uint8_t)!m_curSelection; } -void FactoryReset::onLongClick() +void FactoryReset::onLongClickM() { if (m_curSelection == 0) { // if the selection isn't actually on factory reset then just leave diff --git a/VortexEngine/src/Menus/MenuList/FactoryReset.h b/VortexEngine/src/Menus/MenuList/FactoryReset.h index e1fd64414e..5d1a0864a8 100644 --- a/VortexEngine/src/Menus/MenuList/FactoryReset.h +++ b/VortexEngine/src/Menus/MenuList/FactoryReset.h @@ -13,8 +13,8 @@ class FactoryReset : public Menu MenuAction run() override; // handlers for clicks - void onShortClick() override; - void onLongClick() override; + void onShortClickM() override; + void onLongClickM() override; private: void showReset(); diff --git a/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp b/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp index 8772f88b8c..633b32fcff 100644 --- a/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp +++ b/VortexEngine/src/Menus/MenuList/GlobalBrightness.cpp @@ -49,13 +49,13 @@ Menu::MenuAction GlobalBrightness::run() return MENU_CONTINUE; } -void GlobalBrightness::onShortClick() +void GlobalBrightness::onShortClickM() { // include one extra option for the exit slot m_curSelection = (m_curSelection + 1) % (NUM_BRIGHTNESS_OPTIONS + 1); } -void GlobalBrightness::onLongClick() +void GlobalBrightness::onLongClickM() { if (m_curSelection >= NUM_BRIGHTNESS_OPTIONS) { // no save exit diff --git a/VortexEngine/src/Menus/MenuList/GlobalBrightness.h b/VortexEngine/src/Menus/MenuList/GlobalBrightness.h index 34f2b65cfc..ce14160184 100644 --- a/VortexEngine/src/Menus/MenuList/GlobalBrightness.h +++ b/VortexEngine/src/Menus/MenuList/GlobalBrightness.h @@ -13,18 +13,22 @@ class GlobalBrightness : public Menu MenuAction run() override; // handlers for clicks - void onShortClick() override; - void onLongClick() override; + void onShortClickM() override; + void onLongClickM() override; private: void showBrightnessSelection(); // the list of brightness options - const uint8_t m_brightnessOptions[4] = { + const uint8_t m_brightnessOptions[8] = { BRIGHTNESS_OPTION_1, BRIGHTNESS_OPTION_2, BRIGHTNESS_OPTION_3, - BRIGHTNESS_OPTION_4 + BRIGHTNESS_OPTION_4, + BRIGHTNESS_OPTION_5, + BRIGHTNESS_OPTION_6, + BRIGHTNESS_OPTION_7, + BRIGHTNESS_OPTION_8, }; }; diff --git a/VortexEngine/src/Menus/MenuList/ModeSharing.cpp b/VortexEngine/src/Menus/MenuList/ModeSharing.cpp index 11ecd6d371..528cdf523c 100644 --- a/VortexEngine/src/Menus/MenuList/ModeSharing.cpp +++ b/VortexEngine/src/Menus/MenuList/ModeSharing.cpp @@ -63,7 +63,7 @@ Menu::MenuAction ModeSharing::run() } // handlers for clicks -void ModeSharing::onShortClick() +void ModeSharing::onShortClickM() { switch (m_sharingMode) { case ModeShareState::SHARE_RECEIVE: @@ -78,7 +78,24 @@ void ModeSharing::onShortClick() Leds::clearAll(); } -void ModeSharing::onLongClick() +// handlers for clicks +void ModeSharing::onShortClickR() +{ + switch (m_sharingMode) { + case ModeShareState::SHARE_RECEIVE: + // click while on receive -> end receive, start sending + VLReceiver::endReceiving(); + beginSendingVL(); + DEBUG_LOG("Switched to send mode"); + break; + default: + break; + } + Leds::clearAll(); +} + + +void ModeSharing::onLongClickM() { Modes::updateCurMode(&m_previewMode); leaveMenu(true); @@ -159,12 +176,13 @@ void ModeSharing::showReceiveMode() { if (VLReceiver::isReceiving()) { // using uint32_t to avoid overflow, the result should be within 10 to 255 - Leds::setAll(RGBColor(0, VLReceiver::percentReceived(), 0)); + Leds::clearAll(); + Leds::setRange(LED_FIRST, (LedPos)(VLReceiver::percentReceived() / 10), RGBColor(0, 1, 0)); } else { if (m_advanced) { m_previewMode.play(); } else { - Leds::setAll(RGB_WHITE0); + Leds::setAll(0x010101); } } } diff --git a/VortexEngine/src/Menus/MenuList/ModeSharing.h b/VortexEngine/src/Menus/MenuList/ModeSharing.h index 379914dcea..8a26fe4449 100644 --- a/VortexEngine/src/Menus/MenuList/ModeSharing.h +++ b/VortexEngine/src/Menus/MenuList/ModeSharing.h @@ -13,8 +13,9 @@ class ModeSharing : public Menu MenuAction run() override; // handlers for clicks - void onShortClick() override; - void onLongClick() override; + void onShortClickM() override; + void onShortClickR() override; + void onLongClickM() override; private: void beginSendingVL(); diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp index 6c5dac3861..3f27eef5a8 100644 --- a/VortexEngine/src/Menus/MenuList/PatternSelect.cpp +++ b/VortexEngine/src/Menus/MenuList/PatternSelect.cpp @@ -52,7 +52,7 @@ void PatternSelect::onLedSelected() m_srcLed = ledmapGetFirstLed(m_targetLeds); } -void PatternSelect::onShortClick() +void PatternSelect::onShortClickM() { if (m_advanced) { // double click = skip 10 @@ -120,7 +120,7 @@ void PatternSelect::onShortClick() DEBUG_LOGF("Iterated to pattern id %d", newID); } -void PatternSelect::onLongClick() +void PatternSelect::onLongClickM() { if (m_advanced) { m_argIndex++; diff --git a/VortexEngine/src/Menus/MenuList/PatternSelect.h b/VortexEngine/src/Menus/MenuList/PatternSelect.h index 317611a7fa..282ace2b70 100644 --- a/VortexEngine/src/Menus/MenuList/PatternSelect.h +++ b/VortexEngine/src/Menus/MenuList/PatternSelect.h @@ -19,8 +19,8 @@ class PatternSelect : public Menu void onLedSelected() override; // handlers for clicks - void onShortClick() override; - void onLongClick() override; + void onShortClickM() override; + void onLongClickM() override; private: // helpful member diff --git a/VortexEngine/src/Menus/MenuList/Randomizer.cpp b/VortexEngine/src/Menus/MenuList/Randomizer.cpp index 1a5ea58659..0f78118e6c 100644 --- a/VortexEngine/src/Menus/MenuList/Randomizer.cpp +++ b/VortexEngine/src/Menus/MenuList/Randomizer.cpp @@ -104,7 +104,7 @@ Menu::MenuAction Randomizer::run() return MENU_CONTINUE; } -void Randomizer::onShortClick() +void Randomizer::onShortClickM() { if (m_needToSelect) { if (m_flags == RANDOMIZE_BOTH) { @@ -126,7 +126,7 @@ void Randomizer::onShortClick() reRoll(); } -void Randomizer::onLongClick() +void Randomizer::onLongClickM() { // if done the randomization selection part if (m_needToSelect) { diff --git a/VortexEngine/src/Menus/MenuList/Randomizer.h b/VortexEngine/src/Menus/MenuList/Randomizer.h index 0575ab132f..b9612a2df4 100644 --- a/VortexEngine/src/Menus/MenuList/Randomizer.h +++ b/VortexEngine/src/Menus/MenuList/Randomizer.h @@ -18,8 +18,8 @@ class Randomizer : public Menu MenuAction run() override; // handlers for clicks - void onShortClick() override; - void onLongClick() override; + void onShortClickM() override; + void onLongClickM() override; // re-roll a new randomization with a given context on an led bool reRoll(); diff --git a/VortexEngine/src/Menus/Menus.cpp b/VortexEngine/src/Menus/Menus.cpp index 5a22a86a6c..99f2aee321 100644 --- a/VortexEngine/src/Menus/Menus.cpp +++ b/VortexEngine/src/Menus/Menus.cpp @@ -143,7 +143,7 @@ bool Menus::runMenuSelection() if (g_pButtonM->pressTime() >= m_openTime) { // whether to open advanced menus or not bool openAdv = (g_pButtonM->holdDuration() > ADV_MENU_DURATION_TICKS) && advMenus; - if (g_pButtonM->onShortClick()) { + if (g_pButtonM->onRelease()) { // ringmenu is open so select the menu DEBUG_LOGF("Selected ringmenu %s", menuList[m_selection].menuName); // open the menu we have selected @@ -201,11 +201,23 @@ bool Menus::runCurMenu() return false; case Menu::MENU_CONTINUE: // if Menu continue run the click handlers for the menu + if (g_pButtonL->onShortClick()) { + m_pCurMenu->onShortClickL(); + } + if (g_pButtonL->onLongClick()) { + m_pCurMenu->onLongClickL(); + } if (g_pButtonM->onShortClick()) { - m_pCurMenu->onShortClick(); + m_pCurMenu->onShortClickM(); } if (g_pButtonM->onLongClick()) { - m_pCurMenu->onLongClick(); + m_pCurMenu->onLongClickM(); + } + if (g_pButtonR->onShortClick()) { + m_pCurMenu->onShortClickR(); + } + if (g_pButtonR->onLongClick()) { + m_pCurMenu->onLongClickR(); } break; case Menu::MENU_SKIP: diff --git a/VortexEngine/src/VortexConfig.h b/VortexEngine/src/VortexConfig.h index d1e04a3d10..9c8949c1d2 100644 --- a/VortexEngine/src/VortexConfig.h +++ b/VortexEngine/src/VortexConfig.h @@ -288,10 +288,14 @@ // // These are the four options available in the global brightness menu // There is only four options, be careful not to go too low -#define BRIGHTNESS_OPTION_1 40 -#define BRIGHTNESS_OPTION_2 120 -#define BRIGHTNESS_OPTION_3 185 -#define BRIGHTNESS_OPTION_4 255 +#define BRIGHTNESS_OPTION_1 5 +#define BRIGHTNESS_OPTION_2 30 +#define BRIGHTNESS_OPTION_3 60 +#define BRIGHTNESS_OPTION_4 90 +#define BRIGHTNESS_OPTION_5 120 +#define BRIGHTNESS_OPTION_6 160 +#define BRIGHTNESS_OPTION_7 200 +#define BRIGHTNESS_OPTION_8 255 // Saturation Options //