Skip to content
Merged
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
19 changes: 19 additions & 0 deletions VortexEngine/src/Menus/MenuList/EditorConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions VortexEngine/src/Menus/MenuList/EditorConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class EditorConnection : public Menu
void sendCurModeVL();
void listenModeVL();
ReturnCode sendBrightness();
ReturnCode sendProfile();
ReturnCode receiveBuffer(ByteStream &buffer);
ReturnCode receiveModes();
ReturnCode receiveModeCount();
Expand Down Expand Up @@ -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,

Expand Down
5 changes: 5 additions & 0 deletions VortexEngine/src/Storage/Storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 2 additions & 0 deletions VortexEngine/src/Storage/Storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions VortexEngine/src/VortexConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand Down
Loading