Remove effect modes from HyperX Alloy FPS as they do not work
This commit is contained in:
parent
16789ef1f1
commit
644b76fc86
3 changed files with 2 additions and 393 deletions
|
|
@ -55,70 +55,6 @@ std::string HyperXAlloyFPSController::GetSerialString()
|
|||
return(return_string);
|
||||
}
|
||||
|
||||
void HyperXAlloyFPSController::SetMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned char direction,
|
||||
unsigned char speed,
|
||||
std::vector<RGBColor> colors
|
||||
)
|
||||
{
|
||||
unsigned char color_mode;
|
||||
unsigned char mode_colors[9];
|
||||
|
||||
active_mode = mode;
|
||||
active_direction = direction;
|
||||
active_speed = speed;
|
||||
|
||||
memset(mode_colors, 0x00, sizeof(mode_colors));
|
||||
|
||||
switch(colors.size())
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
color_mode = HYPERX_ALLOY_FPS_COLOR_MODE_SPECTRUM;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
color_mode = HYPERX_ALLOY_FPS_COLOR_MODE_SINGLE;
|
||||
mode_colors[0] = RGBGetRValue(colors[0]);
|
||||
mode_colors[1] = RGBGetGValue(colors[0]);
|
||||
mode_colors[2] = RGBGetBValue(colors[0]);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
color_mode = HYPERX_ALLOY_FPS_COLOR_MODE_DUAL;
|
||||
mode_colors[3] = RGBGetRValue(colors[0]);
|
||||
mode_colors[4] = RGBGetGValue(colors[0]);
|
||||
mode_colors[5] = RGBGetBValue(colors[0]);
|
||||
mode_colors[6] = RGBGetRValue(colors[1]);
|
||||
mode_colors[7] = RGBGetGValue(colors[1]);
|
||||
mode_colors[8] = RGBGetBValue(colors[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
SendEffect
|
||||
(
|
||||
0x01,
|
||||
active_mode,
|
||||
active_direction,
|
||||
HYPERX_ALLOY_FPS_REACTIVE_MODE_NONE,
|
||||
active_speed,
|
||||
color_mode,
|
||||
mode_colors[0],
|
||||
mode_colors[1],
|
||||
mode_colors[2],
|
||||
mode_colors[3],
|
||||
mode_colors[4],
|
||||
mode_colors[5],
|
||||
mode_colors[6],
|
||||
mode_colors[7],
|
||||
mode_colors[8]
|
||||
);
|
||||
|
||||
std::this_thread::sleep_for(100ms);
|
||||
}
|
||||
|
||||
void HyperXAlloyFPSController::SetLEDsDirect(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char red_color_data[106];
|
||||
|
|
@ -156,216 +92,10 @@ void HyperXAlloyFPSController::SetLEDsDirect(std::vector<RGBColor> colors)
|
|||
);
|
||||
}
|
||||
|
||||
void HyperXAlloyFPSController::SetLEDs(std::vector<RGBColor> colors)
|
||||
{
|
||||
unsigned char red_color_data[106];
|
||||
unsigned char grn_color_data[106];
|
||||
unsigned char blu_color_data[106];
|
||||
unsigned char ext_color_data[150];
|
||||
|
||||
for(std::size_t i = 0; i < 106; i++)
|
||||
{
|
||||
red_color_data[i] = RGBGetRValue(colors[i]);
|
||||
grn_color_data[i] = RGBGetGValue(colors[i]);
|
||||
blu_color_data[i] = RGBGetBValue(colors[i]);
|
||||
}
|
||||
|
||||
SendColor
|
||||
(
|
||||
0x01,
|
||||
HYPERX_ALLOY_FPS_COLOR_CHANNEL_RED,
|
||||
red_color_data
|
||||
);
|
||||
|
||||
std::this_thread::sleep_for(5ms);
|
||||
|
||||
SendColor
|
||||
(
|
||||
0x01,
|
||||
HYPERX_ALLOY_FPS_COLOR_CHANNEL_GREEN,
|
||||
grn_color_data
|
||||
);
|
||||
|
||||
std::this_thread::sleep_for(5ms);
|
||||
|
||||
SendColor
|
||||
(
|
||||
0x01,
|
||||
HYPERX_ALLOY_FPS_COLOR_CHANNEL_BLUE,
|
||||
blu_color_data
|
||||
);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------------*\
|
||||
| Private packet sending functions. |
|
||||
\*-------------------------------------------------------------------------------------------------*/
|
||||
|
||||
void HyperXAlloyFPSController::SelectProfile
|
||||
(
|
||||
unsigned char profile
|
||||
)
|
||||
{
|
||||
unsigned char buf[264];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Select Profile packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x07;
|
||||
buf[0x01] = 0x01;
|
||||
buf[0x02] = profile;
|
||||
|
||||
buf[0x06] = 0x03;
|
||||
buf[0x07] = 0x01;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
|
||||
void HyperXAlloyFPSController::SendEffect
|
||||
(
|
||||
unsigned char profile,
|
||||
unsigned char mode,
|
||||
unsigned char direction,
|
||||
unsigned char reactive_mode,
|
||||
unsigned char speed,
|
||||
unsigned char color_mode,
|
||||
unsigned char red_single,
|
||||
unsigned char grn_single,
|
||||
unsigned char blu_single,
|
||||
unsigned char red_dual_1,
|
||||
unsigned char grn_dual_1,
|
||||
unsigned char blu_dual_1,
|
||||
unsigned char red_dual_2,
|
||||
unsigned char grn_dual_2,
|
||||
unsigned char blu_dual_2
|
||||
)
|
||||
{
|
||||
unsigned char buf[264];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Effect packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x07;
|
||||
buf[0x01] = HYPERX_ALLOY_FPS_PACKET_ID_SET_EFFECT;
|
||||
buf[0x02] = profile;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set mode |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x09] = 0x01;
|
||||
buf[0x0A] = mode;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set direction |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x0D] = direction;
|
||||
buf[0x0E] = direction;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set reactive mode |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x1B] = reactive_mode;
|
||||
buf[0x1C] = reactive_mode;
|
||||
buf[0x1D] = reactive_mode;
|
||||
buf[0x1E] = reactive_mode;
|
||||
buf[0x1F] = reactive_mode;
|
||||
buf[0x20] = reactive_mode;
|
||||
buf[0x21] = reactive_mode;
|
||||
buf[0x22] = reactive_mode;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set mode-specific colors |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x29] = red_single;
|
||||
buf[0x41] = grn_single;
|
||||
buf[0x59] = blu_single;
|
||||
buf[0x2A] = red_dual_1;
|
||||
buf[0x42] = grn_dual_1;
|
||||
buf[0x5A] = blu_dual_1;
|
||||
buf[0x2B] = red_dual_2;
|
||||
buf[0x43] = grn_dual_2;
|
||||
buf[0x5B] = blu_dual_2;
|
||||
|
||||
buf[0x6B] = 0x09;
|
||||
buf[0x6C] = 0x09;
|
||||
buf[0x6D] = 0x05;
|
||||
buf[0x6E] = 0x05;
|
||||
buf[0x6F] = 0x06;
|
||||
buf[0x70] = 0x05;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set speed |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x71] = speed;
|
||||
|
||||
buf[0x72] = 0x09;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set color mode |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x73] = color_mode;
|
||||
buf[0x74] = color_mode;
|
||||
buf[0x75] = color_mode;
|
||||
buf[0x76] = color_mode;
|
||||
buf[0x77] = color_mode;
|
||||
buf[0x78] = color_mode;
|
||||
buf[0x79] = color_mode;
|
||||
buf[0x7A] = color_mode;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
|
||||
void HyperXAlloyFPSController::SendColor
|
||||
(
|
||||
unsigned char profile,
|
||||
unsigned char color_channel,
|
||||
unsigned char* color_data
|
||||
)
|
||||
{
|
||||
unsigned char buf[264];
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Zero out buffer |
|
||||
\*-----------------------------------------------------*/
|
||||
memset(buf, 0x00, sizeof(buf));
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Set up Color packet |
|
||||
\*-----------------------------------------------------*/
|
||||
buf[0x00] = 0x07;
|
||||
buf[0x01] = HYPERX_ALLOY_FPS_PACKET_ID_SET_COLOR;
|
||||
buf[0x02] = profile;
|
||||
buf[0x03] = color_channel;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Fill in color data |
|
||||
\*-----------------------------------------------------*/
|
||||
for(int i = 0; i < 106; i++)
|
||||
{
|
||||
buf[keys[i]] = color_data[i];
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| Send packet |
|
||||
\*-----------------------------------------------------*/
|
||||
hid_send_feature_report(dev, buf, 264);
|
||||
}
|
||||
|
||||
void HyperXAlloyFPSController::SendDirect
|
||||
(
|
||||
unsigned char color_channel,
|
||||
|
|
|
|||
|
|
@ -16,44 +16,9 @@
|
|||
|
||||
enum
|
||||
{
|
||||
HYPERX_ALLOY_FPS_PACKET_ID_SET_EFFECT = 0x02, /* Set profile effect packet */
|
||||
HYPERX_ALLOY_FPS_PACKET_ID_SET_COLOR = 0x06, /* Set profile color packet */
|
||||
HYPERX_ALLOY_FPS_PACKET_ID_DIRECT = 0x16, /* Direct control packet */
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_ALLOY_FPS_DIRECTION_RIGHT = 0x00,
|
||||
HYPERX_ALLOY_FPS_DIRECTION_LEFT = 0x01,
|
||||
HYPERX_ALLOY_FPS_DIRECTION_UP = 0x02,
|
||||
HYPERX_ALLOY_FPS_DIRECTION_DOWN = 0x03,
|
||||
HYPERX_ALLOY_FPS_DIRECTION_IN = 0x04,
|
||||
HYPERX_ALLOY_FPS_DIRECTION_OUT = 0x05
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_ALLOY_FPS_MODE_WAVE = 0x00,
|
||||
HYPERX_ALLOY_FPS_MODE_STATIC = 0x01,
|
||||
HYPERX_ALLOY_FPS_MODE_BREATHING = 0x02,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_ALLOY_FPS_REACTIVE_MODE_TRIGGER = 0x03,
|
||||
HYPERX_ALLOY_FPS_REACTIVE_MODE_EXPLOSION = 0x04,
|
||||
HYPERX_ALLOY_FPS_REACTIVE_MODE_HYPERX_FLAME = 0x05,
|
||||
HYPERX_ALLOY_FPS_REACTIVE_MODE_NONE = 0xFF
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_ALLOY_FPS_COLOR_MODE_SINGLE = 0x00,
|
||||
HYPERX_ALLOY_FPS_COLOR_MODE_DUAL = 0x01,
|
||||
HYPERX_ALLOY_FPS_COLOR_MODE_SPECTRUM = 0x02
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
HYPERX_ALLOY_FPS_COLOR_CHANNEL_RED = 0x01,
|
||||
|
|
@ -70,55 +35,12 @@ public:
|
|||
std::string GetDeviceLocation();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetMode
|
||||
(
|
||||
unsigned char mode,
|
||||
unsigned char direction,
|
||||
unsigned char speed,
|
||||
std::vector<RGBColor> colors
|
||||
);
|
||||
|
||||
void SetLEDsDirect(std::vector<RGBColor> colors);
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
unsigned char active_mode;
|
||||
unsigned char active_direction;
|
||||
unsigned char active_speed;
|
||||
std::string location;
|
||||
|
||||
void SelectProfile
|
||||
(
|
||||
unsigned char profile
|
||||
);
|
||||
|
||||
void SendEffect
|
||||
(
|
||||
unsigned char profile,
|
||||
unsigned char mode,
|
||||
unsigned char direction,
|
||||
unsigned char reactive_mode,
|
||||
unsigned char speed,
|
||||
unsigned char color_mode,
|
||||
unsigned char red_single,
|
||||
unsigned char grn_single,
|
||||
unsigned char blu_single,
|
||||
unsigned char red_dual_1,
|
||||
unsigned char grn_dual_1,
|
||||
unsigned char blu_dual_1,
|
||||
unsigned char red_dual_2,
|
||||
unsigned char grn_dual_2,
|
||||
unsigned char blu_dual_2
|
||||
);
|
||||
|
||||
void SendColor
|
||||
(
|
||||
unsigned char profile,
|
||||
unsigned char color_channel,
|
||||
unsigned char* color_data
|
||||
);
|
||||
|
||||
void SendDirect
|
||||
(
|
||||
unsigned char color_channel,
|
||||
|
|
|
|||
|
|
@ -160,42 +160,11 @@ RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSControl
|
|||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = HYPERX_ALLOY_FPS_MODE_STATIC;
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = HYPERX_ALLOY_FPS_MODE_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Static.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = HYPERX_ALLOY_FPS_MODE_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Wave.speed_min = 0x00;
|
||||
Wave.speed_max = 0x09;
|
||||
Wave.color_mode = MODE_COLORS_NONE;
|
||||
Wave.speed = 0x09;
|
||||
Wave.direction = MODE_DIRECTION_LEFT;
|
||||
modes.push_back(Wave);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = HYPERX_ALLOY_FPS_MODE_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Breathing.speed_min = 0x00;
|
||||
Breathing.speed_max = 0x09;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 2;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.speed = 0x09;
|
||||
Breathing.colors.resize(2);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
SetupZones();
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
|
|
@ -284,10 +253,6 @@ void RGBController_HyperXAlloyFPS::DeviceUpdateLEDs()
|
|||
{
|
||||
controller->SetLEDsDirect(colors);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetLEDs(colors);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyFPS::UpdateZoneLEDs(int /*zone*/)
|
||||
|
|
@ -307,15 +272,7 @@ void RGBController_HyperXAlloyFPS::SetCustomMode()
|
|||
|
||||
void RGBController_HyperXAlloyFPS::DeviceUpdateMode()
|
||||
{
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
controller->SetMode(modes[active_mode].value, modes[active_mode].direction, modes[active_mode].speed, modes[active_mode].colors);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<RGBColor> temp_colors;
|
||||
controller->SetMode(modes[active_mode].value, modes[active_mode].direction, modes[active_mode].speed, temp_colors);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyFPS::KeepaliveThreadFunction()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue