mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-29 01:11:10 -05:00
Add generic implementation of SetCustomMode to RGBController class
This commit is contained in:
@@ -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()
|
||||
{
|
||||
|
||||
|
||||
@@ -325,7 +325,7 @@ public:
|
||||
virtual void DeviceUpdateMode() = 0;
|
||||
void DeviceSaveMode();
|
||||
|
||||
virtual void SetCustomMode() = 0;
|
||||
void SetCustomMode();
|
||||
|
||||
private:
|
||||
std::thread* DeviceCallThread;
|
||||
|
||||
Reference in New Issue
Block a user