diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp index 7bb9226959..5a1df51d27 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.cpp +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.cpp @@ -128,6 +128,7 @@ const EditorConnection::CommandState EditorConnection::commands[] = { { EDITOR_VERB_GET_GLOBAL_BRIGHTNESS, STATE_GET_GLOBAL_BRIGHTNESS }, { EDITOR_VERB_SET_CHROMA_BRIGHTNESS, STATE_SET_CHROMA_BRIGHTNESS }, { EDITOR_VERB_SWITCH_PROFILE, STATE_SWITCH_PROFILE }, + { EDITOR_VERB_GET_PROFILE, STATE_GET_PROFILE }, { EDITOR_VERB_PULL_CHROMA_HDR, STATE_PULL_HEADER_CHROMALINK }, { EDITOR_VERB_PUSH_CHROMA_HDR, STATE_PUSH_HEADER_CHROMALINK }, { EDITOR_VERB_PULL_CHROMA_MODE, STATE_PULL_MODE_CHROMALINK }, @@ -473,6 +474,13 @@ void EditorConnection::handleState() m_state = STATE_IDLE; break; + // ------------------------------- + // Get Current Profile + case STATE_GET_PROFILE: + sendProfile(); + m_state = STATE_IDLE; + break; + // ------------------------------- // Get Chromalinked Duo Header case STATE_PULL_HEADER_CHROMALINK: @@ -712,6 +720,17 @@ ReturnCode EditorConnection::sendBrightness() return RV_OK; } +ReturnCode EditorConnection::sendProfile() +{ + ByteStream profileBuf; + uint8_t profile = Storage::getStoragePage(); + if (!profileBuf.serialize8(profile)) { + return RV_FAIL; + } + writeData(profileBuf); + return RV_OK; +} + ReturnCode EditorConnection::receiveBuffer(ByteStream &buffer) { // need at least the buffer size first diff --git a/VortexEngine/src/Menus/MenuList/EditorConnection.h b/VortexEngine/src/Menus/MenuList/EditorConnection.h index 01ec6ddf6e..a2fdd2c78b 100644 --- a/VortexEngine/src/Menus/MenuList/EditorConnection.h +++ b/VortexEngine/src/Menus/MenuList/EditorConnection.h @@ -42,6 +42,7 @@ class EditorConnection : public Menu void sendCurModeVL(); void listenModeVL(); ReturnCode sendBrightness(); + ReturnCode sendProfile(); ReturnCode receiveBuffer(ByteStream &buffer); ReturnCode receiveModes(); ReturnCode receiveModeCount(); @@ -138,6 +139,9 @@ class EditorConnection : public Menu STATE_SWITCH_PROFILE_RECEIVE, STATE_SWITCH_PROFILE_DONE, + // get the current chromadeck profile + STATE_GET_PROFILE, + // pull the header from the chromalinked duo STATE_PULL_HEADER_CHROMALINK, diff --git a/VortexEngine/src/Storage/Storage.cpp b/VortexEngine/src/Storage/Storage.cpp index a41e5b491b..8f20ae27c8 100644 --- a/VortexEngine/src/Storage/Storage.cpp +++ b/VortexEngine/src/Storage/Storage.cpp @@ -58,6 +58,11 @@ void Storage::setStoragePage(uint8_t page) m_storagePage = page; } +uint8_t Storage::getStoragePage() +{ + return m_storagePage; +} + // store a serial buffer to storage bool Storage::write(uint16_t slot, ByteStream &buffer) { diff --git a/VortexEngine/src/Storage/Storage.h b/VortexEngine/src/Storage/Storage.h index 58b39072f0..60a1b755df 100644 --- a/VortexEngine/src/Storage/Storage.h +++ b/VortexEngine/src/Storage/Storage.h @@ -20,6 +20,8 @@ class Storage // set the global storage page, the chromadeck has 8 pages of 16 slots each static void setStoragePage(uint8_t page); + // get the current storage page + static uint8_t getStoragePage(); // store a serial buffer to storage static bool write(uint16_t slot, ByteStream &buffer); diff --git a/VortexEngine/src/VortexConfig.h b/VortexEngine/src/VortexConfig.h index d14a79620e..50dc1bd500 100644 --- a/VortexEngine/src/VortexConfig.h +++ b/VortexEngine/src/VortexConfig.h @@ -604,6 +604,9 @@ // switch the profile of the chromadeck (selects the storage page in the main menu) #define EDITOR_VERB_SWITCH_PROFILE "O" +// get the current profile of the chromadeck +#define EDITOR_VERB_GET_PROFILE "P" + // =================================================================== // Manually Configured Sizes //