Add generic implementation of SetCustomMode to RGBController class

This commit is contained in:
Adam Honse 2022-08-09 20:49:38 -05:00
parent 3af17b6d8e
commit afb975e5fc
2 changed files with 32 additions and 1 deletions

View file

@ -1539,6 +1539,37 @@ void RGBController::DeviceUpdateLEDs()
}
void RGBController::SetCustomMode()
{
/*-------------------------------------------------*\
| Search the Controller's mode list for a suitable |
| per-LED custom mode in the following order: |
| 1. Direct |
| 2. Custom |
| 3. Static |
\*-------------------------------------------------*/
#define NUM_CUSTOM_MODE_NAMES 3
const std::string custom_mode_names[] =
{
"Direct",
"Custom",
"Static"
};
for(unsigned int custom_mode_idx = 0; custom_mode_idx < NUM_CUSTOM_MODE_NAMES; custom_mode_idx++)
{
for(unsigned int mode_idx = 0; mode_idx < modes.size(); mode_idx++)
{
if(modes[mode_idx].name == custom_mode_names[custom_mode_idx] && modes[mode_idx].color_mode == MODE_COLORS_PER_LED)
{
active_mode = mode_idx;
return;
}
}
}
}
void RGBController::DeviceUpdateMode()
{