Compare commits

..
84 changed files with 2526 additions and 4575 deletions
-1
View File
@@ -1 +0,0 @@
*.pro.user*
@@ -18,19 +18,9 @@ AMDWraithPrismController::AMDWraithPrismController(libusb_device_handle* dev_han
strcpy(device_name, "AMD Wraith Prism");
current_fan_mode = AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC;
current_fan_speed = 0xFF;
current_fan_random_color = false;
current_logo_mode = AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC;
current_logo_speed = 0xFF;
current_logo_random_color = false;
current_ring_mode = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
current_ring_speed = 0xFF;
current_ring_direction = false;
SendEnableCommand();
SetRingEffectChannel(0x00);
SendApplyCommand();
}
AMDWraithPrismController::~AMDWraithPrismController()
@@ -126,83 +116,133 @@ std::string AMDWraithPrismController::GetFirmwareVersionString()
return(ret_string);
}
void AMDWraithPrismController::SetFanMode(unsigned char mode, unsigned char speed, bool random_color)
{
current_fan_mode = mode;
current_fan_speed = speed_values_fan_logo[mode][speed];
current_fan_random_color = random_color;
}
void AMDWraithPrismController::SetFanColor(unsigned char red, unsigned char green, unsigned char blue)
{
SendEffectChannelUpdate
(
AMD_WRAITH_PRISM_EFFECT_CHANNEL_FAN_LED,
current_fan_speed,
false,
current_fan_random_color,
current_fan_mode,
max_brightness_fan_logo[current_fan_mode],
red,
green,
blue
);
}
unsigned char usb_buf[] =
{
0x51, 0x2C, 0x01, 0x00,
0x06, 0xFF, 0x00, 0x01,
0xFF, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
void AMDWraithPrismController::SetLogoMode(unsigned char mode, unsigned char speed, bool random_color)
{
current_logo_mode = mode;
current_logo_speed = speed_values_fan_logo[mode][speed];
current_logo_random_color = random_color;
int actual;
usb_buf[0x0A] = red;
usb_buf[0x0B] = green;
usb_buf[0x0C] = blue;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
}
void AMDWraithPrismController::SetLogoColor(unsigned char red, unsigned char green, unsigned char blue)
{
SendEffectChannelUpdate
(
AMD_WRAITH_PRISM_EFFECT_CHANNEL_LOGO_LED,
current_logo_speed,
false,
current_logo_random_color,
current_logo_mode,
max_brightness_fan_logo[current_logo_mode],
red,
green,
blue
);
}
unsigned char usb_buf[] =
{
0x51, 0x2C, 0x01, 0x00,
0x05, 0xFF, 0x00, 0x01,
0xFF, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
void AMDWraithPrismController::SetRingMode(unsigned char mode, unsigned char speed, bool direction, bool random_color)
{
current_ring_mode = mode;
current_ring_speed = speed_values_ring[mode][speed];
current_ring_direction = direction;
current_ring_random_color = random_color;
int actual;
usb_buf[0x0A] = red;
usb_buf[0x0B] = green;
usb_buf[0x0C] = blue;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
}
void AMDWraithPrismController::SetRingColor(unsigned char red, unsigned char green, unsigned char blue)
{
SetRingEffectChannel(current_ring_mode);
unsigned char usb_buf[] =
{
0x51, 0x2C, 0x01, 0x00,
0x00, 0xFF, 0x00, 0xFF,
0xFF, 0xFF, 0x00, 0xFF,
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF
};
SendEffectChannelUpdate
(
current_ring_mode,
current_ring_speed,
current_ring_direction,
current_ring_random_color,
mode_value_ring[current_ring_mode],
max_brightness_ring[current_ring_mode],
red,
green,
blue
);
int actual;
SendApplyCommand();
usb_buf[0x0A] = red;
usb_buf[0x0B] = green;
usb_buf[0x0C] = blue;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
}
void AMDWraithPrismController::SetRingEffectChannel(unsigned char channel)
{
SendChannelRemap(channel, AMD_WRAITH_PRISM_EFFECT_CHANNEL_LOGO_LED, AMD_WRAITH_PRISM_EFFECT_CHANNEL_FAN_LED);
unsigned char usb_buf[] =
{
0x51, 0xA0, 0x01, 0x00,
0x00, 0x03, 0x00, 0x00,
0x05, 0x06, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07,
0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
int actual;
for(int led = 0x0A; led <= 0x18; led++)
{
usb_buf[led] = channel;
}
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
}
void AMDWraithPrismController::SendEnableCommand()
@@ -261,18 +301,7 @@ void AMDWraithPrismController::SendApplyCommand()
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
}
void AMDWraithPrismController::SendEffectChannelUpdate
(
unsigned char effect_channel,
unsigned char speed,
bool direction,
bool random_color,
unsigned char mode,
unsigned char brightness,
unsigned char red,
unsigned char green,
unsigned char blue
)
void AMDWraithPrismController::SendEffectCommand()
{
unsigned char usb_buf[] =
{
@@ -296,53 +325,6 @@ void AMDWraithPrismController::SendEffectChannelUpdate
int actual;
usb_buf[0x04] = effect_channel;
usb_buf[0x05] = speed;
usb_buf[0x06] = (direction ? 0x01 : 0x00) | (random_color ? 0x80 : 0x00);
usb_buf[0x07] = mode;
usb_buf[0x09] = brightness;
usb_buf[0x0A] = red;
usb_buf[0x0B] = green;
usb_buf[0x0C] = blue;
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
}
void AMDWraithPrismController::SendChannelRemap(unsigned char ring_channel, unsigned char logo_channel, unsigned char fan_channel)
{
unsigned char usb_buf[] =
{
0x51, 0xA0, 0x01, 0x00,
0x00, 0x03, 0x00, 0x00,
0x05, 0x06, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07,
0x07, 0x07, 0x07, 0x07,
0x07, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
int actual;
usb_buf[0x08] = logo_channel;
usb_buf[0x09] = fan_channel;
for(int led = 0x0A; led <= 0x18; led++)
{
usb_buf[led] = ring_channel;
}
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
}
@@ -12,100 +12,6 @@
#pragma once
static const unsigned char max_brightness_fan_logo[] =
{
0x00,
0xFF,
0x7F,
0xFF
};
static const unsigned char speed_values_fan_logo[][5] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, /* Static */
{ 0x96, 0x8C, 0x80, 0x6E, 0x68 }, /* Color Cycle */
{ 0x3C, 0x37, 0x31, 0x2C, 0x26 }, /* Breathing */
};
static const unsigned char max_brightness_ring[] =
{
0xFF,
0xFF,
0x7F,
0x00,
0x00,
0x00,
0x00,
0xFF,
0xFF,
0xFF,
0xFF,
0xFF
};
static const unsigned char mode_value_ring[] =
{
0xFF,
0x03,
0xFF,
0x00,
0x00,
0x00,
0x00,
0x05,
0xFF,
0xC3,
0x4A,
0x05
};
static const unsigned char speed_values_ring[][5] =
{
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, /* Static */
{ 0x3C, 0x37, 0x31, 0x2C, 0x26 }, /* Breathing */
{ 0x96, 0x8C, 0x80, 0x6E, 0x68 }, /* Color Cycle */
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */
{ 0x72, 0x68, 0x64, 0x62, 0x61 }, /* Rainbow */
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Bounce */
{ 0x77, 0x74, 0x6E, 0x6B, 0x67 }, /* Chase */
{ 0x77, 0x74, 0x6E, 0x6B, 0x67 }, /* Swirl */
{ 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Morse Code */
};
enum
{
AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC = 0x01, /* Fan/Logo Static Mode */
AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE = 0x02, /* Fan/Logo Color Cycle Mode */
AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING = 0x03, /* Fan/Logo Breathing Mode */
};
enum
{
AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC = 0x00, /* Static effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING = 0x01, /* Breathing effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE = 0x02, /* Color cycle effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_LOGO_LED = 0x05, /* Logo LED effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_FAN_LED = 0x06, /* Fan LED effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW = 0x07, /* Rainbow effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE = 0x08, /* Bounce effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_CHASE = 0x09, /* Chase effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_SWIRL = 0x0A, /* Swirl effect channel */
AMD_WRAITH_PRISM_EFFECT_CHANNEL_MORSE = 0x0B, /* Morse code effect channel */
};
enum
{
AMD_WRAITH_PRISM_SPEED_SLOWEST = 0x00, /* Slowest speed */
AMD_WRAITH_PRISM_SPEED_SLOW = 0x01, /* Slow speed */
AMD_WRAITH_PRISM_SPEED_NORMAL = 0x02, /* Normal speed */
AMD_WRAITH_PRISM_SPEED_FAST = 0x03, /* Fast speed */
AMD_WRAITH_PRISM_SPEED_FASTEST = 0x04, /* Fastest speed */
};
class AMDWraithPrismController
{
public:
@@ -119,48 +25,15 @@ public:
void SetRingEffectChannel(unsigned char channel);
void SetFanMode(unsigned char mode, unsigned char speed, bool random_color);
void SetFanColor(unsigned char red, unsigned char green, unsigned char blue);
void SetLogoMode(unsigned char mode, unsigned char speed, bool random_color);
void SetLogoColor(unsigned char red, unsigned char green, unsigned char blue);
void SetRingMode(unsigned char mode, unsigned char speed, bool direction, bool random_color);
void SetRingColor(unsigned char red, unsigned char green, unsigned char blue);
void SendEnableCommand();
void SendApplyCommand();
void SendEffectCommand();
private:
char device_name[32];
libusb_device_handle* dev;
unsigned char current_fan_mode;
unsigned char current_fan_speed;
bool current_fan_random_color;
unsigned char current_logo_mode;
unsigned char current_logo_speed;
bool current_logo_random_color;
unsigned char current_ring_mode;
unsigned char current_ring_speed;
bool current_ring_direction;
bool current_ring_random_color;
void SendEnableCommand();
void SendApplyCommand();
void SendEffectChannelUpdate
(
unsigned char effect_channel,
unsigned char speed,
bool direction,
bool random_color,
unsigned char mode,
unsigned char brightness,
unsigned char red,
unsigned char green,
unsigned char blue
);
void SendChannelRemap(unsigned char ring_channel, unsigned char logo_channel, unsigned char fan_channel);
};
@@ -1,504 +0,0 @@
/*---------------------------------------------------------*\
| Processing Code for Corsair Commander Pro |
| |
| Adam Honse ([email protected]), 1/16/2020 |
\*---------------------------------------------------------*/
#include "CorsairCmdrProController.h"
#include <fstream>
#include <iostream>
#include <string>
#include <cstring>
//Include thread libraries for Windows or Linux
#ifdef WIN32
#include <process.h>
#else
#include "pthread.h"
#include "unistd.h"
#endif
//Thread functions have different types in Windows and Linux
#ifdef WIN32
#define THREAD static void
#define THREADRETURN
#else
#define THREAD static void*
#define THREADRETURN return(NULL);
#endif
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
THREAD keepalive_thread(void *param)
{
CorsairCmdrProController* corsair = static_cast<CorsairCmdrProController*>(param);
corsair->KeepaliveThread();
THREADRETURN
}
CorsairCmdrProController::CorsairCmdrProController(libusb_device_handle* dev_handle)
{
dev = dev_handle;
channel_leds[0] = 60;
channel_leds[1] = 60;
/*-----------------------------------------------------*\
| The Corsair Lighting Node Pro requires a packet within|
| 20 seconds of sending the lighting change in order |
| to not revert back into rainbow mode. Start a thread |
| to continuously send a keepalive packet every 5s |
\*-----------------------------------------------------*/
#ifdef WIN32
_beginthread(keepalive_thread, 0, this);
#else
pthread_t thread;
pthread_create(&thread, NULL, &keepalive_thread, this);
#endif
}
CorsairCmdrProController::~CorsairCmdrProController()
{
}
void CorsairCmdrProController::KeepaliveThread()
{
while(1)
{
SendCommit();
Sleep(5000);
}
}
void CorsairCmdrProController::SetChannelEffect(unsigned char channel,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2
)
{
/*-----------------------------------------------------*\
| Send Reset packet |
\*-----------------------------------------------------*/
SendReset(channel);
/*-----------------------------------------------------*\
| Send Begin packet |
\*-----------------------------------------------------*/
SendBegin(channel);
/*-----------------------------------------------------*\
| Set Port State packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE);
/*-----------------------------------------------------*\
| Set Effect Configuration packet |
\*-----------------------------------------------------*/
SendEffectConfig
(
channel,
0,
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP,
mode,
speed,
direction,
random,
red1,
grn1,
blu1,
red2,
grn2,
blu2,
0,
0,
0,
0,
0,
0
);
/*-----------------------------------------------------*\
| Send Commit packet |
\*-----------------------------------------------------*/
SendCommit();
}
void CorsairCmdrProController::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
{
unsigned char color_data[50];
unsigned char pkt_max;
/*-----------------------------------------------------*\
| Send Port State packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE);
/*-----------------------------------------------------*\
| Send red channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetRValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
/*-----------------------------------------------------*\
| Send red channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetRValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
}
/*-----------------------------------------------------*\
| Send green channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
/*-----------------------------------------------------*\
| Send green channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
}
/*-----------------------------------------------------*\
| Send blue channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx]);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
/*-----------------------------------------------------*\
| Send blue channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx+50]);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
}
/*-----------------------------------------------------*\
| Send Commit packet |
\*-----------------------------------------------------*/
SendCommit();
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairCmdrProController::SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_DIRECT;
usb_buf[0x01] = channel;
usb_buf[0x02] = start;
usb_buf[0x03] = count;
usb_buf[0x04] = color_channel;
/*-----------------------------------------------------*\
| Copy in color data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x05], color_data, count);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendCommit()
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Commit packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_COMMIT;
usb_buf[0x01] = 0xFF;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendBegin
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Begin packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_BEGIN;
usb_buf[0x01] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Effect Config packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG;
usb_buf[0x01] = channel;
usb_buf[0x02] = count * 10;
usb_buf[0x03] = led_type;
/*-----------------------------------------------------*\
| Set up mode parameters |
\*-----------------------------------------------------*/
usb_buf[0x04] = mode;
usb_buf[0x05] = speed;
usb_buf[0x06] = direction;
usb_buf[0x07] = change_style;
usb_buf[0x08] = 0;
/*-----------------------------------------------------*\
| Set up mode colors |
\*-----------------------------------------------------*/
usb_buf[0x09] = color_0_red;
usb_buf[0x10] = color_0_green;
usb_buf[0x11] = color_0_blue;
usb_buf[0x12] = color_1_red;
usb_buf[0x13] = color_1_green;
usb_buf[0x14] = color_1_blue;
usb_buf[0x15] = color_2_red;
usb_buf[0x16] = color_2_green;
usb_buf[0x17] = color_2_blue;
/*-----------------------------------------------------*\
| Set up temperatures |
\*-----------------------------------------------------*/
usb_buf[0x12] = (temperature_0 >> 8);
usb_buf[0x13] = (temperature_0 & 0xFF);
usb_buf[0x14] = (temperature_1 >> 8);
usb_buf[0x15] = (temperature_1 & 0xFF);
usb_buf[0x16] = (temperature_2 >> 8);
usb_buf[0x17] = (temperature_2 & 0xFF);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendTemperature()
{
}
void CorsairCmdrProController::SendReset
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Reset packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_RESET;
usb_buf[0x01] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendPortState
(
unsigned char channel,
unsigned char state
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Port State packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE;
usb_buf[0x01] = channel;
usb_buf[0x02] = state;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x02, usb_buf, 64, &actual, 0);
}
void CorsairCmdrProController::SendBrightness()
{
}
void CorsairCmdrProController::SendLEDCount()
{
}
void CorsairCmdrProController::SendProtocol()
{
}
@@ -1,164 +0,0 @@
/*---------------------------------------------------------*\
| Definitions for Corsair Commander Pro |
| |
| Adam Honse ([email protected]), 1/16/2020 |
\*---------------------------------------------------------*/
#include "RGBController.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#pragma once
enum
{
CORSAIR_CMDR_PRO_PACKET_ID_DIRECT = 0x32, /* Direct mode LED update packet */
CORSAIR_CMDR_PRO_PACKET_ID_COMMIT = 0x33, /* Commit changes packet */
CORSAIR_CMDR_PRO_PACKET_ID_BEGIN = 0x34, /* Begin effect packet */
CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG = 0x35, /* Effect mode configuration packet */
CORSAIR_CMDR_PRO_PACKET_ID_TEMPERATURE = 0x36, /* Update temperature value packet */
CORSAIR_CMDR_PRO_PACKET_ID_RESET = 0x37, /* Reset channel packet */
CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE = 0x38, /* Set port state packet */
CORSAIR_CMDR_PRO_PACKET_ID_BRIGHTNESS = 0x39, /* Set brightness packet */
CORSAIR_CMDR_PRO_PACKET_ID_LED_COUNT = 0x3A, /* Set LED count packet */
CORSAIR_CMDR_PRO_PACKET_ID_PROTOCOL = 0x3B, /* Set protocol packet */
};
enum
{
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED = 0x00, /* Red channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN = 0x01, /* Green channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE = 0x02, /* Blue channel for direct update */
};
enum
{
CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE = 0x01, /* Effect hardware control of channel */
CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE = 0x02, /* Direct software control of channel */
};
enum
{
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP = 0x0A, /* Corsair LED Strip Type */
CORSAIR_CMDR_PRO_LED_TYPE_HD_FAN = 0x0C, /* Corsair HD-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_SP_FAN = 0x01, /* Corsair SP-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_ML_FAN = 0x02, /* Corsair ML-series Fan Type */
};
enum
{
CORSAIR_CMDR_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
CORSAIR_CMDR_PRO_CHANNEL_2 = 0x01, /* Channel 2 */
CORSAIR_CMDR_PRO_NUM_CHANNELS = 0x02, /* Number of channels */
};
enum
{
CORSAIR_CMDR_PRO_SPEED_FAST = 0x00, /* Fast speed */
CORSAIR_CMDR_PRO_SPEED_MEDIUM = 0x01, /* Medium speed */
CORSAIR_CMDR_PRO_SPEED_SLOW = 0x02, /* Slow speed */
};
enum
{
CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE = 0x00, /* Rainbow Wave mode */
CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT = 0x01, /* Color Shift mode */
CORSAIR_CMDR_PRO_MODE_COLOR_PULSE = 0x02, /* Color Pulse mode */
CORSAIR_CMDR_PRO_MODE_COLOR_WAVE = 0x03, /* Color Wave mode */
CORSAIR_CMDR_PRO_MODE_STATIC = 0x04, /* Static mode */
CORSAIR_CMDR_PRO_MODE_TEMPERATURE = 0x05, /* Temperature mode */
CORSAIR_CMDR_PRO_MODE_VISOR = 0x06, /* Visor mode */
CORSAIR_CMDR_PRO_MODE_MARQUEE = 0x07, /* Marquee mode */
CORSAIR_CMDR_PRO_MODE_BLINK = 0x08, /* Blink mode */
CORSAIR_CMDR_PRO_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
CORSAIR_CMDR_PRO_MODE_RAINBOW = 0x0A, /* Rainbow mode */
};
class CorsairCmdrProController
{
public:
CorsairCmdrProController(libusb_device_handle* dev_handle);
~CorsairCmdrProController();
char* GetLEDString();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned char channel,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2
);
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
unsigned int channel_leds[CORSAIR_CMDR_PRO_NUM_CHANNELS];
void KeepaliveThread();
private:
libusb_device_handle* dev;
void SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
);
void SendCommit();
void SendBegin
(
unsigned char channel
);
void SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
);
void SendTemperature();
void SendReset
(
unsigned char channel
);
void SendPortState
(
unsigned char channel,
unsigned char state
);
void SendBrightness();
void SendLEDCount();
void SendProtocol();
};
@@ -1,37 +0,0 @@
#include "CorsairCmdrProController.h"
#include "RGBController.h"
#include "RGBController_CorsairCmdrPro.h"
#include <vector>
#include <libusb-1.0/libusb.h>
#define CORSAIR_COMMANDER_PRO_VID 0x1B1C
#define CORSAIR_COMMANDER_PRO_PID 0x0C10
/******************************************************************************************\
* *
* DetectCorsairCmdrProControllers *
* *
* Detect devices supported by the Corsair Commander Pro driver *
* * *
\******************************************************************************************/
void DetectCorsairCmdrProControllers(std::vector<RGBController*> &rgb_controllers)
{
libusb_context * ctx;
libusb_init(&ctx);
//Look for Corsair Commander Pro
libusb_device_handle * dev = libusb_open_device_with_vid_pid(ctx, CORSAIR_COMMANDER_PRO_VID, CORSAIR_COMMANDER_PRO_PID);
if( dev )
{
libusb_detach_kernel_driver(dev, 0);
libusb_claim_interface(dev, 0);
CorsairCmdrProController* controller = new CorsairCmdrProController(dev);
RGBController_CorsairCmdrPro* rgb_controller = new RGBController_CorsairCmdrPro(controller);
rgb_controllers.push_back(rgb_controller);
}
} /* DetectCorsairCmdrProControllers() */
@@ -9,7 +9,6 @@
#include <fstream>
#include <iostream>
#include <string>
#include <cstring>
//Include thread libraries for Windows or Linux
#ifdef WIN32
@@ -70,122 +69,171 @@ CorsairNodeProController::~CorsairNodeProController()
{
}
void CorsairNodeProController::SendKeepalive()
{
unsigned char usb_apply[] =
{
0x33, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
int actual;
/*-----------------------------------------------------*\
| Send apply packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_apply, 64, &actual, 0);
}
void CorsairNodeProController::KeepaliveThread()
{
while(1)
{
SendCommit();
SendKeepalive();
Sleep(5000);
}
}
void CorsairNodeProController::SetChannelEffect(unsigned char channel,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2
)
void CorsairNodeProController::SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors)
{
/*-----------------------------------------------------*\
| Send Reset packet |
\*-----------------------------------------------------*/
SendReset(channel);
unsigned char usb_start[] =
{
0x38, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
unsigned char usb_data[] =
{
0x32, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
unsigned char usb_apply[] =
{
0x33, 0xFF, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
int actual;
/*-----------------------------------------------------*\
| Send Begin packet |
| Set channel in USB packets |
\*-----------------------------------------------------*/
SendBegin(channel);
usb_data[0x01] = channel;
usb_start[0x01] = channel;
/*-----------------------------------------------------*\
| Set Port State packet |
| Send start packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE);
/*-----------------------------------------------------*\
| Set Effect Configuration packet |
\*-----------------------------------------------------*/
SendEffectConfig
(
channel,
0,
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP,
mode,
speed,
direction,
random,
red1,
grn1,
blu1,
red2,
grn2,
blu2,
0,
0,
0,
0,
0,
0
);
/*-----------------------------------------------------*\
| Send Commit packet |
\*-----------------------------------------------------*/
SendCommit();
}
void CorsairNodeProController::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
{
unsigned char color_data[50];
unsigned char pkt_max;
/*-----------------------------------------------------*\
| Send Port State packet |
\*-----------------------------------------------------*/
SendPortState(channel, CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE);
libusb_interrupt_transfer(dev, 0x01, usb_start, 64, &actual, 0);
/*-----------------------------------------------------*\
| Send red channel packet 1 |
\*-----------------------------------------------------*/
pkt_max = 50;
std::size_t pkt_max = 50;
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
pkt_max = colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
usb_data[0x02] = 0;
usb_data[0x03] = pkt_max;
usb_data[0x04] = 0x00; //red
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetRValue(colors[idx]);
RGBColor color = colors[idx];
usb_data[idx + 5] = RGBGetRValue(color);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
libusb_interrupt_transfer(dev, 0x01, usb_data, 64, &actual, 0);
/*-----------------------------------------------------*\
| Send red channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
for(int idx = 4; idx < 64; idx++)
{
usb_data[idx] = 0;
}
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
pkt_max = colors.size() - 50;
}
if(pkt_max > 0)
{
usb_data[0x02] = 50;
usb_data[0x03] = pkt_max;
usb_data[0x04] = 0x00; //red
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetRValue(colors[idx+50]);
RGBColor color = colors[idx + 50];
usb_data[idx + 5] = RGBGetRValue(color);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED, color_data);
libusb_interrupt_transfer(dev, 0x01, usb_data, 64, &actual, 0);
}
/*-----------------------------------------------------*\
| Send green channel packet 1 |
\*-----------------------------------------------------*/
@@ -193,34 +241,49 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, std::vector
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
pkt_max = colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
usb_data[0x02] = 0;
usb_data[0x03] = pkt_max;
usb_data[0x04] = 0x01; //green
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx]);
RGBColor color = colors[idx];
usb_data[idx + 5] = RGBGetGValue(color);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
libusb_interrupt_transfer(dev, 0x01, usb_data, 64, &actual, 0);
/*-----------------------------------------------------*\
| Send green channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
for(int idx = 4; idx < 64; idx++)
{
usb_data[idx] = 0;
}
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
pkt_max = colors.size() - 50;
}
if(pkt_max > 0)
{
usb_data[0x02] = 50;
usb_data[0x03] = pkt_max;
usb_data[0x04] = 0x01; //green
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetGValue(colors[idx+50]);
RGBColor color = colors[idx + 50];
usb_data[idx + 5] = RGBGetGValue(color);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN, color_data);
libusb_interrupt_transfer(dev, 0x01, usb_data, 64, &actual, 0);
}
/*-----------------------------------------------------*\
@@ -230,275 +293,53 @@ void CorsairNodeProController::SetChannelLEDs(unsigned char channel, std::vector
if(pkt_max > colors.size())
{
pkt_max = (unsigned char)colors.size();
pkt_max = colors.size();
}
for(int idx = 0; idx < pkt_max; idx++)
usb_data[0x02] = 0;
usb_data[0x03] = pkt_max;
usb_data[0x04] = 0x02; //blue
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx]);
RGBColor color = colors[idx];
usb_data[idx + 5] = RGBGetBValue(color);
}
SendDirect(channel, 0, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
libusb_interrupt_transfer(dev, 0x01, usb_data, 64, &actual, 0);
/*-----------------------------------------------------*\
| Send blue channel packet 2 if necessary |
\*-----------------------------------------------------*/
pkt_max = 0;
for(int idx = 4; idx < 64; idx++)
{
usb_data[idx] = 0;
}
pkt_max = 0;
if (colors.size() > 50)
{
pkt_max = (unsigned char)(colors.size() - 50);
pkt_max = colors.size() - 50;
}
if(pkt_max > 0)
{
usb_data[0x02] = 50;
usb_data[0x03] = pkt_max;
usb_data[0x04] = 0x02; //blue
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
color_data[idx] = RGBGetBValue(colors[idx+50]);
RGBColor color = colors[idx + 50];
usb_data[idx + 5] = RGBGetBValue(color);
}
SendDirect(channel, 50, pkt_max, CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE, color_data);
libusb_interrupt_transfer(dev, 0x01, usb_data, 64, &actual, 0);
}
/*-----------------------------------------------------*\
| Send Commit packet |
| Send apply packet |
\*-----------------------------------------------------*/
SendCommit();
}
/*-------------------------------------------------------------------------------------------------*\
| Private packet sending functions. |
\*-------------------------------------------------------------------------------------------------*/
void CorsairNodeProController::SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Direct packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_DIRECT;
usb_buf[0x01] = channel;
usb_buf[0x02] = start;
usb_buf[0x03] = count;
usb_buf[0x04] = color_channel;
/*-----------------------------------------------------*\
| Copy in color data bytes |
\*-----------------------------------------------------*/
memcpy(&usb_buf[0x05], color_data, count);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendCommit()
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Commit packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_COMMIT;
usb_buf[0x01] = 0xFF;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendBegin
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Begin packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_BEGIN;
usb_buf[0x01] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Effect Config packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG;
usb_buf[0x01] = channel;
usb_buf[0x02] = count * 10;
usb_buf[0x03] = led_type;
/*-----------------------------------------------------*\
| Set up mode parameters |
\*-----------------------------------------------------*/
usb_buf[0x04] = mode;
usb_buf[0x05] = speed;
usb_buf[0x06] = direction;
usb_buf[0x07] = change_style;
usb_buf[0x08] = 0;
/*-----------------------------------------------------*\
| Set up mode colors |
\*-----------------------------------------------------*/
usb_buf[0x09] = color_0_red;
usb_buf[0x10] = color_0_green;
usb_buf[0x11] = color_0_blue;
usb_buf[0x12] = color_1_red;
usb_buf[0x13] = color_1_green;
usb_buf[0x14] = color_1_blue;
usb_buf[0x15] = color_2_red;
usb_buf[0x16] = color_2_green;
usb_buf[0x17] = color_2_blue;
/*-----------------------------------------------------*\
| Set up temperatures |
\*-----------------------------------------------------*/
usb_buf[0x12] = (temperature_0 >> 8);
usb_buf[0x13] = (temperature_0 & 0xFF);
usb_buf[0x14] = (temperature_1 >> 8);
usb_buf[0x15] = (temperature_1 & 0xFF);
usb_buf[0x16] = (temperature_2 >> 8);
usb_buf[0x17] = (temperature_2 & 0xFF);
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendTemperature()
{
}
void CorsairNodeProController::SendReset
(
unsigned char channel
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Reset packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_RESET;
usb_buf[0x01] = channel;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendPortState
(
unsigned char channel,
unsigned char state
)
{
int actual;
unsigned char usb_buf[64];
/*-----------------------------------------------------*\
| Zero out buffer |
\*-----------------------------------------------------*/
memset(usb_buf, 0x00, sizeof(usb_buf));
/*-----------------------------------------------------*\
| Set up Port State packet |
\*-----------------------------------------------------*/
usb_buf[0x00] = CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE;
usb_buf[0x01] = channel;
usb_buf[0x02] = state;
/*-----------------------------------------------------*\
| Send packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
}
void CorsairNodeProController::SendBrightness()
{
}
void CorsairNodeProController::SendLEDCount()
{
}
void CorsairNodeProController::SendProtocol()
{
libusb_interrupt_transfer(dev, 0x01, usb_apply, 64, &actual, 0);
}
@@ -10,70 +10,6 @@
#pragma once
enum
{
CORSAIR_CMDR_PRO_PACKET_ID_DIRECT = 0x32, /* Direct mode LED update packet */
CORSAIR_CMDR_PRO_PACKET_ID_COMMIT = 0x33, /* Commit changes packet */
CORSAIR_CMDR_PRO_PACKET_ID_BEGIN = 0x34, /* Begin effect packet */
CORSAIR_CMDR_PRO_PACKET_ID_EFFECT_CONFIG = 0x35, /* Effect mode configuration packet */
CORSAIR_CMDR_PRO_PACKET_ID_TEMPERATURE = 0x36, /* Update temperature value packet */
CORSAIR_CMDR_PRO_PACKET_ID_RESET = 0x37, /* Reset channel packet */
CORSAIR_CMDR_PRO_PACKET_ID_PORT_STATE = 0x38, /* Set port state packet */
CORSAIR_CMDR_PRO_PACKET_ID_BRIGHTNESS = 0x39, /* Set brightness packet */
CORSAIR_CMDR_PRO_PACKET_ID_LED_COUNT = 0x3A, /* Set LED count packet */
CORSAIR_CMDR_PRO_PACKET_ID_PROTOCOL = 0x3B, /* Set protocol packet */
};
enum
{
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_RED = 0x00, /* Red channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_GREEN = 0x01, /* Green channel for direct update */
CORSAIR_CMDR_PRO_DIRECT_CHANNEL_BLUE = 0x02, /* Blue channel for direct update */
};
enum
{
CORSAIR_CMDR_PRO_PORT_STATE_HARDWARE = 0x01, /* Effect hardware control of channel */
CORSAIR_CMDR_PRO_PORT_STATE_SOFTWARE = 0x02, /* Direct software control of channel */
};
enum
{
CORSAIR_CMDR_PRO_LED_TYPE_LED_STRIP = 0x0A, /* Corsair LED Strip Type */
CORSAIR_CMDR_PRO_LED_TYPE_HD_FAN = 0x0C, /* Corsair HD-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_SP_FAN = 0x01, /* Corsair SP-series Fan Type */
CORSAIR_CMDR_PRO_LED_TYPE_ML_FAN = 0x02, /* Corsair ML-series Fan Type */
};
enum
{
CORSAIR_CMDR_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
CORSAIR_CMDR_PRO_CHANNEL_2 = 0x01, /* Channel 2 */
CORSAIR_CMDR_PRO_NUM_CHANNELS = 0x02, /* Number of channels */
};
enum
{
CORSAIR_CMDR_PRO_SPEED_FAST = 0x00, /* Fast speed */
CORSAIR_CMDR_PRO_SPEED_MEDIUM = 0x01, /* Medium speed */
CORSAIR_CMDR_PRO_SPEED_SLOW = 0x02, /* Slow speed */
};
enum
{
CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE = 0x00, /* Rainbow Wave mode */
CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT = 0x01, /* Color Shift mode */
CORSAIR_CMDR_PRO_MODE_COLOR_PULSE = 0x02, /* Color Pulse mode */
CORSAIR_CMDR_PRO_MODE_COLOR_WAVE = 0x03, /* Color Wave mode */
CORSAIR_CMDR_PRO_MODE_STATIC = 0x04, /* Static mode */
CORSAIR_CMDR_PRO_MODE_TEMPERATURE = 0x05, /* Temperature mode */
CORSAIR_CMDR_PRO_MODE_VISOR = 0x06, /* Visor mode */
CORSAIR_CMDR_PRO_MODE_MARQUEE = 0x07, /* Marquee mode */
CORSAIR_CMDR_PRO_MODE_BLINK = 0x08, /* Blink mode */
CORSAIR_CMDR_PRO_MODE_SEQUENTIAL = 0x09, /* Sequential mode */
CORSAIR_CMDR_PRO_MODE_RAINBOW = 0x0A, /* Rainbow mode */
};
enum
{
CORSAIR_NODE_PRO_CHANNEL_1 = 0x00, /* Channel 1 */
@@ -89,83 +25,13 @@ public:
char* GetLEDString();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned char channel,
unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2
);
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
void SetChannelEffect(unsigned int channel, unsigned int mode, std::vector<RGBColor> colors);
void SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors);
void SendKeepalive();
unsigned int channel_leds[CORSAIR_NODE_PRO_NUM_CHANNELS];
void KeepaliveThread();
private:
libusb_device_handle* dev;
void SendDirect
(
unsigned char channel,
unsigned char start,
unsigned char count,
unsigned char color_channel,
unsigned char* color_data
);
void SendCommit();
void SendBegin
(
unsigned char channel
);
void SendEffectConfig
(
unsigned char channel,
unsigned char count,
unsigned char led_type,
unsigned char mode,
unsigned char speed,
unsigned char direction,
unsigned char change_style,
unsigned char color_0_red,
unsigned char color_0_green,
unsigned char color_0_blue,
unsigned char color_1_red,
unsigned char color_1_green,
unsigned char color_1_blue,
unsigned char color_2_red,
unsigned char color_2_green,
unsigned char color_2_blue,
unsigned short temperature_0,
unsigned short temperature_1,
unsigned short temperature_2
);
void SendTemperature();
void SendReset
(
unsigned char channel
);
void SendPortState
(
unsigned char channel,
unsigned char state
);
void SendBrightness();
void SendLEDCount();
void SendProtocol();
};
@@ -104,17 +104,7 @@ void CorsairProController::ApplyColors()
bus->i2c_smbus_write_byte_data(dev, 0x82, 0x02);
}
void CorsairProController::SetEffect(unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2
)
void CorsairProController::SetEffect(unsigned char mode)
{
effect_mode = mode;
@@ -123,28 +113,17 @@ void CorsairProController::SetEffect(unsigned char mode,
bus->i2c_smbus_write_byte_data(dev, 0x21, 0x00);
Sleep(1);
unsigned char random_byte;
if(random)
{
random_byte = CORSAIR_PRO_EFFECT_RANDOM_COLORS;
}
else
{
random_byte = CORSAIR_PRO_EFFECT_CUSTOM_COLORS;
}
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, effect_mode); //Mode
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, speed); //Speed
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, random_byte); //Custom color
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, direction); //Direction
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, red1); // Custom color 1 red
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, grn1); // Custom color 1 green
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, blu1); // Custom color 1 blue
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, effect_mode); //Mode
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_SPEED_MEDIUM); //Speed
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_EFFECT_RANDOM_COLORS); //Custom color
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, CORSAIR_PRO_DIRECTION_UP); //Direction
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 1 red
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 1 green
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 1 blue
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0xFF);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, red2); // Custom color 2 red
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, grn2); // Custom color 2 green
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, blu2); // Custom color 2 blue
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 2 red
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 2 green
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00); // Custom color 2 blue
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0xFF);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
bus->i2c_smbus_write_byte_data(dev, CORSAIR_PRO_REG_COMMAND, 0x00);
@@ -159,6 +138,11 @@ void CorsairProController::SetEffect(unsigned char mode,
WaitReady();
}
void CorsairProController::SetCustom()
{
SetEffect(CORSAIR_PRO_MODE_STATIC);
}
bool CorsairProController::WaitReady()
{
int i = 0;
@@ -70,17 +70,8 @@ public:
std::string GetDeviceLocation();
unsigned int GetLEDCount();
unsigned char GetEffect();
void SetEffect(unsigned char mode,
unsigned char speed,
unsigned char direction,
bool random,
unsigned char red1,
unsigned char grn1,
unsigned char blu1,
unsigned char red2,
unsigned char grn2,
unsigned char blu2
);
void SetEffect(unsigned char mode);
void SetCustom();
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
@@ -6,17 +6,6 @@
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#include <Windows.h>
#else
#include <unistd.h>
static void Sleep(unsigned int milliseconds)
{
usleep(1000 * milliseconds);
}
#endif
/******************************************************************************************\
* *
* TestForCorsairProController *
@@ -35,6 +24,20 @@ bool TestForCorsairProController(i2c_smbus_interface* bus, unsigned char address
{
pass = true;
res = bus->i2c_smbus_read_byte_data(address, 0x24);
if (res != 0x02)
{
pass = false;
}
res = bus->i2c_smbus_read_byte_data(address, 0x25);
if (res != 0x02)
{
pass = false;
}
res = bus->i2c_smbus_read_byte_data(address, 0x43);
if (res != 0x1C)
@@ -50,8 +53,6 @@ bool TestForCorsairProController(i2c_smbus_interface* bus, unsigned char address
}
}
Sleep(10);
return(pass);
} /* TestForCorsairProController() */
+109 -23
View File
@@ -19,9 +19,6 @@ Hue2Controller::Hue2Controller(libusb_device_handle* dev_handle)
Hue2Controller::~Hue2Controller()
{
current_mode = HUE_2_MODE_FIXED;
current_speed = HUE_2_SPEED_NORMAL;
current_direction = false;
}
unsigned int Hue2Controller::GetStripsOnChannel(unsigned int /*channel*/)
@@ -85,14 +82,7 @@ unsigned int Hue2Controller::GetStripsOnChannel(unsigned int /*channel*/)
return(ret_val);
}
void Hue2Controller::SetMode(unsigned char mode, unsigned char speed, bool direction)
{
current_mode = mode;
current_speed = speed;
current_direction = direction;
}
void Hue2Controller::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
void Hue2Controller::SetChannelEffect(unsigned int channel, unsigned int mode, std::vector<RGBColor> colors)
{
unsigned char usb_buf[] =
{
@@ -123,18 +113,8 @@ void Hue2Controller::SetChannelLEDs(unsigned char channel, std::vector<RGBColor>
/*-----------------------------------------------------*\
| Set mode in USB packet |
\*-----------------------------------------------------*/
usb_buf[0x04] = current_mode;
usb_buf[0x04] = mode;
/*-----------------------------------------------------*\
| Set speed in USB packet |
\*-----------------------------------------------------*/
usb_buf[0x05] = current_speed;
/*-----------------------------------------------------*\
| Set direction in USB packet |
\*-----------------------------------------------------*/
usb_buf[0x06] = current_direction ? 0x01 : 0x00;
/*-----------------------------------------------------*\
| Set color count in USB packet |
\*-----------------------------------------------------*/
@@ -154,4 +134,110 @@ void Hue2Controller::SetChannelLEDs(unsigned char channel, std::vector<RGBColor>
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
libusb_interrupt_transfer(dev, 0x81, usb_buf, 64, &actual, 0);
}
}
void Hue2Controller::SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors)
{
unsigned char usb_buf[] =
{
0x22, 0x10, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
unsigned char usb_apply[] =
{
0x22, 0xA0, 0x01, 0x00,
0x01, 0x00, 0x00, 0x28,
0x00, 0x00, 0x80, 0x00,
0x32, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
int actual;
std::size_t pkt_max = 20;
/*-----------------------------------------------------*\
| Set channel in USB packets |
\*-----------------------------------------------------*/
usb_buf[0x02] = 1 << channel;
usb_apply[0x02] = 1 << channel;
/*-----------------------------------------------------*\
| Send first packet for first 20 LEDs |
\*-----------------------------------------------------*/
if(pkt_max > colors.size())
{
pkt_max = colors.size();
}
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
int pixel_idx = idx * 3;
RGBColor color = colors[idx];
usb_buf[pixel_idx + 4] = RGBGetGValue(color);
usb_buf[pixel_idx + 5] = RGBGetRValue(color);
usb_buf[pixel_idx + 6] = RGBGetBValue(color);
}
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
/*-----------------------------------------------------*\
| Send second packet for second 20 LEDs if necessary |
\*-----------------------------------------------------*/
for(int idx = 4; idx < 64; idx++)
{
usb_buf[idx] = 0;
}
usb_buf[0x01] = 0x11;
pkt_max = 0;
if (colors.size() > 20)
{
pkt_max = colors.size() - 20;
}
if(pkt_max > 0)
{
for (std::size_t idx = 0; idx < pkt_max; idx++)
{
int pixel_idx = idx * 3;
RGBColor color = colors[idx + 20];
usb_buf[pixel_idx + 4] = RGBGetGValue(color);
usb_buf[pixel_idx + 5] = RGBGetRValue(color);
usb_buf[pixel_idx + 6] = RGBGetBValue(color);
}
libusb_interrupt_transfer(dev, 0x01, usb_buf, 64, &actual, 0);
}
/*-----------------------------------------------------*\
| Send apply packet |
\*-----------------------------------------------------*/
libusb_interrupt_transfer(dev, 0x01, usb_apply, 64, &actual, 0);
}
+2 -15
View File
@@ -28,15 +28,6 @@ enum
HUE_2_CHANNEL_4_IDX = 0x01, /* Channel 4 array index */
};
enum
{
HUE_2_SPEED_SLOWEST = 0x00, /* Slowest speed */
HUE_2_SPEED_SLOW = 0x01, /* Slow speed */
HUE_2_SPEED_NORMAL = 0x02, /* Normal speed */
HUE_2_SPEED_FAST = 0x03, /* Fast speed */
HUE_2_SPEED_FASTEST = 0x04, /* Fastest speed */
};
enum
{
HUE_2_MODE_FIXED = 0x00, /* Fixed colors mode */
@@ -58,15 +49,11 @@ public:
char* GetLEDString();
unsigned int GetStripsOnChannel(unsigned int channel);
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
void SetMode(unsigned char mode, unsigned char speed, bool direction);
void SetChannelEffect(unsigned int channel, unsigned int mode, std::vector<RGBColor> colors);
void SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors);
unsigned int channel_leds[HUE_2_NUM_CHANNELS];
private:
libusb_device_handle* dev;
unsigned char current_mode;
unsigned char current_speed;
bool current_direction;
};
@@ -24,18 +24,16 @@ static void Sleep(unsigned int milliseconds)
HuePlusController::HuePlusController()
{
current_mode = HUE_PLUS_MODE_FIXED;
current_speed = HUE_PLUS_SPEED_NORMAL;
current_direction = false;
}
HuePlusController::~HuePlusController()
{
}
void HuePlusController::Initialize(char* port)
void HuePlusController::Initialize(char* port_name)
{
strcpy(port_name, port);
strcpy(led_string, port_name);
serialport = new serial_port(port_name, HUE_PLUS_BAUD);
@@ -43,9 +41,9 @@ void HuePlusController::Initialize(char* port)
channel_leds[HUE_PLUS_CHANNEL_2_IDX] = GetLEDsOnChannel(HUE_PLUS_CHANNEL_2);
}
char* HuePlusController::GetLocation()
char* HuePlusController::GetLEDString()
{
return(port_name);
return(led_string);
}
unsigned int HuePlusController::GetLEDsOnChannel(unsigned int channel)
@@ -85,14 +83,7 @@ unsigned int HuePlusController::GetLEDsOnChannel(unsigned int channel)
return(ret_val);
}
void HuePlusController::SetMode(unsigned char mode, unsigned char speed, bool direction)
{
current_mode = mode;
current_speed = speed;
current_direction = direction;
}
void HuePlusController::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
void HuePlusController::SetChannelEffect(unsigned int channel, unsigned int mode, std::vector<RGBColor> colors)
{
unsigned char serial_buf[] =
{
@@ -138,18 +129,7 @@ void HuePlusController::SetChannelLEDs(unsigned char channel, std::vector<RGBCol
/*-----------------------------------------------------*\
| Set mode in serial packet |
\*-----------------------------------------------------*/
serial_buf[0x02] = current_mode;
/*-----------------------------------------------------*\
| Set options bitfield in serial packet |
\*-----------------------------------------------------*/
serial_buf[0x03] = 0;
serial_buf[0x03] |= current_direction ? ( 1 << 4 ) : 0;
/*-----------------------------------------------------*\
| Set speed in serial packet |
\*-----------------------------------------------------*/
serial_buf[0x04] = current_speed;
serial_buf[0x02] = mode;
/*-----------------------------------------------------*\
| Fill in color data |
@@ -167,4 +147,70 @@ void HuePlusController::SetChannelLEDs(unsigned char channel, std::vector<RGBCol
serialport->serial_flush_tx();
Sleep(10);
}
}
void HuePlusController::SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors)
{
unsigned char serial_buf[] =
{
0x4B, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00
};
/*-----------------------------------------------------*\
| Set channel in serial packet |
\*-----------------------------------------------------*/
serial_buf[0x01] = channel;
/*-----------------------------------------------------*\
| Set mode in serial packet |
\*-----------------------------------------------------*/
serial_buf[0x02] = HUE_PLUS_MODE_FIXED;
/*-----------------------------------------------------*\
| Fill in color data |
\*-----------------------------------------------------*/
for (unsigned int idx = 0; idx < (colors.size() * 3); idx += 3)
{
int pixel_idx = idx / 3;
RGBColor color = colors[pixel_idx];
serial_buf[idx + 5] = RGBGetGValue(color);
serial_buf[idx + 6] = RGBGetRValue(color);
serial_buf[idx + 7] = RGBGetBValue(color);
}
serialport->serial_write((char *)serial_buf, HUE_PLUS_PACKET_SIZE);
serialport->serial_flush_tx();
Sleep(10);
}
@@ -41,27 +41,10 @@ enum
enum
{
HUE_PLUS_SPEED_SLOWEST = 0x00, /* Slowest speed */
HUE_PLUS_SPEED_SLOW = 0x01, /* Slow speed */
HUE_PLUS_SPEED_NORMAL = 0x02, /* Normal speed */
HUE_PLUS_SPEED_FAST = 0x03, /* Fast speed */
HUE_PLUS_SPEED_FASTEST = 0x04, /* Fastest speed */
};
enum
{
HUE_PLUS_MODE_FIXED = 0x00, /* Fixed colors mode */
HUE_PLUS_MODE_FADING = 0x01, /* Fading mode */
HUE_PLUS_MODE_SPECTRUM = 0x02, /* Spectrum cycle mode */
HUE_PLUS_MODE_MARQUEE = 0x03, /* Marquee mode */
HUE_PLUS_MODE_COVER_MARQUEE = 0x04, /* Cover marquee mode */
HUE_PLUS_MODE_ALTERNATING = 0x05, /* Alternating mode */
HUE_PLUS_MODE_PULSING = 0x06, /* Pulsing mode */
HUE_PLUS_MODE_BREATHING = 0x07, /* Breathing mode */
HUE_PLUS_MODE_ALERT = 0x08, /* Alert mode */
HUE_PLUS_MODE_CANDLELIGHT = 0x09, /* Candlelight mode */
HUE_PLUS_MODE_WINGS = 0x0C, /* Wings mode */
HUE_PLUS_MODE_WAVE = 0x0D, /* Wave mode */
HUE_PLUS_MODE_FIXED = 0x00, /* Fixed colors mode */
HUE_PLUS_MODE_FADING = 0x01, /* Fading mode */
HUE_PLUS_MODE_SPECTRUM = 0x02, /* Spectrum cycle mode */
HUE_PLUS_NUM_MODES /* Number of Hue Plus modes */
};
class HuePlusController
@@ -70,21 +53,18 @@ public:
HuePlusController();
~HuePlusController();
void Initialize(char* port);
char* GetLocation();
void Initialize(char* port_name);
char* GetLEDString();
unsigned int GetLEDsOnChannel(unsigned int channel);
void SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors);
void SetMode(unsigned char mode, unsigned char speed, bool direction);
void SetChannelEffect(unsigned int channel, unsigned int mode, std::vector<RGBColor> colors);
void SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors);
unsigned int channel_leds[HUE_PLUS_NUM_CHANNELS];
private:
char port_name[128];
serial_port *serialport;
unsigned char current_mode;
unsigned char current_speed;
bool current_direction;
char led_string[1024];
char port_name[128];
serial_port *serialport;
};
#endif
@@ -12,7 +12,7 @@
* DetectHuePlusControllers *
* *
* Detect devices supported by the HuePlus driver *
* *
* * *
\******************************************************************************************/
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers)
@@ -109,7 +109,7 @@ void HyperXController::SetAllColors(unsigned char red, unsigned char green, unsi
if(mode == HYPERX_MODE_DIRECT)
{
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE_INDEPENDENT, HYPERX_MODE3_DIRECT);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE3, HYPERX_MODE3_DIRECT);
}
for(int led = 0; led < 5; led++)
@@ -194,91 +194,48 @@ void HyperXController::SetLEDColor(unsigned int slot, unsigned int led, unsigned
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x03);
}
void HyperXController::SetMode(unsigned char new_mode, bool random, unsigned short new_speed)
void HyperXController::SetMode(unsigned char new_mode)
{
mode = new_mode;
speed = new_speed;
mode = new_mode;
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_APPLY, 0x01);
/*-----------------------------------------------------*\
| Determine which mode register to use. |
| If set to random color mode, use Mode1. |
| If set to fixed color mode, use Mode2. |
\*-----------------------------------------------------*/
unsigned char mode_reg;
if(random)
{
mode_reg = HYPERX_REG_MODE_RANDOM;
}
else
{
mode_reg = HYPERX_REG_MODE_CUSTOM;
}
switch (mode)
{
case HYPERX_MODE_DIRECT:
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE_INDEPENDENT, HYPERX_MODE3_DIRECT);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE3, HYPERX_MODE3_DIRECT);
break;
case HYPERX_MODE_STATIC:
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE_CUSTOM, HYPERX_MODE2_STATIC);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_STATIC);
break;
case HYPERX_MODE_RAINBOW:
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE_RANDOM, HYPERX_MODE1_RAINBOW);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_TIMER_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_TIMER_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE1, HYPERX_MODE1_RAINBOW);
break;
case HYPERX_MODE_COMET:
bus->i2c_smbus_write_byte_data(dev, mode_reg, HYPERX_MODE2_COMET);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_TIMER_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_TIMER_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_COMET);
break;
case HYPERX_MODE_HEARTBEAT:
bus->i2c_smbus_write_byte_data(dev, mode_reg, HYPERX_MODE2_HEARTBEAT);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_OFF_TIME_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_OFF_TIME_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_ON_TIME_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_ON_TIME_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_DELAY_TIME_MSB, 0x03);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_DELAY_TIME_LSB, 0xE8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_HEARTBEAT);
break;
case HYPERX_MODE_CYCLE:
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE_RANDOM, HYPERX_MODE1_CYCLE);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_ON_TIME_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_ON_TIME_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_CHANGE_TIME_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_CHANGE_TIME_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE1, HYPERX_MODE1_CYCLE);
break;
case HYPERX_MODE_BREATHING:
bus->i2c_smbus_write_byte_data(dev, mode_reg, HYPERX_MODE2_BREATHING);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_FADE_IN_TIME_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_FADE_IN_TIME_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_FADE_OUT_TIME_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_FADE_OUT_TIME_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_OFF_TIME_MSB, 0x00);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_OFF_TIME_LSB, 0x00);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_BREATHING);
break;
case HYPERX_MODE_BOUNCE:
bus->i2c_smbus_write_byte_data(dev, mode_reg, HYPERX_MODE2_BOUNCE);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_TIMER_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_TIMER_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_BOUNCE);
break;
case HYPERX_MODE_BLINK:
bus->i2c_smbus_write_byte_data(dev, mode_reg, HYPERX_MODE2_BLINK);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_OFF_TIME_MSB, speed >> 8);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_OFF_TIME_LSB, speed & 0xFF);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_ON_TIME_MSB, 0x07);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_ON_TIME_LSB, 0xD4);
bus->i2c_smbus_write_byte_data(dev, HYPERX_REG_MODE2, HYPERX_MODE2_BLINK);
break;
}
@@ -101,25 +101,11 @@ enum
HYPERX_REG_SLOT3_LED3_BRIGHTNESS = 0xBA, /* Brightness for LED 3, Slot 3 (0-100) */
HYPERX_REG_SLOT3_LED4_BRIGHTNESS = 0xBD, /* Brightness for LED 4, Slot 3 (0-100) */
HYPERX_REG_TIMER_MSB = 0xD1, /* Timer MSB */
HYPERX_REG_TIMER_LSB = 0xD2, /* Timer LSB */
HYPERX_REG_ON_TIME_MSB = 0xD3, /* Effect on time MSB */
HYPERX_REG_ON_TIME_LSB = 0xD4, /* Effect on time LSB */
HYPERX_REG_CHANGE_TIME_MSB = 0xD5, /* Change time MSB */
HYPERX_REG_CHANGE_TIME_LSB = 0xD6, /* Change time LSB */
HYPERX_REG_FADE_IN_TIME_MSB = 0xD7, /* Fade in time MSB */
HYPERX_REG_FADE_IN_TIME_LSB = 0xD8, /* Fade in time LSB */
HYPERX_REG_FADE_OUT_TIME_MSB = 0xD9, /* Fade out time MSB */
HYPERX_REG_FADE_OUT_TIME_LSB = 0xDA, /* Fade out time LSB */
HYPERX_REG_OFF_TIME_MSB = 0xDB, /* Effect off time MSB */
HYPERX_REG_OFF_TIME_LSB = 0xDC, /* Effect off time LSB */
HYPERX_REG_EFFECT_BRIGHTNESS = 0xDD, /* Brightness for effects (0-100) */
HYPERX_REG_APPLY = 0xE1, /* Apply changes register */
HYPERX_REG_MODE_RANDOM = 0xE3, /* Mode control register, random colors */
HYPERX_REG_MODE_CUSTOM = 0xE4, /* Mode control register, custom colors */
HYPERX_REG_MODE_INDEPENDENT = 0xE5, /* Mode control register, independent */
HYPERX_REG_DELAY_TIME_MSB = 0xEA, /* Delay time MSB */
HYPERX_REG_DELAY_TIME_LSB = 0xEB, /* Delay time LSB */
HYPERX_REG_MODE1 = 0xE3, /* Mode control register 1 */
HYPERX_REG_MODE2 = 0xE4, /* Mode control register 2 */
HYPERX_REG_MODE3 = 0xE5, /* Mode control register 3 */
HYPERX_REG_EFFECT_RED = 0xEC, /* Red color register for effects */
HYPERX_REG_EFFECT_GREEN = 0xED, /* Green color register for effects */
HYPERX_REG_EFFECT_BLUE = 0xEE, /* Blue color register for effects */
@@ -160,31 +146,6 @@ enum
HYPERX_NUMBER_MODES /* Number of HyperX modes */
};
enum
{
HYPERX_SPEED_BOUNCE_SLOW = 0x07D0, /* Slowest speed for bounce mode */
HYPERX_SPEED_BOUNCE_NORMAL = 0x07D0, /* Normal speed for bounce mode */
HYPERX_SPEED_BOUNCE_FAST = 0x0064, /* Fastest speed for bounce mode */
HYPERX_SPEED_BREATHING_SLOW = 0x07D0, /* Slowest speed for breathing mode */
HYPERX_SPEED_BREATHING_NORMAL = 0x07D0, /* Normal speed for breathing mode */
HYPERX_SPEED_BREATHING_FAST = 0x0064, /* Fastest speed for breathing mode */
HYPERX_SPEED_CYCLE_SLOW = 0x05DC, /* Slowest speed for cycle mode */
HYPERX_SPEED_CYCLE_NORMAL = 0x05DC, /* Normal speed for cycle mode */
HYPERX_SPEED_CYCLE_FAST = 0x00FA, /* Fastest speed for cycle mode */
HYPERX_SPEED_RAINBOW_SLOW = 0x07D0, /* Slowest speed for rainbow mode */
HYPERX_SPEED_RAINBOW_NORMAL = 0x07D0, /* Normal speed for rainbow mode */
HYPERX_SPEED_RAINBOW_FAST = 0x0064, /* Fastest speed for rainbow mode */
HYPERX_SPEED_BLINK_SLOW = 0x07D0, /* Slowest speed for blink mode */
HYPERX_SPEED_BLINK_NORMAL = 0x07D0, /* Normal speed for blink mode */
HYPERX_SPEED_BLINK_FAST = 0x01F4, /* Fastest speed for blink mode */
HYPERX_SPEED_HEARTBEAT_SLOW = 0x07D0, /* Slowest speed for heartbeat mode */
HYPERX_SPEED_HEARTBEAT_NORMAL = 0x07D0, /* Normal speed for heartbeat mode */
HYPERX_SPEED_HEARTBEAT_FAST = 0x01F4, /* Fastest speed for heartbeat mode */
HYPERX_SPEED_COMET_SLOW = 0x07D0, /* Slowest speed for comet mode */
HYPERX_SPEED_COMET_NORMAL = 0x07D0, /* Normal speed for comet mode */
HYPERX_SPEED_COMET_FAST = 0x0064, /* Fastest speed for comet mode */
};
static const unsigned char slot_base[4] =
{
HYPERX_REG_SLOT0_LED0_RED, /* SPD 0x50 maps to slot 0 */
@@ -204,7 +165,7 @@ public:
unsigned int GetLEDCount();
unsigned int GetSlotCount();
unsigned int GetMode();
void SetMode(unsigned char new_mode, bool random, unsigned short new_speed);
void SetMode(unsigned char new_mode);
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetEffectColor(unsigned char red, unsigned char green, unsigned char blue);
@@ -218,5 +179,4 @@ private:
i2c_smbus_interface* bus;
hyperx_dev_id dev;
unsigned int mode;
unsigned short speed;
};
@@ -85,7 +85,7 @@ void PatriotViperController::SetEffectColor(unsigned char red, unsigned char gre
ViperRegisterWrite(VIPER_REG_LED3_EFFECT_COLOR, red, blue, green);
ViperRegisterWrite(VIPER_REG_LED4_EFFECT_COLOR, red, blue, green);
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, speed);
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, 0x0C);
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
}
@@ -121,7 +121,7 @@ void PatriotViperController::SetLEDEffectColor(unsigned int led, unsigned char r
ViperRegisterWrite(VIPER_REG_LED0_EFFECT_COLOR + led, red, blue, green);
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, speed);
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, 0x0C);
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
}
@@ -143,20 +143,19 @@ void PatriotViperController::SetLEDEffectColor(unsigned int slot, unsigned int l
ViperRegisterWrite(VIPER_REG_LED0_EFFECT_COLOR + led, red, blue, green);
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, speed);
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, 0x0C);
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
}
void PatriotViperController::SetMode(unsigned char new_mode, unsigned char new_speed)
void PatriotViperController::SetMode(unsigned char new_mode)
{
direct = false;
mode = new_mode;
speed = new_speed;
mode = new_mode;
ViperRegisterWrite(VIPER_REG_START, 0xFF, 0xFF, 0xFF);
ViperRegisterWrite(VIPER_REG_STATIC, 0x04, 0x00, 0x00);
ViperRegisterWrite(VIPER_REG_MODE, mode, 0x00, speed);
ViperRegisterWrite(VIPER_REG_MODE, new_mode, 0x00, 0x0C);
ViperRegisterWrite(VIPER_REG_MODE, 0xAA, 0x00, 0x00);
ViperRegisterWrite(VIPER_REG_MODE, 0xFA, 0x00, 0x00);
}
@@ -45,16 +45,6 @@ enum
VIPER_MODE_NEON = 0x08, /* Neon mode */
};
enum
{
VIPER_SPEED_MIN = 0xC8, /* Slowest speed for non-breathing mode */
VIPER_SPEED_DEFAULT = 0x64, /* Default speed for non-breathing mode */
VIPER_SPEED_MAX = 0x14, /* Fastest speed for non-breathing mode */
VIPER_SPEED_BREATHING_MIN = 0xFF, /* Slowest speed for breathing mode */
VIPER_SPEED_BREATHING_DEFAULT = 0x0C, /* Default speed for breathing mode */
VIPER_SPEED_BREATHING_MAX = 0x00, /* Fastest speed for breathing mode */
};
class PatriotViperController
{
public:
@@ -66,7 +56,7 @@ public:
unsigned int GetLEDCount();
unsigned int GetSlotCount();
unsigned int GetMode();
void SetMode(unsigned char new_mode, unsigned char new_speed);
void SetMode(unsigned char new_mode);
void SetDirect();
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
@@ -85,6 +75,5 @@ private:
unsigned char slots_valid;
i2c_smbus_interface* bus;
viper_dev_id dev;
unsigned char mode;
unsigned char speed;
unsigned int mode;
};
@@ -9,8 +9,6 @@
#include "PoseidonZRGBController.h"
#include <cstring>
#ifdef WIN32
#include <Windows.h>
#else
@@ -49,10 +47,10 @@ char* PoseidonZRGBController::GetDeviceName()
void PoseidonZRGBController::SetLEDsDirect(std::vector<RGBColor> colors)
{
unsigned char red_grn_buf[265];
unsigned char blu_buf[265];
unsigned char red_grn_buf[264];
unsigned char blu_buf[264];
for(int i = 0; i < 265; i++)
for(int i = 0; i < 264; i++)
{
red_grn_buf[i] = 0x00;
blu_buf[i] = 0x00;
@@ -93,109 +91,83 @@ void PoseidonZRGBController::SetLEDsDirect(std::vector<RGBColor> colors)
void PoseidonZRGBController::SetLEDs(std::vector<RGBColor> colors)
{
unsigned char red_color_data[104];
unsigned char grn_color_data[104];
unsigned char blu_color_data[104];
unsigned char buf[264] = {0};
//Send Red Packet
for(int i = 0; i < 264; i++)
{
buf[i] = 0xFF;
}
buf[0] = 0x07;
buf[1] = 0x09;
buf[2] = 0x01;
buf[3] = 0x01;
for(int i = 0; i < 104; i++)
{
red_color_data[keys[i] - 8] = RGBGetRValue(colors[i]);
grn_color_data[keys[i] - 8] = RGBGetGValue(colors[i]);
blu_color_data[keys[i] - 8] = RGBGetBValue(colors[i]);
buf[keys[i]] = RGBGetRValue(colors[i]);
}
SendColor
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_COLOR_RED,
red_color_data
);
hid_send_feature_report(dev, buf, 264);
Sleep(10);
SendColor
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_COLOR_GREEN,
grn_color_data
);
Sleep(10);
SendColor
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_COLOR_BLUE,
blu_color_data
);
Sleep(10);
SendControl
(
POSEIDONZ_PROFILE_P1,
POSEIDONZ_PROFILE_P1,
0,
POSEIDONZ_MODE_STATIC,
POSEIDONZ_BRIGHTNESS_MAX
);
}
void PoseidonZRGBController::SendColor
(
unsigned char profile_to_edit,
unsigned char color_channel,
unsigned char* color_data
)
{
unsigned char usb_buf[265];
switch(color_channel)
{
case POSEIDONZ_COLOR_RED:
memset(usb_buf, 0xFF, sizeof(usb_buf));
break;
case POSEIDONZ_COLOR_GREEN:
memset(usb_buf, 0x00, sizeof(usb_buf));
break;
case POSEIDONZ_COLOR_BLUE:
memset(usb_buf, 0x11, sizeof(usb_buf));
break;
}
//Send Green Packet
for(int i = 0; i < 264; i++)
{
buf[i] = 0x00;
}
usb_buf[0x00] = 0x07;
usb_buf[0x01] = 0x07;
usb_buf[0x02] = 0x09;
usb_buf[0x03] = profile_to_edit;
buf[0] = 0x07;
buf[1] = 0x09;
buf[2] = 0x01;
buf[3] = 0x02;
memcpy(&usb_buf[0x08], color_data, 104);
buf[8] = 0xFF;
hid_send_feature_report(dev, &usb_buf[1], 264);
}
void PoseidonZRGBController::SendControl
(
unsigned char profile_to_activate,
unsigned char profile_to_edit,
unsigned char direction,
unsigned char mode,
unsigned char brightness
)
{
unsigned char usb_buf[265];
memset(usb_buf, 0x00, sizeof(usb_buf));
usb_buf[0x00] = 0x07;
usb_buf[0x01] = 0x07;
usb_buf[0x02] = 0x02;
usb_buf[0x03] = profile_to_activate;
usb_buf[0x09] = profile_to_edit;
usb_buf[0x0B] = direction;
usb_buf[0x0D] = mode;
usb_buf[0x0E] = brightness;
usb_buf[0x11] = 0x08;
hid_send_feature_report(dev, &usb_buf[1], 264);
for(int i = 0; i < 104; i++)
{
buf[keys[i]] = RGBGetGValue(colors[i]);
}
hid_send_feature_report(dev, buf, 264);
Sleep(10);
//Send Blue Packet
for(int i = 0; i < 264; i++)
{
buf[i] = 0x11;
}
buf[0] = 0x07;
buf[1] = 0x09;
buf[2] = 0x01;
buf[3] = 0x03;
for(int i = 0; i < 104; i++)
{
buf[keys[i]] = RGBGetBValue(colors[i]);
}
hid_send_feature_report(dev, buf, 264);
Sleep(10);
//Send Update Packet
for(int i = 0; i < 264; i++)
{
buf[i] = 0x00;
}
buf[0] = 0x07;
buf[1] = 0x02;
buf[2] = 0x01;
buf[8] = 0x01; //Preset to save
buf[13] = 0x04; //Brightness?
buf[16] = 0x08;
buf[22] = 0x03;
hid_send_feature_report(dev, buf, 264);
}
@@ -21,37 +21,6 @@
#define POSEIDONZ_RED_GRN_CH 0x01
#define POSEIDONZ_BLU_CH 0x02
enum
{
POSEIDONZ_MODE_STATIC = 0x00,
POSEIDONZ_MODE_REACTIVE = 0x01,
POSEIDONZ_MODE_ARROW_FLOW = 0x02,
POSEIDONZ_MODE_WAVE = 0x03,
POSEIDONZ_MODE_RIPPLE = 0x04
};
enum
{
POSEIDONZ_PROFILE_P1 = 0x01,
POSEIDONZ_PROFILE_P2 = 0x02,
POSEIDONZ_PROFILE_P3 = 0x03,
POSEIDONZ_PROFILE_P4 = 0x04,
POSEIDONZ_PROFILE_P5 = 0x05
};
enum
{
POSEIDONZ_BRIGHTNESS_MIN = 0x00,
POSEIDONZ_BRIGHTNESS_MAX = 0x04
};
enum
{
POSEIDONZ_COLOR_RED = 0x01,
POSEIDONZ_COLOR_GREEN = 0x02,
POSEIDONZ_COLOR_BLUE = 0x03
};
class PoseidonZRGBController
{
public:
@@ -66,20 +35,4 @@ public:
private:
char device_name[32];
hid_device* dev;
void SendControl
(
unsigned char profile_to_activate,
unsigned char profile_to_edit,
unsigned char direction,
unsigned char mode,
unsigned char brightness
);
void SendColor
(
unsigned char profile_to_edit,
unsigned char color_channel,
unsigned char* color_data
);
};
@@ -18,28 +18,12 @@
void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device_info* info;
hid_device* dev;
//Look for Thermaltake Poseidon Z RGB Keyboard
hid_init();
info = hid_enumerate(TT_POSEIDON_Z_RGB_VID, TT_POSEIDON_Z_RGB_PID);
//Look for Thermaltake Poseidon Z RGB Keyboard
while(info)
{
if((info->vendor_id == TT_POSEIDON_Z_RGB_VID)
&&(info->product_id == TT_POSEIDON_Z_RGB_PID)
&&(info->interface_number == 0))
{
dev = hid_open_path(info->path);
break;
}
else
{
info = info->next;
}
}
dev = hid_open(TT_POSEIDON_Z_RGB_VID, TT_POSEIDON_Z_RGB_PID, 0);
if( dev )
{
@@ -0,0 +1,121 @@
/*-----------------------------------------*\
| RGBFusion2Controller.cpp |
| |
| Driver for Gigabyte Aorus RGB Fusion 2.0 |
| lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#include "RGBFusion2Controller.h"
#include <cstring>
#include <stdio.h>
#include <stdlib.h>
RGBFusion2Controller::RGBFusion2Controller(hid_device* dev_handle)
{
dev = dev_handle;
// Set Device name
strcpy(device_name, "Gigabyte Motherboard");
// Set LED count
led_count = 8;
}
RGBFusion2Controller::~RGBFusion2Controller()
{
}
std::string RGBFusion2Controller::GetDeviceName()
{
return(device_name);
}
std::string RGBFusion2Controller::GetDeviceLocation()
{
return("");
}
unsigned int RGBFusion2Controller::GetLEDCount()
{
return(led_count);
}
unsigned char RGBFusion2Controller::GetMode()
{
return(0);
}
void RGBFusion2Controller::SetAllColors(unsigned char red, unsigned char green, unsigned char blue)
{
}
void RGBFusion2Controller::SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue)
{
unsigned char usb_buf[] =
{
0xCC, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01,
0x5A, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
usb_buf[0x01] = (0x20 | led);
usb_buf[0x02] = (0x01 << led );
usb_buf[0x0E] = blue;
usb_buf[0x0F] = green;
usb_buf[0x10] = red;
hid_send_feature_report(dev, usb_buf, 64);
SendApply();
}
void RGBFusion2Controller::SendApply()
{
unsigned char usb_buf[] =
{
0xCC, 0x28, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
};
hid_send_feature_report(dev, usb_buf, 64);
}
void RGBFusion2Controller::SetMode(unsigned char mode)
{
}
void RGBFusion2Controller::dump()
{
}
@@ -0,0 +1,39 @@
/*-----------------------------------------*\
| RGBFusion2Controller.h |
| |
| Definitions and types for Gigabyte Aorus |
| RGB Fusion 2.0 lighting controller |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#include <string>
#include <hidapi/hidapi.h>
#pragma once
class RGBFusion2Controller
{
public:
RGBFusion2Controller(hid_device* dev_handle);
~RGBFusion2Controller();
std::string GetDeviceName();
std::string GetDeviceLocation();
unsigned int GetLEDCount();
unsigned char GetMode();
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode);
private:
void dump();
char device_name[32];
unsigned int led_count;
void SendApply();
hid_device* dev;
};
@@ -0,0 +1,36 @@
#include "RGBFusion2Controller.h"
#include "RGBController.h"
#include "RGBController_RGBFusion2.h"
#include <vector>
#include <hidapi/hidapi.h>
#define RGB_FUSION_2_VID 0x048D
#define RGB_FUSION_2_PID 0x8297
/******************************************************************************************\
* *
* DetectRGBFusion2Controllers *
* *
* Detect RGB Fusion 2.0 controllers on the USB interface. *
* *
\******************************************************************************************/
void DetectRGBFusion2Controllers(std::vector<RGBController*>& rgb_controllers)
{
hid_device* dev;
//Look for RGB Fusion 2.0 Controller
hid_init();
dev = hid_open(RGB_FUSION_2_VID, RGB_FUSION_2_PID, 0);
if( dev )
{
RGBFusion2Controller* controller = new RGBFusion2Controller(dev);
RGBController_RGBFusion2* rgb_controller = new RGBController_RGBFusion2(controller);
rgb_controllers.push_back(rgb_controller);
}
} /* DetectRGBFusionControllers() */
@@ -102,13 +102,11 @@ void RGBFusionController::SetLEDColor(unsigned int led, unsigned char red, unsig
}
}
void RGBFusionController::SetMode(unsigned char mode, unsigned char speed)
void RGBFusionController::SetMode(unsigned char mode)
{
switch_bank(0);
set_mode_ch_0(mode);
set_timers_ch_0(speed_table[0][speed], speed_table[1][speed]);
set_mode_ch_1(mode);
set_timers_ch_1(speed_table[0][speed], speed_table[1][speed]);
}
void RGBFusionController::dump()
@@ -172,22 +170,6 @@ void RGBFusionController::set_mode_ch_1(unsigned char mode)
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_1_MODE, mode + RGB_FUSION_WRITE_MODE_OFST);
}
void RGBFusionController::set_timers_ch_0(unsigned short timer0, unsigned short timer1)
{
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_0_TIMER_0_MSB, timer0 >> 8);
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_0_TIMER_0_LSB, timer0 & 0xFF);
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_0_TIMER_1_MSB, timer1 >> 8);
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_0_TIMER_1_LSB, timer1 & 0xFF);
}
void RGBFusionController::set_timers_ch_1(unsigned short timer0, unsigned short timer1)
{
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_1_TIMER_0_MSB, timer0 >> 8);
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_1_TIMER_0_LSB, timer0 & 0xFF);
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_1_TIMER_1_MSB, timer1 >> 8);
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_0_REG_CH_1_TIMER_1_LSB, timer1 & 0xFF);
}
void RGBFusionController::switch_bank(unsigned char bank)
{
bus->i2c_smbus_write_byte_data(dev, RGB_FUSION_BANK_SWITCH_REG, bank);
@@ -17,23 +17,7 @@ typedef unsigned char rgb_fusion_dev_id;
enum
{
RGB_FUSION_BANK_0_REG_CH_0_MODE = 0x03, /* Channel 0 Mode Selection */
RGB_FUSION_BANK_0_REG_CH_0_TIMER_0_MSB
= 0x06, /* Channel 0 Timer 0 MSB */
RGB_FUSION_BANK_0_REG_CH_0_TIMER_0_LSB
= 0x07, /* Channel 0 Timer 0 LSB */
RGB_FUSION_BANK_0_REG_CH_0_TIMER_1_MSB
= 0x08, /* Channel 0 Timer 1 MSB */
RGB_FUSION_BANK_0_REG_CH_0_TIMER_1_LSB
= 0x09, /* Channel 0 Timer 1 LSB */
RGB_FUSION_BANK_0_REG_CH_1_MODE = 0x13, /* Channel 1 Mode Selection */
RGB_FUSION_BANK_0_REG_CH_1_TIMER_0_MSB
= 0x16, /* Channel 1 Timer 0 MSB */
RGB_FUSION_BANK_0_REG_CH_1_TIMER_0_LSB
= 0x17, /* Channel 1 Timer 0 LSB */
RGB_FUSION_BANK_0_REG_CH_1_TIMER_1_MSB
= 0x18, /* Channel 1 Timer 1 MSB */
RGB_FUSION_BANK_0_REG_CH_1_TIMER_1_LSB
= 0x19, /* Channel 1 Timer 1 LSB */
RGB_FUSION_BANK_1_REG_CH_0_R = 0x00, /* Channel 0 Red Value */
RGB_FUSION_BANK_1_REG_CH_0_G = 0x01, /* Channel 0 Green Value */
RGB_FUSION_BANK_1_REG_CH_0_B = 0x02, /* Channel 0 Blue Value */
@@ -43,19 +27,6 @@ enum
RGB_FUSION_BANK_SWITCH_REG = 0xF0, /* Bank Switch Register */
};
enum
{
RGB_FUSION_SPEED_SLOW = 0x00, /* Slowest speed */
RGB_FUSION_SPEED_NORMAL = 0x01, /* Normal speed */
RGB_FUSION_SPEED_FAST = 0x02, /* Fastest speed */
};
static const short speed_table[2][3] =
{
{ 0x01E0, 0x00F0, 0x0078 },
{ 0x4000, 0x2000, 0x1000 }
};
#define RGB_FUSION_NUMBER_MODES 3 /* Number of RGB Fusion modes */
#define RGB_FUSION_WRITE_MODE_OFST 0x10 /* offset to add when writing mode */
@@ -78,7 +49,7 @@ public:
unsigned char GetMode();
void SetAllColors(unsigned char red, unsigned char green, unsigned char blue);
void SetLEDColor(unsigned int led, unsigned char red, unsigned char green, unsigned char blue);
void SetMode(unsigned char mode, unsigned char speed);
void SetMode(unsigned char mode);
private:
void dump();
@@ -90,8 +61,6 @@ private:
void set_color_ch_1(unsigned char red, unsigned char green, unsigned char blue);
void set_mode_ch_0(unsigned char mode);
void set_mode_ch_1(unsigned char mode);
void set_timers_ch_0(unsigned short timer0, unsigned short timer1);
void set_timers_ch_1(unsigned short timer0, unsigned short timer1);
void switch_bank(unsigned char bank);
char device_name[32];
+2 -4
View File
@@ -324,6 +324,7 @@ void DetectHyperXControllers(std::vector<i2c_smbus_interface*> &busses, std::vec
void DetectPatriotViperControllers(std::vector<i2c_smbus_interface*> &busses, std::vector<RGBController*> &rgb_controllers);
void DetectPolychromeControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectRGBFusionControllers(std::vector<i2c_smbus_interface*>& busses, std::vector<RGBController*>& rgb_controllers);
void DetectRGBFusion2Controllers(std::vector<RGBController*>& rgb_controllers);
void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers);
void DetectHue2Controllers(std::vector<RGBController*> &rgb_controllers);
void DetectHuePlusControllers(std::vector<RGBController*> &rgb_controllers);
@@ -334,9 +335,7 @@ void DetectAMDWraithPrismControllers(std::vector<RGBController*>& rgb_controller
void DetectAorusGPUControllers(std::vector<RGBController*> &rgb_controllers);
void DetectMSI3ZoneControllers(std::vector<RGBController*>& rgb_controllers);
void DetectPoseidonZRGBControllers(std::vector<RGBController*>& rgb_controllers);
void DetectCorsairCmdrProControllers(std::vector<RGBController*> &rgb_controllers);
void DetectCorsairNodeProControllers(std::vector<RGBController*> &rgb_controllers);
void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers);
/******************************************************************************************\
* *
@@ -358,6 +357,7 @@ void DetectRGBControllers(void)
DetectPolychromeControllers(busses, rgb_controllers);
DetectRGBFusionControllers(busses, rgb_controllers);
DetectRGBFusion2Controllers(rgb_controllers);
DetectLEDStripControllers(rgb_controllers);
DetectHue2Controllers(rgb_controllers);
DetectHuePlusControllers(rgb_controllers);
@@ -365,7 +365,6 @@ void DetectRGBControllers(void)
DetectAMDWraithPrismControllers(rgb_controllers);
DetectMSI3ZoneControllers(rgb_controllers);
DetectPoseidonZRGBControllers(rgb_controllers);
DetectCorsairCmdrProControllers(rgb_controllers);
DetectCorsairNodeProControllers(rgb_controllers);
DetectE131Controllers(rgb_controllers);
@@ -382,7 +381,6 @@ void DetectRGBControllers(void)
\*-------------------------------------*/
#else
DetectOpenRazerControllers(rgb_controllers);
DetectFaustusControllers(rgb_controllers);
#endif
} /* DetectRGBControllers() */
+8 -10
View File
@@ -14,7 +14,6 @@ INCLUDEPATH += \
Controllers/AMDWraithPrismController/ \
Controllers/AuraController/ \
Controllers/CorsairController/ \
Controllers/CorsairCmdrProController/ \
Controllers/CorsairNodeProController/ \
Controllers/CorsairProController/ \
Controllers/Hue2Controller/ \
@@ -26,6 +25,7 @@ INCLUDEPATH += \
Controllers/PolychromeController/ \
Controllers/PoseidonZRGBController/ \
Controllers/RGBFusionController/ \
Controllers/RGBFusion2Controller/ \
RGBController/ \
qt/
@@ -49,8 +49,6 @@ SOURCES += \
Controllers/AuraController/AuraControllerDetect.cpp \
Controllers/CorsairController/CorsairController.cpp \
Controllers/CorsairController/CorsairControllerDetect.cpp \
Controllers/CorsairCmdrProController/CorsairCmdrProController.cpp \
Controllers/CorsairCmdrProController/CorsairCmdrProControllerDetect.cpp \
Controllers/CorsairNodeProController/CorsairNodeProController.cpp \
Controllers/CorsairNodeProController/CorsairNodeProControllerDetect.cpp \
Controllers/CorsairProController/CorsairProController.cpp \
@@ -73,12 +71,13 @@ SOURCES += \
Controllers/PoseidonZRGBController/PoseidonZRGBControllerDetect.cpp \
Controllers/RGBFusionController/RGBFusionController.cpp \
Controllers/RGBFusionController/RGBFusionControllerDetect.cpp \
Controllers/RGBFusion2Controller/RGBFusion2Controller.cpp \
Controllers/RGBFusion2Controller/RGBFusion2ControllerDetect.cpp \
RGBController/RGBController.cpp \
RGBController/E131ControllerDetect.cpp \
RGBController/RGBController_AMDWraithPrism.cpp \
RGBController/RGBController_Aura.cpp \
RGBController/RGBController_Corsair.cpp \
RGBController/RGBController_CorsairCmdrPro.cpp \
RGBController/RGBController_CorsairNodePro.cpp \
RGBController/RGBController_CorsairPro.cpp \
RGBController/RGBController_Hue2.cpp \
@@ -90,7 +89,8 @@ SOURCES += \
RGBController/RGBController_PatriotViper.cpp \
RGBController/RGBController_Polychrome.cpp \
RGBController/RGBController_PoseidonZRGB.cpp \
RGBController/RGBController_RGBFusion.cpp
RGBController/RGBController_RGBFusion.cpp \
RGBController/RGBController_RGBFusion2.cpp
HEADERS += \
qt/OpenRGBDeviceInfoPage.h \
@@ -106,7 +106,6 @@ HEADERS += \
Controllers/AMDWraithPrismController/AMDWraithPrismController.h \
Controllers/AuraController/AuraController.h \
Controllers/CorsairController/CorsairController.h \
Controllers/CorsairCmdrProController/CorsairCmdrProController.h \
Controllers/CorsairNodeProController/CorsairNodeProController.h \
Controllers/CorsairProController/CorsairProController.h \
Controllers/Hue2Controller/Hue2Controller.h \
@@ -118,11 +117,11 @@ HEADERS += \
Controllers/PolychromeController/PolychromeController.h \
Controllers/PoseidonZRGBController/PoseidonZRGBController.h \
Controllers/RGBFusionController/RGBFusionController.h \
Controllers/RGBFusion2Controller/RGBFusion2Controller.h \
RGBController/RGBController.h \
RGBController/RGBController_AMDWraithPrism.h \
RGBController/RGBController_Aura.h \
RGBController/RGBController_Corsair.h \
RGBController/RGBController_CorsairCmdrPro.h \
RGBController/RGBController_CorsairNodePro.h \
RGBController/RGBController_CorsairPro.h \
RGBController/RGBController_E131.h \
@@ -134,7 +133,8 @@ HEADERS += \
RGBController/RGBController_PatriotViper.h \
RGBController/RGBController_Polychrome.h \
RGBController/RGBController_PoseidonZRGB.h \
RGBController/RGBController_RGBFusion.h
RGBController/RGBController_RGBFusion.h \
RGBController/RGBController_RGBFusion2.h
RESOURCES += \
qt/resources.qrc
@@ -199,7 +199,6 @@ unix:INCLUDEPATH += \
unix:HEADERS += \
i2c_smbus/i2c_smbus_linux.h \
RGBController/RGBController_Faustus.h \
unix:LIBS += \
-lusb-1.0 \
@@ -219,5 +218,4 @@ unix:SOURCES += \
i2c_smbus/i2c_smbus_linux.cpp \
serial_port/find_usb_serial_port_linux.cpp \
RGBController/OpenRazerDetect.cpp \
RGBController/RGBController_Faustus.cpp \
RGBController/RGBController_OpenRazer.cpp \
+6 -14
View File
@@ -21,21 +21,13 @@ See the [Project Wiki](https://gitlab.com/CalcProgrammer1/OpenRGB/-/wikis/home)
**You must run the application as Administrator the first time to allow InpOut32 to set up. It can be run as a normal user afterwards**
#### Linux:
1. Either open the project using QT Creator or build it using qmake. You will need the libusb-1.0-0 (or equivalent) and libhidapi development packages from your distribution's package manager installed.
1. Either open the project using QT Creator or build it using qmake. You will need the libusb-1.0-0 (or equivalent) development package from your distribution's package manager installed.
* sudo apt install qt5-default libusb-1.0-0-dev libhidapi-dev
* git clone https://gitlab.com/CalcProgrammer1/OpenRGB
* cd OpenRGB
* git submodule update --init --recursive
* qmake OpenRGB.pro
* make -j8
* ./OpenRGB
git clone https://gitlab.com/CalcProgrammer1/OpenRGB
cd OpenRGB
git submodule update --init --recursive
qmake OpenRGB.pro
make
2. Allow access to SMBus:<br>
-12
View File
@@ -44,15 +44,3 @@ void RGBController::SetAllZoneLEDs(int zone, RGBColor color)
UpdateZoneLEDs(zone);
}
int RGBController::GetMode()
{
return(active_mode);
}
void RGBController::SetMode(int mode)
{
active_mode = mode;
UpdateMode();
}
+8 -57
View File
@@ -20,61 +20,16 @@ typedef unsigned int RGBColor;
#define ToRGBColor(r, g, b) ((b << 16) | (g << 8) | (r))
/*------------------------------------------------------------------*\
| Mode Flags |
\*------------------------------------------------------------------*/
enum
{
MODE_FLAG_HAS_SPEED = (1 << 0), /* Mode has speed parameter */
MODE_FLAG_HAS_DIRECTION_LR = (1 << 1), /* Mode has left/right parameter */
MODE_FLAG_HAS_DIRECTION_UD = (1 << 2), /* Mode has up/down parameter */
MODE_FLAG_HAS_DIRECTION_HV = (1 << 3), /* Mode has horiz/vert parameter */
MODE_FLAG_HAS_BRIGHTNESS = (1 << 4), /* Mode has brightness parameter */
MODE_FLAG_HAS_COLOR = (1 << 5), /* Mode has custom color parameter */
MODE_FLAG_RANDOM_COLOR = (1 << 6), /* Mode has random color option */
MODE_FLAG_PER_LED_COLOR = (1 << 7), /* Mode uses device LED colors */
};
/*------------------------------------------------------------------*\
| Mode Directions |
\*------------------------------------------------------------------*/
enum
{
MODE_DIRECTION_LEFT = 0, /* Mode direction left */
MODE_DIRECTION_RIGHT = 1, /* Mode direction right */
MODE_DIRECTION_UP = 2, /* Mode direction up */
MODE_DIRECTION_DOWN = 3, /* Mode direction down */
MODE_DIRECTION_HORIZONTAL = 4, /* Mode direction horizontal */
MODE_DIRECTION_VERTICAL = 5, /* Mode direction vertical */
};
/*------------------------------------------------------------------*\
| Mode Type |
\*------------------------------------------------------------------*/
typedef struct
{
/*--------------------------------------------------------------*\
| Mode Information |
\*--------------------------------------------------------------*/
std::string name; /* Mode name */
int value; /* Device-specific mode value */
unsigned int flags; /* Mode flags bitfield */
unsigned int speed_min; /* speed minimum value */
unsigned int speed_max; /* speed maximum value */
/*--------------------------------------------------------------*\
| Mode Settings |
\*--------------------------------------------------------------*/
unsigned int speed; /* Mode speed parameter value */
unsigned int direction; /* Mode direction value */
bool random; /* Random color mode enabled */
} mode;
typedef struct
{
std::string name; /* LED name */
} led;
typedef struct
{
std::string name; /* Mode name */
} mode;
typedef int zone_type;
enum
@@ -121,7 +76,6 @@ public:
std::vector<mode> modes; /* Modes */
std::vector<RGBColor> colors; /* Color buffer */
device_type type; /* device type */
int active_mode = 0;/* active mode */
virtual ~RGBController() = default;
@@ -133,16 +87,13 @@ public:
void SetAllLEDs(RGBColor color);
void SetAllZoneLEDs(int zone, RGBColor color);
int GetMode();
void SetMode(int mode);
/*---------------------------------------------------------*\
| Functions to be implemented in device implementation |
\*---------------------------------------------------------*/
virtual int GetMode() = 0;
virtual void SetMode(int mode) = 0;
virtual void SetCustomMode() = 0;
virtual void UpdateLEDs() = 0;
virtual void UpdateZoneLEDs(int zone) = 0;
virtual void UpdateSingleLED(int led) = 0;
virtual void SetCustomMode() = 0;
virtual void UpdateMode() = 0;
};
+18 -106
View File
@@ -17,72 +17,9 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
type = DEVICE_TYPE_COOLER;
version = wraith->GetFirmwareVersionString();
mode Static;
Static.name = "Static";
Static.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Static.random = false;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR | MODE_FLAG_RANDOM_COLOR;
Breathing.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Breathing.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Breathing.random = false;
Breathing.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Breathing);
mode ColorCycle;
ColorCycle.name = "Color Cycle";
ColorCycle.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE;
ColorCycle.flags = MODE_FLAG_HAS_SPEED;
ColorCycle.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
ColorCycle.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
ColorCycle.random = false;
ColorCycle.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(ColorCycle);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Rainbow.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Rainbow.random = false;
Rainbow.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Rainbow);
mode Bounce;
Bounce.name = "Bounce";
Bounce.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE;
Bounce.flags = MODE_FLAG_HAS_SPEED;
Bounce.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Bounce.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Bounce.random = true;
Bounce.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Bounce);
mode Chase;
Chase.name = "Chase";
Chase.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_CHASE;
Chase.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR | MODE_FLAG_RANDOM_COLOR;
Chase.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Chase.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Chase.random = false;
Chase.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Chase);
mode Swirl;
Swirl.name = "Swirl";
Swirl.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_SWIRL;
Swirl.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR | MODE_FLAG_RANDOM_COLOR;
Swirl.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST;
Swirl.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST;
Swirl.random = false;
Swirl.speed = AMD_WRAITH_PRISM_SPEED_NORMAL;
modes.push_back(Swirl);
mode led_mode;
led_mode.name = "Custom";
modes.push_back(led_mode);
led logo_led;
logo_led.name = "Logo";
@@ -129,6 +66,21 @@ RGBController_AMDWraithPrism::~RGBController_AMDWraithPrism()
}
int RGBController_AMDWraithPrism::GetMode()
{
return 0;
}
void RGBController_AMDWraithPrism::SetMode(int /*mode*/)
{
}
void RGBController_AMDWraithPrism::SetCustomMode()
{
}
void RGBController_AMDWraithPrism::UpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
@@ -172,43 +124,3 @@ void RGBController_AMDWraithPrism::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
void RGBController_AMDWraithPrism::SetCustomMode()
{
SetMode(0);
}
void RGBController_AMDWraithPrism::UpdateMode()
{
wraith->SetRingMode(modes[active_mode].value, modes[active_mode].speed, modes[active_mode].direction, modes[active_mode].random);
switch(modes[active_mode].value)
{
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE:
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW:
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE:
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].random);
break;
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING:
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, modes[active_mode].random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, modes[active_mode].random);
break;
default:
if(modes[active_mode].random)
{
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].random);
}
else
{
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, modes[active_mode].random);
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, modes[active_mode].random);
}
break;
}
UpdateLEDs();
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_AMDWraithPrism : public RGBController
public:
RGBController_AMDWraithPrism(AMDWraithPrismController* wraith_ptr);
~RGBController_AMDWraithPrism();
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
AMDWraithPrismController* wraith;
};
+15 -10
View File
@@ -20,6 +20,21 @@ static unsigned char data[] = { 0x8E, 0x00, 0x00, 0x00,
0x64, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00 };
int RGBController_AorusGPU::GetMode()
{
return(0);
}
void RGBController_AorusGPU::SetMode(int mode)
{
}
void RGBController_AorusGPU::SetCustomMode()
{
}
void RGBController_AorusGPU::UpdateLEDs()
{
RGBColor color = colors[0];
@@ -71,13 +86,3 @@ RGBController_AorusGPU::RGBController_AorusGPU()
aorus_zone.map.push_back(aorus_zone_map);
zones.push_back(aorus_zone);
}
void RGBController_AorusGPU::SetCustomMode()
{
}
void RGBController_AorusGPU::UpdateMode()
{
}
+3 -3
View File
@@ -19,13 +19,13 @@ class RGBController_AorusGPU : public RGBController
{
public:
RGBController_AorusGPU();
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
_GvWriteI2C GvWriteI2C;
_GvFreeDispLib GvFreeDispLib;
+41 -127
View File
@@ -9,44 +9,34 @@
#include "RGBController_Aura.h"
int RGBController_Aura::GetDeviceMode()
int RGBController_Aura::GetMode()
{
int dev_mode = aura->AuraRegisterRead(AURA_REG_MODE);
bool random = false;
switch(dev_mode)
{
case AURA_MODE_SPECTRUM_CYCLE_CHASE:
dev_mode = AURA_MODE_CHASE;
random = true;
break;
case AURA_MODE_SPECTRUM_CYCLE_BREATHING:
dev_mode = AURA_MODE_BREATHING;
random = true;
break;
case AURA_MODE_SPECTRUM_CYCLE_CHASE_FADE:
dev_mode = AURA_MODE_CHASE_FADE;
random = true;
break;
}
if (aura->AuraRegisterRead(AURA_REG_DIRECT))
{
dev_mode = 0xFFFF;
return(0);
}
for(int mode = 0; mode < modes.size(); mode++)
else
{
if(modes[mode].value == dev_mode)
{
active_mode = mode;
modes[mode].random = random;
}
return(aura->AuraRegisterRead(AURA_REG_MODE) + 1);
}
}
return(active_mode);
void RGBController_Aura::SetMode(int mode)
{
if (mode == 0)
{
aura->SetDirect(true);
}
else
{
aura->SetMode(mode - 1);
aura->SetDirect(false);
}
}
void RGBController_Aura::SetCustomMode()
{
aura->SetDirect(true);
}
void RGBController_Aura::UpdateLEDs()
@@ -128,65 +118,28 @@ RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
name = "ASUS Aura Motherboard";
}
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Direct);
mode aura_modes[AURA_NUMBER_MODES + 1];
mode Off;
Off.name = "Off";
Off.value = AURA_MODE_OFF;
Off.flags = 0;
modes.push_back(Off);
aura_modes[0].name = "Direct";
aura_modes[1].name = "Off";
aura_modes[2].name = "Static";
aura_modes[3].name = "Breathing";
aura_modes[4].name = "Flashing";
aura_modes[5].name = "Spectrum Cycle";
aura_modes[6].name = "Rainbow";
aura_modes[7].name = "Spectrum Cycle Breathing";
aura_modes[8].name = "Chase Fade";
aura_modes[9].name = "Spectrum Cycle Chase Fade";
aura_modes[10].name = "Chase";
aura_modes[11].name = "Spectrum Cycle Chase";
aura_modes[12].name = "Spectrum Cycle Wave";
aura_modes[13].name = "Chase Rainbow Pulse";
aura_modes[14].name = "Random Flicker";
mode Static;
Static.name = "Static";
Static.value = AURA_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Static);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = AURA_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Breathing);
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = AURA_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Flashing);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = AURA_MODE_SPECTRUM_CYCLE;
SpectrumCycle.flags = 0;
modes.push_back(SpectrumCycle);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = AURA_MODE_RAINBOW;
Rainbow.flags = 0;
modes.push_back(Rainbow);
mode ChaseFade;
ChaseFade.name = "Chase Fade";
ChaseFade.value = AURA_MODE_CHASE_FADE;
ChaseFade.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(ChaseFade);
mode Chase;
Chase.name = "Chase";
Chase.value = AURA_MODE_CHASE;
Chase.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Chase);
mode RandomFlicker;
RandomFlicker.name = "Random Flicker";
RandomFlicker.value = AURA_MODE_RANDOM_FLICKER;
RandomFlicker.flags = 0;
modes.push_back(RandomFlicker);
for (std::size_t i = 0; i < (AURA_NUMBER_MODES + 1); i++)
{
modes.push_back(aura_modes[i]);
}
colors.resize(aura->GetLEDCount());
@@ -252,43 +205,4 @@ RGBController_Aura::RGBController_Aura(AuraController * aura_ptr)
zones.push_back(*new_zone);
}
}
// Initialize active mode
active_mode = GetDeviceMode();
}
void RGBController_Aura::SetCustomMode()
{
SetMode(0);
}
void RGBController_Aura::UpdateMode()
{
if (modes[active_mode].value == 0xFFFF)
{
aura->SetDirect(true);
}
else
{
int new_mode = modes[active_mode].value;
if(modes[active_mode].random == true)
{
switch(new_mode)
{
case AURA_MODE_CHASE:
new_mode = AURA_MODE_SPECTRUM_CYCLE_CHASE;
break;
case AURA_MODE_BREATHING:
new_mode = AURA_MODE_SPECTRUM_CYCLE_BREATHING;
break;
case AURA_MODE_CHASE_FADE:
new_mode = AURA_MODE_SPECTRUM_CYCLE_CHASE_FADE;
break;
}
}
aura->SetMode(new_mode);
aura->SetDirect(false);
}
}
+3 -5
View File
@@ -16,15 +16,13 @@ class RGBController_Aura : public RGBController
{
public:
RGBController_Aura(AuraController* aura_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
AuraController* aura;
int GetDeviceMode();
};
+23 -25
View File
@@ -9,6 +9,21 @@
#include "RGBController_Corsair.h"
int RGBController_Corsair::GetMode()
{
return(CORSAIR_VENGEANCE_RGB_MODE_SINGLE);
}
void RGBController_Corsair::SetMode(int mode)
{
corsair->SetMode(mode);
}
void RGBController_Corsair::SetCustomMode()
{
}
void RGBController_Corsair::UpdateLEDs()
{
RGBColor color = colors[0];
@@ -38,23 +53,16 @@ RGBController_Corsair::RGBController_Corsair(CorsairController* corsair_ptr)
type = DEVICE_TYPE_DRAM;
mode Static;
Static.name = "Static";
Static.value = CORSAIR_VENGEANCE_RGB_MODE_SINGLE;
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Static);
mode corsair_modes[CORSAIR_NUMBER_MODES];
mode Fade;
Fade.name = "Fade";
Fade.value = CORSAIR_VENGEANCE_RGB_MODE_FADE;
Fade.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Fade);
corsair_modes[0].name = "Static";
corsair_modes[1].name = "Fade";
corsair_modes[2].name = "Pulse";
mode Pulse;
Pulse.name = "Pulse";
Pulse.value = CORSAIR_VENGEANCE_RGB_MODE_PULSE;
Pulse.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Pulse);
for (int i = 0; i < CORSAIR_NUMBER_MODES; i++)
{
modes.push_back(corsair_modes[i]);
}
for (unsigned int i = 0; i < corsair->GetLEDCount(); i++)
{
@@ -82,13 +90,3 @@ RGBController_Corsair::RGBController_Corsair(CorsairController* corsair_ptr)
zones.push_back(new_zone);
}
void RGBController_Corsair::SetCustomMode()
{
SetMode(0);
}
void RGBController_Corsair::UpdateMode()
{
corsair->SetMode(modes[active_mode].value);
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_Corsair : public RGBController
{
public:
RGBController_Corsair(CorsairController* corsair_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
CorsairController* corsair;
};
@@ -1,276 +0,0 @@
/*-----------------------------------------*\
| RGBController_CorsairCmdrPro.cpp |
| |
| Generic RGB Interface for Corsair |
| Commander Pro |
| |
| Adam Honse (CalcProgrammer1) 1/16/2020 |
\*-----------------------------------------*/
#include "RGBController_CorsairCmdrPro.h"
RGBController_CorsairCmdrPro::RGBController_CorsairCmdrPro(CorsairCmdrProController* corsair_ptr)
{
corsair = corsair_ptr;
name = "Corsair Commander Pro";
type = DEVICE_TYPE_LEDSTRIP;
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Direct);
mode RainbowWave;
RainbowWave.name = "Rainbow Wave";
RainbowWave.value = CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE;
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
RainbowWave.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
RainbowWave.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
RainbowWave.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
RainbowWave.direction = MODE_DIRECTION_RIGHT;
modes.push_back(RainbowWave);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT;
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorShift.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorShift.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorShift.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(ColorShift);
mode ColorPulse;
ColorPulse.name = "Color Pulse";
ColorPulse.value = CORSAIR_CMDR_PRO_MODE_COLOR_PULSE;
ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorPulse.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorPulse.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorPulse.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(ColorPulse);
mode ColorWave;
ColorWave.name = "Color Wave";
ColorWave.value = CORSAIR_CMDR_PRO_MODE_COLOR_WAVE;
ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorWave.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorWave.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorWave.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
ColorWave.direction = MODE_DIRECTION_RIGHT;
modes.push_back(ColorWave);
mode Static;
Static.name = "Static";
Static.value = CORSAIR_CMDR_PRO_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Static);
mode Temperature;
Temperature.name = "Temperature";
Temperature.value = CORSAIR_CMDR_PRO_MODE_TEMPERATURE;
Temperature.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Temperature);
mode Visor;
Visor.name = "Visor";
Visor.value = CORSAIR_CMDR_PRO_MODE_VISOR;
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Visor.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Visor.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Visor.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(Visor);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = CORSAIR_CMDR_PRO_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Marquee.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Marquee.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Marquee.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Marquee.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Marquee);
mode Blink;
Blink.name = "Blink";
Blink.value = CORSAIR_CMDR_PRO_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Blink.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Blink.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Blink.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(Blink);
mode Sequential;
Sequential.name = "Sequential";
Sequential.value = CORSAIR_CMDR_PRO_MODE_SEQUENTIAL;
Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Sequential.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Sequential.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Sequential.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Sequential.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Sequential);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CORSAIR_CMDR_PRO_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Rainbow.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Rainbow.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(Rainbow);
/*-------------------------------------------------*\
| Set size of colors array |
\*-------------------------------------------------*/
unsigned int led_count = 0;
for (unsigned int channel_idx = 0; channel_idx < CORSAIR_CMDR_PRO_NUM_CHANNELS; channel_idx++)
{
led_count += corsair->channel_leds[channel_idx];
}
colors.resize(led_count);
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
unsigned int led_idx = 0;
for (unsigned int channel_idx = 0; channel_idx < CORSAIR_CMDR_PRO_NUM_CHANNELS; channel_idx++)
{
if(corsair->channel_leds[channel_idx] > 0)
{
zone* new_zone = new zone;
char ch_idx_string[2];
sprintf(ch_idx_string, "%d", channel_idx + 1);
new_zone->name = "Corsair Channel ";
new_zone->name.append(ch_idx_string);
new_zone->type = ZONE_TYPE_LINEAR;
std::vector<int> *new_zone_map = new std::vector<int>();
for (unsigned int led_ch_idx = 0; led_ch_idx < corsair->channel_leds[channel_idx]; led_ch_idx++)
{
char led_idx_string[3];
sprintf(led_idx_string, "%d", led_ch_idx + 1);
led new_led;
new_led.name = "Corsair Channel ";
new_led.name.append(ch_idx_string);
new_led.name.append(", LED ");
new_led.name.append(led_idx_string);
leds.push_back(new_led);
leds_channel.push_back(channel_idx);
new_zone_map->push_back(led_idx);
led_idx++;
}
new_zone->map.push_back(*new_zone_map);
zones.push_back(*new_zone);
zones_channel.push_back(channel_idx);
}
}
}
void RGBController_CorsairCmdrPro::UpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
corsair->SetChannelLEDs(channel, channel_colors);
}
}
}
void RGBController_CorsairCmdrPro::UpdateZoneLEDs(int zone)
{
unsigned int channel = zones_channel[zone];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
corsair->SetChannelLEDs(channel, channel_colors);
}
}
void RGBController_CorsairCmdrPro::UpdateSingleLED(int led)
{
unsigned int channel = leds_channel[led];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
corsair->SetChannelLEDs(channel, channel_colors);
}
}
void RGBController_CorsairCmdrPro::SetCustomMode()
{
SetMode(9);
}
void RGBController_CorsairCmdrPro::UpdateMode()
{
if(modes[active_mode].value == 0xFFFF)
{
UpdateLEDs();
}
else
{
for(int channel = 0; channel < CORSAIR_CMDR_PRO_NUM_CHANNELS; channel++)
{
unsigned int direction = 0;
if(modes[active_mode].direction == MODE_DIRECTION_RIGHT)
{
direction = 1;
}
corsair->SetChannelEffect(channel,
modes[active_mode].value,
modes[active_mode].speed,
direction,
modes[active_mode].random,
RGBGetRValue(colors[0]),
RGBGetGValue(colors[0]),
RGBGetBValue(colors[0]),
RGBGetRValue(colors[1]),
RGBGetGValue(colors[1]),
RGBGetBValue(colors[1]));
}
}
}
@@ -1,30 +0,0 @@
/*-----------------------------------------*\
| RGBController_CorsairCmdrPro.h |
| |
| Generic RGB Interface for Corsair |
| Commander Pro |
| |
| Adam Honse (CalcProgrammer1) 1/16/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "serial_port.h"
#include "CorsairCmdrProController.h"
class RGBController_CorsairCmdrPro : public RGBController
{
public:
RGBController_CorsairCmdrPro(CorsairCmdrProController* corsair_ptr);
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
CorsairCmdrProController* corsair;
std::vector<unsigned int> leds_channel;
std::vector<unsigned int> zones_channel;
};
+21 -141
View File
@@ -17,110 +17,11 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
name = "Corsair Lighting Node Pro";
type = DEVICE_TYPE_LEDSTRIP;
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Direct);
mode RainbowWave;
RainbowWave.name = "Rainbow Wave";
RainbowWave.value = CORSAIR_CMDR_PRO_MODE_RAINBOW_WAVE;
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
RainbowWave.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
RainbowWave.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
RainbowWave.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
RainbowWave.direction = MODE_DIRECTION_RIGHT;
modes.push_back(RainbowWave);
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = CORSAIR_CMDR_PRO_MODE_COLOR_SHIFT;
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorShift.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorShift.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorShift.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(ColorShift);
mode ColorPulse;
ColorPulse.name = "Color Pulse";
ColorPulse.value = CORSAIR_CMDR_PRO_MODE_COLOR_PULSE;
ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorPulse.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorPulse.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorPulse.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(ColorPulse);
mode ColorWave;
ColorWave.name = "Color Wave";
ColorWave.value = CORSAIR_CMDR_PRO_MODE_COLOR_WAVE;
ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorWave.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
ColorWave.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
ColorWave.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
ColorWave.direction = MODE_DIRECTION_RIGHT;
modes.push_back(ColorWave);
mode Static;
Static.name = "Static";
Static.value = CORSAIR_CMDR_PRO_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Static);
mode Temperature;
Temperature.name = "Temperature";
Temperature.value = CORSAIR_CMDR_PRO_MODE_TEMPERATURE;
Temperature.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Temperature);
mode Visor;
Visor.name = "Visor";
Visor.value = CORSAIR_CMDR_PRO_MODE_VISOR;
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Visor.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Visor.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Visor.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(Visor);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = CORSAIR_CMDR_PRO_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Marquee.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Marquee.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Marquee.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Marquee.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Marquee);
mode Blink;
Blink.name = "Blink";
Blink.value = CORSAIR_CMDR_PRO_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Blink.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Blink.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Blink.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(Blink);
mode Sequential;
Sequential.name = "Sequential";
Sequential.value = CORSAIR_CMDR_PRO_MODE_SEQUENTIAL;
Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Sequential.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Sequential.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Sequential.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
Sequential.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Sequential);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CORSAIR_CMDR_PRO_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = CORSAIR_CMDR_PRO_SPEED_SLOW;
Rainbow.speed_max = CORSAIR_CMDR_PRO_SPEED_FAST;
Rainbow.speed = CORSAIR_CMDR_PRO_SPEED_MEDIUM;
modes.push_back(Rainbow);
mode led_mode;
led_mode.name = "Custom";
modes.push_back(led_mode);
/*-------------------------------------------------*\
| Set size of colors array |
\*-------------------------------------------------*/
@@ -175,6 +76,21 @@ RGBController_CorsairNodePro::RGBController_CorsairNodePro(CorsairNodeProControl
}
}
int RGBController_CorsairNodePro::GetMode()
{
return 0;
}
void RGBController_CorsairNodePro::SetMode(int /*mode*/)
{
}
void RGBController_CorsairNodePro::SetCustomMode()
{
}
void RGBController_CorsairNodePro::UpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
@@ -214,8 +130,9 @@ void RGBController_CorsairNodePro::UpdateZoneLEDs(int zone)
if(channel_colors.size() > 0)
{
corsair->SetChannelLEDs(channel, channel_colors);
//corsair->SetChannelLEDs(channel, channel_colors);
}
corsair->SendKeepalive();
}
void RGBController_CorsairNodePro::UpdateSingleLED(int led)
@@ -237,40 +154,3 @@ void RGBController_CorsairNodePro::UpdateSingleLED(int led)
corsair->SetChannelLEDs(channel, channel_colors);
}
}
void RGBController_CorsairNodePro::SetCustomMode()
{
SetMode(9);
}
void RGBController_CorsairNodePro::UpdateMode()
{
if(modes[active_mode].value == 0xFFFF)
{
UpdateLEDs();
}
else
{
for(int channel = 0; channel < CORSAIR_CMDR_PRO_NUM_CHANNELS; channel++)
{
unsigned int direction = 0;
if(modes[active_mode].direction == MODE_DIRECTION_RIGHT)
{
direction = 1;
}
corsair->SetChannelEffect(channel,
modes[active_mode].value,
modes[active_mode].speed,
direction,
modes[active_mode].random,
RGBGetRValue(colors[0]),
RGBGetGValue(colors[0]),
RGBGetBValue(colors[0]),
RGBGetRValue(colors[1]),
RGBGetGValue(colors[1]),
RGBGetBValue(colors[1]));
}
}
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_CorsairNodePro : public RGBController
{
public:
RGBController_CorsairNodePro(CorsairNodeProController* corsair_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
CorsairNodeProController* corsair;
std::vector<unsigned int> leds_channel;
+96 -147
View File
@@ -9,6 +9,87 @@
#include "RGBController_CorsairPro.h"
int RGBController_CorsairPro::GetMode()
{
switch (corsair->GetEffect())
{
case CORSAIR_PRO_MODE_COLOR_SHIFT:
return(0);
break;
case CORSAIR_PRO_MODE_COLOR_PULSE:
return(1);
break;
case CORSAIR_PRO_MODE_RAINBOW_WAVE:
return(2);
break;
case CORSAIR_PRO_MODE_COLOR_WAVE:
return(3);
break;
case CORSAIR_PRO_MODE_VISOR:
return(4);
break;
case CORSAIR_PRO_MODE_RAIN:
return(5);
break;
case CORSAIR_PRO_MODE_MARQUEE:
return(6);
break;
case CORSAIR_PRO_MODE_RAINBOW:
return(7);
break;
case CORSAIR_PRO_MODE_SEQUENTIAL:
return(8);
break;
case CORSAIR_PRO_MODE_STATIC:
return(9);
break;
}
return(0);
}
void RGBController_CorsairPro::SetMode(int mode)
{
switch (mode)
{
case 0:
corsair->SetEffect(CORSAIR_PRO_MODE_COLOR_SHIFT);
break;
case 1:
corsair->SetEffect(CORSAIR_PRO_MODE_COLOR_PULSE);
break;
case 2:
corsair->SetEffect(CORSAIR_PRO_MODE_RAINBOW_WAVE);
break;
case 3:
corsair->SetEffect(CORSAIR_PRO_MODE_COLOR_WAVE);
break;
case 4:
corsair->SetEffect(CORSAIR_PRO_MODE_VISOR);
break;
case 5:
corsair->SetEffect(CORSAIR_PRO_MODE_RAIN);
break;
case 6:
corsair->SetEffect(CORSAIR_PRO_MODE_MARQUEE);
break;
case 7:
corsair->SetEffect(CORSAIR_PRO_MODE_RAINBOW);
break;
case 8:
corsair->SetEffect(CORSAIR_PRO_MODE_SEQUENTIAL);
break;
case 9:
corsair->SetEffect(CORSAIR_PRO_MODE_STATIC);
break;
}
}
void RGBController_CorsairPro::SetCustomMode()
{
corsair->SetCustom();
}
void RGBController_CorsairPro::UpdateLEDs()
{
for (std::size_t led = 0; led < colors.size(); led++)
@@ -48,112 +129,23 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
type = DEVICE_TYPE_DRAM;
mode ColorShift;
ColorShift.name = "Color Shift";
ColorShift.value = CORSAIR_PRO_MODE_COLOR_SHIFT;
ColorShift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorShift.speed_min = CORSAIR_PRO_SPEED_SLOW;
ColorShift.speed_max = CORSAIR_PRO_SPEED_FAST;
ColorShift.random = false;
ColorShift.speed = CORSAIR_PRO_SPEED_SLOW;
modes.push_back(ColorShift);
mode corsair_modes[CORSAIR_PRO_NUMBER_MODES];
mode ColorPulse;
ColorPulse.name = "Color Pulse";
ColorPulse.value = CORSAIR_PRO_MODE_COLOR_PULSE;
ColorPulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorPulse.speed_min = CORSAIR_PRO_SPEED_SLOW;
ColorPulse.speed_max = CORSAIR_PRO_SPEED_FAST;
ColorPulse.random = false;
ColorPulse.speed = CORSAIR_PRO_SPEED_SLOW;
modes.push_back(ColorPulse);
corsair_modes[0].name = "Color Shift";
corsair_modes[1].name = "Color Pulse";
corsair_modes[2].name = "Rainbow Wave";
corsair_modes[3].name = "Color Wave";
corsair_modes[4].name = "Visor";
corsair_modes[5].name = "Rain";
corsair_modes[6].name = "Marquee";
corsair_modes[7].name = "Rainbow";
corsair_modes[8].name = "Sequential";
corsair_modes[9].name = "Static";
mode RainbowWave;
RainbowWave.name = "Rainbow Wave";
RainbowWave.value = CORSAIR_PRO_MODE_RAINBOW_WAVE;
RainbowWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD;
RainbowWave.speed_min = CORSAIR_PRO_SPEED_SLOW;
RainbowWave.speed_max = CORSAIR_PRO_SPEED_FAST;
RainbowWave.random = false;
RainbowWave.speed = CORSAIR_PRO_SPEED_SLOW;
RainbowWave.direction = MODE_DIRECTION_DOWN;
modes.push_back(RainbowWave);
mode ColorWave;
ColorWave.name = "Color Wave";
ColorWave.value = CORSAIR_PRO_MODE_COLOR_WAVE;
ColorWave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
ColorWave.speed_min = CORSAIR_PRO_SPEED_SLOW;
ColorWave.speed_max = CORSAIR_PRO_SPEED_FAST;
ColorWave.random = false;
ColorWave.speed = CORSAIR_PRO_SPEED_SLOW;
ColorWave.direction = MODE_DIRECTION_DOWN;
modes.push_back(ColorWave);
mode Visor;
Visor.name = "Visor";
Visor.value = CORSAIR_PRO_MODE_VISOR;
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_HV | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Visor.speed_min = CORSAIR_PRO_SPEED_SLOW;
Visor.speed_max = CORSAIR_PRO_SPEED_FAST;
Visor.random = false;
Visor.speed = CORSAIR_PRO_SPEED_SLOW;
Visor.direction = MODE_DIRECTION_VERTICAL;
modes.push_back(Visor);
mode Rain;
Rain.name = "Rain";
Rain.value = CORSAIR_PRO_MODE_RAIN;
Rain.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Rain.speed_min = CORSAIR_PRO_SPEED_SLOW;
Rain.speed_max = CORSAIR_PRO_SPEED_FAST;
Rain.random = false;
Rain.speed = CORSAIR_PRO_SPEED_SLOW;
Rain.direction = MODE_DIRECTION_DOWN;
modes.push_back(Rain);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = CORSAIR_PRO_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
Marquee.speed_min = CORSAIR_PRO_SPEED_SLOW;
Marquee.speed_max = CORSAIR_PRO_SPEED_FAST;
Marquee.random = false;
Marquee.speed = CORSAIR_PRO_SPEED_SLOW;
modes.push_back(Marquee);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = CORSAIR_PRO_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = CORSAIR_PRO_SPEED_SLOW;
Rainbow.speed_max = CORSAIR_PRO_SPEED_FAST;
Rainbow.random = false;
Rainbow.speed = CORSAIR_PRO_SPEED_SLOW;
modes.push_back(Rainbow);
mode Sequential;
Sequential.name = "Sequential";
Sequential.value = CORSAIR_PRO_MODE_SEQUENTIAL;
Sequential.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_UD | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Sequential.speed_min = CORSAIR_PRO_SPEED_SLOW;
Sequential.speed_max = CORSAIR_PRO_SPEED_FAST;
Sequential.random = false;
Sequential.speed = CORSAIR_PRO_SPEED_SLOW;
Sequential.direction = MODE_DIRECTION_DOWN;
modes.push_back(Sequential);
mode Static;
Static.name = "Static";
Static.value = CORSAIR_PRO_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Static.speed_min = 0;
Static.speed_max = 0;
Static.random = false;
Static.speed = 0;
modes.push_back(Static);
active_mode = 9;
for (int i = 0; i < CORSAIR_PRO_NUMBER_MODES; i++)
{
modes.push_back(corsair_modes[i]);
}
colors.resize(corsair->GetLEDCount());
@@ -182,46 +174,3 @@ RGBController_CorsairPro::RGBController_CorsairPro(CorsairProController* corsair
zones.push_back(new_zone);
}
void RGBController_CorsairPro::SetCustomMode()
{
SetMode(9);
}
void RGBController_CorsairPro::UpdateMode()
{
unsigned int corsair_direction;
switch(modes[active_mode].direction)
{
case MODE_DIRECTION_LEFT:
corsair_direction = CORSAIR_PRO_DIRECTION_LEFT;
break;
case MODE_DIRECTION_RIGHT:
corsair_direction = CORSAIR_PRO_DIRECTION_RIGHT;
break;
case MODE_DIRECTION_UP:
corsair_direction = CORSAIR_PRO_DIRECTION_UP;
break;
case MODE_DIRECTION_DOWN:
corsair_direction = CORSAIR_PRO_DIRECTION_DOWN;
break;
case MODE_DIRECTION_HORIZONTAL:
corsair_direction = CORSAIR_PRO_DIRECTION_HORIZONTAL;
break;
case MODE_DIRECTION_VERTICAL:
corsair_direction = CORSAIR_PRO_DIRECTION_VERTICAL;
break;
}
corsair->SetEffect(modes[active_mode].value,
modes[active_mode].speed,
corsair_direction,
modes[active_mode].random,
RGBGetRValue(colors[0]),
RGBGetGValue(colors[0]),
RGBGetBValue(colors[0]),
RGBGetRValue(colors[1]),
RGBGetGValue(colors[1]),
RGBGetBValue(colors[1]));
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_CorsairPro : public RGBController
{
public:
RGBController_CorsairPro(CorsairProController* corsair_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
CorsairProController* corsair;
};
+15 -10
View File
@@ -86,6 +86,21 @@ RGBController_E131::RGBController_E131(std::vector<E131Device> device_list)
}
}
int RGBController_E131::GetMode()
{
return 0;
}
void RGBController_E131::SetMode(int /*mode*/)
{
}
void RGBController_E131::SetCustomMode()
{
}
void RGBController_E131::UpdateLEDs()
{
int color_idx = 0;
@@ -156,13 +171,3 @@ void RGBController_E131::UpdateSingleLED(int led)
{
UpdateLEDs();
}
void RGBController_E131::SetCustomMode()
{
}
void RGBController_E131::UpdateMode()
{
}
+3 -3
View File
@@ -37,13 +37,13 @@ class RGBController_E131 : public RGBController
{
public:
RGBController_E131(std::vector<E131Device> device_list);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
std::vector<E131Device> devices;
std::vector<e131_packet_t> packets;
-150
View File
@@ -1,150 +0,0 @@
#include "RGBController_Faustus.h"
#include <dirent.h>
#include <string.h>
RGBController_Faustus::RGBController_Faustus(const std::string& dev_path)
{
name = "Faustus";
description = "ASUS TUF Keyboard Backlight";
type = DEVICE_TYPE_KEYBOARD;
modes.resize(4);
modes[0].name = "Static";
modes[0].value = FAUSTUS_MODE_STATIC;
modes[0].flags = MODE_FLAG_HAS_COLOR;
modes[0].random = false;
modes[1].name = "Breathing";
modes[1].value = FAUSTUS_MODE_BREATHING;
modes[1].flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR;
modes[1].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[1].speed_max = FAUSTUS_SPEED_FASTEST;
modes[1].random = false;
modes[1].speed = FAUSTUS_SPEED_NORMAL;
modes[2].name = "Color Cycle";
modes[2].value = FAUSTUS_MODE_COLOR_CYCLE;
modes[2].flags = MODE_FLAG_HAS_SPEED;
modes[2].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[2].speed_max = FAUSTUS_SPEED_FASTEST;
modes[2].random = false;
modes[2].speed = FAUSTUS_SPEED_NORMAL;
modes[3].name = "Strobe";
modes[3].value = FAUSTUS_MODE_STROBE;
modes[3].flags = MODE_FLAG_HAS_SPEED;
modes[3].speed_min = FAUSTUS_SPEED_SLOWEST;
modes[3].speed_max = FAUSTUS_SPEED_FASTEST;
modes[3].random = false;
modes[3].speed = FAUSTUS_SPEED_NORMAL;
colors.resize(1);
leds.resize(1);
leds[0].name = "Keyboard backlight LED";
zones.resize(1);
zones[0].type = ZONE_TYPE_SINGLE;
zones[0].name = "Keyboard backlight zone";
zones[0].map.push_back(std::vector<int>(1, 0));
// Prepare file streams
r_path = dev_path;
g_path = dev_path;
b_path = dev_path;
mode_path = dev_path;
flags_path = dev_path;
set_path = dev_path;
r_path.append("/kbbl_red");
g_path.append("/kbbl_green");
b_path.append("/kbbl_blue");
mode_path.append("/kbbl_mode");
flags_path.append("/kbbl_flags");
set_path.append("/kbbl_set");
}
void RGBController_Faustus::UpdateLEDs()
{
int rv = uint8_t(RGBGetRValue(colors[0]));
int gv = uint8_t(RGBGetGValue(colors[0]));
int bv = uint8_t(RGBGetBValue(colors[0]));
std::ofstream str_r;
std::ofstream str_g;
std::ofstream str_b;
std::ofstream str_mode;
std::ofstream str_flags;
std::ofstream str_set;
str_r.open(r_path, std::ios::out | std::ios::trunc);
str_g.open(g_path, std::ios::out | std::ios::trunc);
str_b.open(b_path, std::ios::out | std::ios::trunc);
str_mode.open(mode_path, std::ios::out | std::ios::trunc);
str_flags.open(flags_path, std::ios::out | std::ios::trunc);
str_set.open(set_path, std::ios::out | std::ios::trunc);
str_r << std::hex;
str_g << std::hex;
str_b << std::hex;
str_mode << std::hex;
str_flags << std::hex;
str_set << std::hex;
str_r << rv;
str_g << gv;
str_b << bv;
str_mode << active_mode;
str_flags << 0x2a; // All of em
str_set << 2;
// Flush everything
str_r.close();
str_g.close();
str_b.close();
str_mode.close();
str_flags.close();
str_set.close();
}
void RGBController_Faustus::UpdateZoneLEDs(int zone)
{
UpdateLEDs();
}
void RGBController_Faustus::UpdateSingleLED(int led)
{
UpdateLEDs();
}
void RGBController_Faustus::SetCustomMode()
{
SetMode(0);
}
void RGBController_Faustus::UpdateMode()
{
UpdateLEDs();
}
void DetectFaustusControllers(std::vector<RGBController*> &rgb_controllers)
{
const char* base_path = "/sys/devices/platform/faustus/kbbl";
DIR* dir = opendir(base_path);
if(!dir) return;
// Directory is present - we pretty much have a driver confirmation already, but double check for all files required just in case
struct dirent* dent = readdir(dir);
if(!dent) return;
int found = 0;
while(dent)
{
const char* fname = dent->d_name;
if(!strcmp(fname, "kbbl_red") || !strcmp(fname, "kbbl_green") || !strcmp(fname, "kbbl_blue") || !strcmp(fname, "kbbl_mode") || !strcmp(fname, "kbbl_flags") || !strcmp(fname, "kbbl_set"))
{
++found;
}
dent = readdir(dir);
}
closedir(dir);
if(found != 6) return;
rgb_controllers.push_back(new RGBController_Faustus(base_path));
}
-41
View File
@@ -1,41 +0,0 @@
#ifndef RGBCONTROLLER_FAUSTUS_H
#define RGBCONTROLLER_FAUSTUS_H
#include "RGBController.h"
#include <fstream>
enum
{
FAUSTUS_MODE_STATIC = 0,
FAUSTUS_MODE_BREATHING = 1,
FAUSTUS_MODE_COLOR_CYCLE = 2,
FAUSTUS_MODE_STROBE = 3
};
enum
{
FAUSTUS_SPEED_SLOWEST = 0,
FAUSTUS_SPEED_NORMAL = 1,
FAUSTUS_SPEED_FASTEST = 2,
};
class RGBController_Faustus : public RGBController
{
private:
std::string r_path;
std::string g_path;
std::string b_path;
std::string mode_path;
std::string flags_path;
std::string set_path;
public:
RGBController_Faustus(const std::string& dev_path);
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
};
#endif // RGBCONTROLLER_FAUSTUS_H
+18 -108
View File
@@ -17,78 +17,9 @@ RGBController_Hue2::RGBController_Hue2(Hue2Controller* hue2_ptr)
type = DEVICE_TYPE_LEDSTRIP;
mode Direct;
Direct.name = "Direct";
Direct.value = HUE_2_MODE_FIXED;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Direct);
mode Fading;
Fading.name = "Fading";
Fading.value = HUE_2_MODE_FADING;
Fading.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Fading.speed_min = HUE_2_SPEED_SLOWEST;
Fading.speed_max = HUE_2_SPEED_FASTEST;
Fading.speed = HUE_2_SPEED_NORMAL;
modes.push_back(Fading);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = HUE_2_MODE_SPECTRUM;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
SpectrumCycle.speed_min = HUE_2_SPEED_SLOWEST;
SpectrumCycle.speed_max = HUE_2_SPEED_FASTEST;
SpectrumCycle.speed = HUE_2_SPEED_NORMAL;
SpectrumCycle.direction = MODE_DIRECTION_RIGHT;
modes.push_back(SpectrumCycle);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = HUE_2_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Marquee.speed_min = HUE_2_SPEED_SLOWEST;
Marquee.speed_max = HUE_2_SPEED_FASTEST;
Marquee.speed = HUE_2_SPEED_NORMAL;
Marquee.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Marquee);
mode CoverMarquee;
CoverMarquee.name = "Cover Marquee";
CoverMarquee.value = HUE_2_MODE_COVER_MARQUEE;
CoverMarquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
CoverMarquee.speed_min = HUE_2_SPEED_SLOWEST;
CoverMarquee.speed_max = HUE_2_SPEED_FASTEST;
CoverMarquee.speed = HUE_2_SPEED_NORMAL;
CoverMarquee.direction = MODE_DIRECTION_RIGHT;
modes.push_back(CoverMarquee);
mode Alternating;
Alternating.name = "Alternating";
Alternating.value = HUE_2_MODE_ALTERNATING;
Alternating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Alternating.speed_min = HUE_2_SPEED_SLOWEST;
Alternating.speed_max = HUE_2_SPEED_FASTEST;
Alternating.speed = HUE_2_SPEED_NORMAL;
Alternating.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Alternating);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = HUE_2_MODE_PULSING;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Pulsing.speed_min = HUE_2_SPEED_SLOWEST;
Pulsing.speed_max = HUE_2_SPEED_FASTEST;
Pulsing.speed = HUE_2_SPEED_NORMAL;
modes.push_back(Pulsing);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HUE_2_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Breathing.speed_min = HUE_2_SPEED_SLOWEST;
Breathing.speed_max = HUE_2_SPEED_FASTEST;
Breathing.speed = HUE_2_SPEED_NORMAL;
modes.push_back(Breathing);
mode led_mode;
led_mode.name = "Custom";
modes.push_back(led_mode);
/*-------------------------------------------------*\
| Set size of colors array |
@@ -144,6 +75,21 @@ RGBController_Hue2::RGBController_Hue2(Hue2Controller* hue2_ptr)
}
}
int RGBController_Hue2::GetMode()
{
return 0;
}
void RGBController_Hue2::SetMode(int /*mode*/)
{
}
void RGBController_Hue2::SetCustomMode()
{
}
void RGBController_Hue2::UpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
@@ -206,39 +152,3 @@ void RGBController_Hue2::UpdateSingleLED(int led)
hue2->SetChannelLEDs(channel, channel_colors);
}
}
void RGBController_Hue2::SetCustomMode()
{
SetMode(0);
}
void RGBController_Hue2::UpdateMode()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
bool direction = false;
if(modes[active_mode].direction == MODE_DIRECTION_LEFT)
{
direction = true;
}
hue2->SetMode(modes[active_mode].value, modes[active_mode].speed, direction);
hue2->SetChannelLEDs(channel, channel_colors);
}
}
}
+3 -3
View File
@@ -15,13 +15,13 @@ class RGBController_Hue2 : public RGBController
{
public:
RGBController_Hue2(Hue2Controller* hue2_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
Hue2Controller* hue2;
std::vector<unsigned int> leds_channel;
+19 -141
View File
@@ -17,112 +17,11 @@ RGBController_HuePlus::RGBController_HuePlus(HuePlusController* hueplus_ptr)
type = DEVICE_TYPE_LEDSTRIP;
location = hueplus->GetLocation();
location = hueplus->GetLEDString();
mode Direct;
Direct.name = "Direct";
Direct.value = HUE_PLUS_MODE_FIXED;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Direct);
// Fading mode is currently disabled because it doesn't appear to work
// mode Fading;
// Fading.name = "Fading";
// Fading.value = HUE_PLUS_MODE_FADING;
// Fading.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
// Fading.speed_min = HUE_PLUS_SPEED_SLOWEST;
// Fading.speed_max = HUE_PLUS_SPEED_FASTEST;
// Fading.speed = HUE_PLUS_SPEED_NORMAL;
// modes.push_back(Fading);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = HUE_PLUS_MODE_SPECTRUM;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR;
SpectrumCycle.speed_min = HUE_PLUS_SPEED_SLOWEST;
SpectrumCycle.speed_max = HUE_PLUS_SPEED_FASTEST;
SpectrumCycle.speed = HUE_PLUS_SPEED_NORMAL;
SpectrumCycle.direction = MODE_DIRECTION_RIGHT;
modes.push_back(SpectrumCycle);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = HUE_PLUS_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Marquee.speed_min = HUE_PLUS_SPEED_SLOWEST;
Marquee.speed_max = HUE_PLUS_SPEED_FASTEST;
Marquee.speed = HUE_PLUS_SPEED_NORMAL;
Marquee.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Marquee);
mode CoverMarquee;
CoverMarquee.name = "Cover Marquee";
CoverMarquee.value = HUE_PLUS_MODE_COVER_MARQUEE;
CoverMarquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
CoverMarquee.speed_min = HUE_PLUS_SPEED_SLOWEST;
CoverMarquee.speed_max = HUE_PLUS_SPEED_FASTEST;
CoverMarquee.speed = HUE_PLUS_SPEED_NORMAL;
CoverMarquee.direction = MODE_DIRECTION_RIGHT;
modes.push_back(CoverMarquee);
mode Alternating;
Alternating.name = "Alternating";
Alternating.value = HUE_PLUS_MODE_ALTERNATING;
Alternating.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_DIRECTION_LR | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Alternating.speed_min = HUE_PLUS_SPEED_SLOWEST;
Alternating.speed_max = HUE_PLUS_SPEED_FASTEST;
Alternating.speed = HUE_PLUS_SPEED_NORMAL;
Alternating.direction = MODE_DIRECTION_RIGHT;
modes.push_back(Alternating);
mode Pulsing;
Pulsing.name = "Pulsing";
Pulsing.value = HUE_PLUS_MODE_PULSING;
Pulsing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Pulsing.speed_min = HUE_PLUS_SPEED_SLOWEST;
Pulsing.speed_max = HUE_PLUS_SPEED_FASTEST;
Pulsing.speed = HUE_PLUS_SPEED_NORMAL;
modes.push_back(Pulsing);
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HUE_PLUS_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Breathing.speed_min = HUE_PLUS_SPEED_SLOWEST;
Breathing.speed_max = HUE_PLUS_SPEED_FASTEST;
Breathing.speed = HUE_PLUS_SPEED_NORMAL;
modes.push_back(Breathing);
mode Alert;
Alert.name = "Alert";
Alert.value = HUE_PLUS_MODE_ALERT;
Alert.flags = 0;
modes.push_back(Alert);
mode Candlelight;
Candlelight.name = "Candlelight";
Candlelight.value = HUE_PLUS_MODE_CANDLELIGHT;
Candlelight.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Candlelight);
mode Wings;
Wings.name = "Wings";
Wings.value = HUE_PLUS_MODE_WINGS;
Wings.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Wings.speed_min = HUE_PLUS_SPEED_SLOWEST;
Wings.speed_max = HUE_PLUS_SPEED_FASTEST;
Wings.speed = HUE_PLUS_SPEED_NORMAL;
modes.push_back(Wings);
// Wave mode is currently disabled because it doesn't appear to work
// mode Wave;
// Wave.name = "Wave";
// Wave.value = HUE_PLUS_MODE_WAVE;
// Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
// Wave.speed_min = HUE_PLUS_SPEED_SLOWEST;
// Wave.speed_max = HUE_PLUS_SPEED_FASTEST;
// Wave.speed = HUE_PLUS_SPEED_NORMAL;
// modes.push_back(Wave);
mode led_mode;
led_mode.name = "Custom";
modes.push_back(led_mode);
/*-------------------------------------------------*\
| Set size of colors array |
@@ -178,6 +77,21 @@ RGBController_HuePlus::RGBController_HuePlus(HuePlusController* hueplus_ptr)
}
}
int RGBController_HuePlus::GetMode()
{
return 0;
}
void RGBController_HuePlus::SetMode(int /*mode*/)
{
}
void RGBController_HuePlus::SetCustomMode()
{
}
void RGBController_HuePlus::UpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
@@ -240,39 +154,3 @@ void RGBController_HuePlus::UpdateSingleLED(int led)
hueplus->SetChannelLEDs(channel, channel_colors);
}
}
void RGBController_HuePlus::SetCustomMode()
{
SetMode(0);
}
void RGBController_HuePlus::UpdateMode()
{
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];
std::vector<RGBColor> channel_colors;
for(std::size_t color = 0; color < colors.size(); color++)
{
if(leds_channel[color] == channel)
{
channel_colors.push_back(colors[color]);
}
}
if(channel_colors.size() > 0)
{
bool direction = false;
if(modes[active_mode].direction == MODE_DIRECTION_LEFT)
{
direction = true;
}
hueplus->SetMode(modes[active_mode].value, modes[active_mode].speed, direction);
hueplus->SetChannelLEDs(channel, channel_colors);
}
}
}
+3 -3
View File
@@ -15,13 +15,13 @@ class RGBController_HuePlus : public RGBController
{
public:
RGBController_HuePlus(HuePlusController* hueplus_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
HuePlusController* hueplus;
std::vector<unsigned int> leds_channel;
+28 -88
View File
@@ -9,6 +9,20 @@
#include "RGBController_HyperX.h"
int RGBController_HyperX::GetMode()
{
return(0);
}
void RGBController_HyperX::SetMode(int mode)
{
hyperx->SetMode(mode);
}
void RGBController_HyperX::SetCustomMode()
{
hyperx->SetMode(HYPERX_MODE_DIRECT);
}
void RGBController_HyperX::UpdateLEDs()
{
@@ -91,85 +105,22 @@ RGBController_HyperX::RGBController_HyperX(HyperXController* hyperx_ptr)
type = DEVICE_TYPE_DRAM;
mode Direct;
Direct.name = "Direct";
Direct.value = HYPERX_MODE_DIRECT;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Direct);
mode hyperx_modes[HYPERX_NUMBER_MODES];
mode Static;
Static.name = "Static";
Static.value = HYPERX_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR;
modes.push_back(Static);
mode Rainbow;
Rainbow.name = "Rainbow";
Rainbow.value = HYPERX_MODE_RAINBOW;
Rainbow.flags = MODE_FLAG_HAS_SPEED;
Rainbow.speed_min = HYPERX_SPEED_RAINBOW_SLOW;
Rainbow.speed_max = HYPERX_SPEED_RAINBOW_FAST;
Rainbow.speed = HYPERX_SPEED_RAINBOW_NORMAL;
modes.push_back(Rainbow);
mode Comet;
Comet.name = "Comet";
Comet.value = HYPERX_MODE_COMET;
Comet.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Comet.speed_min = HYPERX_SPEED_COMET_SLOW;
Comet.speed_max = HYPERX_SPEED_COMET_FAST;
Comet.random = false;
Comet.speed = HYPERX_SPEED_COMET_NORMAL;
modes.push_back(Comet);
mode Heartbeat;
Heartbeat.name = "Heartbeat";
Heartbeat.value = HYPERX_MODE_HEARTBEAT;
Heartbeat.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Heartbeat.speed_min = HYPERX_SPEED_COMET_SLOW;
Heartbeat.speed_max = HYPERX_SPEED_COMET_FAST;
Heartbeat.random = false;
Heartbeat.speed = HYPERX_SPEED_COMET_NORMAL;
modes.push_back(Heartbeat);
mode SpectrumCycle;
SpectrumCycle.name = "Spectrum Cycle";
SpectrumCycle.value = HYPERX_MODE_CYCLE;
SpectrumCycle.flags = MODE_FLAG_HAS_SPEED;
SpectrumCycle.speed_min = HYPERX_SPEED_CYCLE_SLOW;
SpectrumCycle.speed_max = HYPERX_SPEED_CYCLE_FAST;
SpectrumCycle.speed = HYPERX_SPEED_CYCLE_NORMAL;
modes.push_back(SpectrumCycle);
hyperx_modes[0].name = "Direct";
hyperx_modes[1].name = "Static";
hyperx_modes[2].name = "Rainbow";
hyperx_modes[3].name = "Comet";
hyperx_modes[4].name = "Heartbeat";
hyperx_modes[5].name = "Spectrum Cycle";
hyperx_modes[6].name = "Breathing";
hyperx_modes[7].name = "Bounce";
hyperx_modes[8].name = "Blink";
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = HYPERX_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Breathing.speed_min = HYPERX_SPEED_BREATHING_SLOW;
Breathing.speed_max = HYPERX_SPEED_BREATHING_FAST;
Breathing.random = false;
Breathing.speed = HYPERX_SPEED_BREATHING_NORMAL;
modes.push_back(Breathing);
mode Bounce;
Bounce.name = "Bounce";
Bounce.value = HYPERX_MODE_BOUNCE;
Bounce.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Bounce.speed_min = HYPERX_SPEED_BOUNCE_SLOW;
Bounce.speed_max = HYPERX_SPEED_BOUNCE_FAST;
Bounce.random = false;
Bounce.speed = HYPERX_SPEED_BOUNCE_NORMAL;
modes.push_back(Bounce);
mode Blink;
Blink.name = "Blink";
Blink.value = HYPERX_MODE_BLINK;
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_RANDOM_COLOR;
Blink.speed_min = HYPERX_SPEED_BLINK_SLOW;
Blink.speed_max = HYPERX_SPEED_BLINK_FAST;
Blink.random = false;
Blink.speed = HYPERX_SPEED_BLINK_NORMAL;
modes.push_back(Blink);
for (int i = 0; i < HYPERX_NUMBER_MODES; i++)
{
modes.push_back(hyperx_modes[i]);
}
colors.resize(hyperx->GetLEDCount());
@@ -209,14 +160,3 @@ RGBController_HyperX::RGBController_HyperX(HyperXController* hyperx_ptr)
zones.push_back(*new_zone);
}
}
void RGBController_HyperX::SetCustomMode()
{
SetMode(0);
}
void RGBController_HyperX::UpdateMode()
{
hyperx->SetMode(modes[active_mode].value, modes[active_mode].random, modes[active_mode].speed);
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_HyperX : public RGBController
{
public:
RGBController_HyperX(HyperXController* hyperx_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
HyperXController* hyperx;
};
+15 -10
View File
@@ -42,6 +42,21 @@ RGBController_LEDStrip::RGBController_LEDStrip(LEDStripController* ledstrip_ptr)
zones.push_back(led_zone);
}
int RGBController_LEDStrip::GetMode()
{
return 0;
}
void RGBController_LEDStrip::SetMode(int /*mode*/)
{
}
void RGBController_LEDStrip::SetCustomMode()
{
}
void RGBController_LEDStrip::UpdateLEDs()
{
strip->SetLEDs(colors);
@@ -56,13 +71,3 @@ void RGBController_LEDStrip::UpdateSingleLED(int led)
{
strip->SetLEDs(colors);
}
void RGBController_LEDStrip::SetCustomMode()
{
}
void RGBController_LEDStrip::UpdateMode()
{
}
+3 -2
View File
@@ -16,12 +16,13 @@ class RGBController_LEDStrip : public RGBController
{
public:
RGBController_LEDStrip(LEDStripController* ledstrip_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
LEDStripController* strip;
+15 -10
View File
@@ -64,6 +64,21 @@ RGBController_MSI3Zone::~RGBController_MSI3Zone()
}
int RGBController_MSI3Zone::GetMode()
{
return 0;
}
void RGBController_MSI3Zone::SetMode(int mode)
{
}
void RGBController_MSI3Zone::SetCustomMode()
{
}
void RGBController_MSI3Zone::UpdateLEDs()
{
msi->SetLEDs(colors);
@@ -77,14 +92,4 @@ void RGBController_MSI3Zone::UpdateZoneLEDs(int zone)
void RGBController_MSI3Zone::UpdateSingleLED(int led)
{
msi->SetLEDs(colors);
}
void RGBController_MSI3Zone::SetCustomMode()
{
}
void RGBController_MSI3Zone::UpdateMode()
{
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_MSI3Zone : public RGBController
public:
RGBController_MSI3Zone(MSI3ZoneController* msi_ptr);
~RGBController_MSI3Zone();
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
MSI3ZoneController* msi;
};
+77 -74
View File
@@ -11,7 +11,84 @@
#include <fstream>
#include <unistd.h>
int RGBController_OpenRazer::GetMode()
{
return(0);
}
void RGBController_OpenRazer::SetMode(int mode)
{
char update_value = 1;
switch(matrix_type)
{
case RAZER_TYPE_MATRIX_FRAME:
case RAZER_TYPE_MATRIX_NOFRAME:
{
switch(mode)
{
case RAZER_MODE_CUSTOM:
matrix_effect_custom.write(&update_value, 1);
matrix_effect_custom.flush();
break;
case RAZER_MODE_OFF:
matrix_effect_none.write(&update_value, 1);
matrix_effect_none.flush();
break;
case RAZER_MODE_STATIC:
break;
case RAZER_MODE_BREATHING:
break;
case RAZER_MODE_SPECTRUM_CYCLE:
matrix_effect_spectrum.write(&update_value, 1);
matrix_effect_spectrum.flush();
break;
case RAZER_MODE_WAVE:
matrix_effect_wave.write(&update_value, 1);
matrix_effect_wave.flush();
break;
case RAZER_MODE_REACTIVE:
matrix_effect_reactive.write(&update_value, 1);
matrix_effect_reactive.flush();
break;
}
}
break;
case RAZER_TYPE_NOMATRIX:
{
switch(mode)
{
case RAZER_MODE_CUSTOM:
update_value = 0;
logo_led_effect.write(&update_value, 1);
scroll_led_effect.write(&update_value, 1);
logo_led_effect.flush();
scroll_led_effect.flush();
break;
case RAZER_MODE_SPECTRUM_CYCLE:
update_value = '4';
logo_led_effect.write(&update_value, 1);
scroll_led_effect.write(&update_value, 1);
logo_led_effect.flush();
scroll_led_effect.flush();
break;
}
}
}
}
void RGBController_OpenRazer::SetCustomMode()
{
SetMode(RAZER_MODE_CUSTOM);
}
void RGBController_OpenRazer::UpdateLEDs()
{
@@ -324,77 +401,3 @@ RGBController_OpenRazer::RGBController_OpenRazer(std::string dev_path)
}
}
}
void RGBController_OpenRazer::SetCustomMode()
{
SetMode(RAZER_MODE_CUSTOM);
}
void RGBController_OpenRazer::UpdateMode()
{
char update_value = 1;
switch(matrix_type)
{
case RAZER_TYPE_MATRIX_FRAME:
case RAZER_TYPE_MATRIX_NOFRAME:
{
switch(active_mode)
{
case RAZER_MODE_CUSTOM:
matrix_effect_custom.write(&update_value, 1);
matrix_effect_custom.flush();
break;
case RAZER_MODE_OFF:
matrix_effect_none.write(&update_value, 1);
matrix_effect_none.flush();
break;
case RAZER_MODE_STATIC:
break;
case RAZER_MODE_BREATHING:
break;
case RAZER_MODE_SPECTRUM_CYCLE:
matrix_effect_spectrum.write(&update_value, 1);
matrix_effect_spectrum.flush();
break;
case RAZER_MODE_WAVE:
matrix_effect_wave.write(&update_value, 1);
matrix_effect_wave.flush();
break;
case RAZER_MODE_REACTIVE:
matrix_effect_reactive.write(&update_value, 1);
matrix_effect_reactive.flush();
break;
}
}
break;
case RAZER_TYPE_NOMATRIX:
{
switch(active_mode)
{
case RAZER_MODE_CUSTOM:
update_value = 0;
logo_led_effect.write(&update_value, 1);
scroll_led_effect.write(&update_value, 1);
logo_led_effect.flush();
scroll_led_effect.flush();
break;
case RAZER_MODE_SPECTRUM_CYCLE:
update_value = '4';
logo_led_effect.write(&update_value, 1);
scroll_led_effect.write(&update_value, 1);
logo_led_effect.flush();
scroll_led_effect.flush();
break;
}
}
}
}
+3 -3
View File
@@ -920,13 +920,13 @@ public:
public:
RGBController_OpenRazer(std::string dev_path);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
int device;
private:
+37 -94
View File
@@ -9,6 +9,28 @@
#include "RGBController_PatriotViper.h"
int RGBController_PatriotViper::GetMode()
{
return(0);
}
void RGBController_PatriotViper::SetMode(int mode)
{
if(mode == 0)
{
viper->SetDirect();
}
else
{
viper->SetMode(mode - 1);
}
}
void RGBController_PatriotViper::SetCustomMode()
{
viper->SetDirect();
}
void RGBController_PatriotViper::UpdateLEDs()
{
if(viper->direct == true)
@@ -66,85 +88,23 @@ RGBController_PatriotViper::RGBController_PatriotViper(PatriotViperController* v
type = DEVICE_TYPE_DRAM;
mode Direct;
Direct.name = "Direct";
Direct.value = 0xFFFF;
Direct.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Direct.speed_min = 0;
Direct.speed_max = 0;
Direct.random = false;
Direct.speed = 0;
modes.push_back(Direct);
mode viper_modes[10];
mode Dark;
Dark.name = "Dark";
Dark.value = VIPER_MODE_DARK;
Dark.flags = 0;
Dark.speed_min = 0;
Dark.speed_max = 0;
Dark.random = false;
Dark.speed = 0;
modes.push_back(Dark);
viper_modes[0].name = "Direct";
viper_modes[1].name = "Dark";
viper_modes[2].name = "Breathing";
viper_modes[3].name = "Viper";
viper_modes[4].name = "Heartbeat";
viper_modes[5].name = "Marquee";
viper_modes[6].name = "Raindrop";
viper_modes[7].name = "Aurora";
viper_modes[8].name = "Unknown";
viper_modes[9].name = "Neon";
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = VIPER_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Breathing.speed_min = VIPER_SPEED_BREATHING_MIN;
Breathing.speed_max = VIPER_SPEED_BREATHING_MAX;
Breathing.random = false;
Breathing.speed = VIPER_SPEED_BREATHING_DEFAULT;
modes.push_back(Breathing);
mode Viper;
Viper.name = "Viper";
Viper.value = VIPER_MODE_VIPER;
Viper.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Viper.speed_min = VIPER_SPEED_MIN;
Viper.speed_max = VIPER_SPEED_MAX;
Viper.random = false;
Viper.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Viper);
mode Heartbeat;
Heartbeat.name = "Heartbeat";
Heartbeat.value = VIPER_MODE_HEARTBEAT;
Heartbeat.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Heartbeat.speed_min = VIPER_SPEED_MIN;
Heartbeat.speed_max = VIPER_SPEED_MAX;
Heartbeat.random = false;
Heartbeat.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Heartbeat);
mode Marquee;
Marquee.name = "Marquee";
Marquee.value = VIPER_MODE_MARQUEE;
Marquee.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Marquee.speed_min = VIPER_SPEED_MIN;
Marquee.speed_max = VIPER_SPEED_MAX;
Marquee.random = false;
Marquee.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Marquee);
mode Raindrop;
Raindrop.name = "Raindrop";
Raindrop.value = VIPER_MODE_RAINDROP;
Raindrop.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Raindrop.speed_min = VIPER_SPEED_MIN;
Raindrop.speed_max = VIPER_SPEED_MAX;
Raindrop.random = false;
Raindrop.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Raindrop);
mode Aurora;
Aurora.name = "Aurora";
Aurora.value = VIPER_MODE_AURORA;
Aurora.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Aurora.speed_min = VIPER_SPEED_MIN;
Aurora.speed_max = VIPER_SPEED_MAX;
Aurora.random = false;
Aurora.speed = VIPER_SPEED_DEFAULT;
modes.push_back(Aurora);
for (int i = 0; i < 9; i++)
{
modes.push_back(viper_modes[i]);
}
colors.resize(viper->GetLEDCount());
@@ -183,20 +143,3 @@ RGBController_PatriotViper::RGBController_PatriotViper(PatriotViperController* v
zones.push_back(*new_zone);
}
}
void RGBController_PatriotViper::SetCustomMode()
{
SetMode(0);
}
void RGBController_PatriotViper::UpdateMode()
{
if(modes[active_mode].value == 0xFFFF)
{
viper->SetDirect();
}
else
{
viper->SetMode(modes[active_mode].value, modes[active_mode].speed);
}
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_PatriotViper : public RGBController
{
public:
RGBController_PatriotViper(PatriotViperController* viper_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
PatriotViperController* viper;
};
+14 -10
View File
@@ -9,6 +9,20 @@
#include "RGBController_Polychrome.h"
int RGBController_Polychrome::GetMode()
{
return(polychrome->GetMode());
}
void RGBController_Polychrome::SetMode(int mode)
{
polychrome->SetMode(mode);
}
void RGBController_Polychrome::SetCustomMode()
{
polychrome->SetMode(POLYCHROME_MODE_STATIC);
}
void RGBController_Polychrome::UpdateLEDs()
{
@@ -81,13 +95,3 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr
zones.push_back(*new_zone);
}
}
void RGBController_Polychrome::SetCustomMode()
{
SetMode(0);
}
void RGBController_Polychrome::UpdateMode()
{
polychrome->SetMode(active_mode);
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_Polychrome : public RGBController
{
public:
RGBController_Polychrome(PolychromeController* polychrome_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
PolychromeController* polychrome;
};
+16 -11
View File
@@ -27,9 +27,24 @@ RGBController_PoseidonZRGB::~RGBController_PoseidonZRGB()
}
int RGBController_PoseidonZRGB::GetMode()
{
return 0;
}
void RGBController_PoseidonZRGB::SetMode(int mode)
{
}
void RGBController_PoseidonZRGB::SetCustomMode()
{
}
void RGBController_PoseidonZRGB::UpdateLEDs()
{
poseidon->SetLEDsDirect(colors);
poseidon->SetLEDs(colors);
}
void RGBController_PoseidonZRGB::UpdateZoneLEDs(int zone)
@@ -40,14 +55,4 @@ void RGBController_PoseidonZRGB::UpdateZoneLEDs(int zone)
void RGBController_PoseidonZRGB::UpdateSingleLED(int led)
{
poseidon->SetLEDs(colors);
}
void RGBController_PoseidonZRGB::SetCustomMode()
{
}
void RGBController_PoseidonZRGB::UpdateMode()
{
}
+3 -3
View File
@@ -16,13 +16,13 @@ class RGBController_PoseidonZRGB : public RGBController
public:
RGBController_PoseidonZRGB(PoseidonZRGBController* poseidon_ptr);
~RGBController_PoseidonZRGB();
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
PoseidonZRGBController* poseidon;
};
+22 -49
View File
@@ -9,6 +9,20 @@
#include "RGBController_RGBFusion.h"
int RGBController_RGBFusion::GetMode()
{
return(rgb_fusion->GetMode());
}
void RGBController_RGBFusion::SetMode(int mode)
{
rgb_fusion->SetMode(mode);
}
void RGBController_RGBFusion::SetCustomMode()
{
rgb_fusion->SetMode(RGB_FUSION_MODE_STATIC);
}
void RGBController_RGBFusion::UpdateLEDs()
{
@@ -54,29 +68,16 @@ RGBController_RGBFusion::RGBController_RGBFusion(RGBFusionController* rgb_fusion
type = DEVICE_TYPE_MOTHERBOARD;
mode Static;
Static.name = "Static";
Static.value = RGB_FUSION_MODE_STATIC;
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
modes.push_back(Static);
mode rgb_fusion_modes[RGB_FUSION_NUMBER_MODES];
mode Breathing;
Breathing.name = "Breathing";
Breathing.value = RGB_FUSION_MODE_BREATHING;
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Breathing.speed_min = RGB_FUSION_SPEED_SLOW;
Breathing.speed_max = RGB_FUSION_SPEED_FAST;
Breathing.speed = RGB_FUSION_SPEED_NORMAL;
modes.push_back(Breathing);
rgb_fusion_modes[0].name = "Static";
rgb_fusion_modes[1].name = "Breathing";
rgb_fusion_modes[2].name = "Flashing";
mode Flashing;
Flashing.name = "Flashing";
Flashing.value = RGB_FUSION_MODE_FLASHING;
Flashing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
Flashing.speed_min = RGB_FUSION_SPEED_SLOW;
Flashing.speed_max = RGB_FUSION_SPEED_FAST;
Flashing.speed = RGB_FUSION_SPEED_NORMAL;
modes.push_back(Flashing);
for (int i = 0; i < RGB_FUSION_NUMBER_MODES; i++)
{
modes.push_back(rgb_fusion_modes[i]);
}
colors.resize(rgb_fusion->GetLEDCount());
@@ -104,32 +105,4 @@ RGBController_RGBFusion::RGBController_RGBFusion(RGBFusionController* rgb_fusion
// Push new zone to zones vector
zones.push_back(*new_zone);
}
// Initialize active mode
active_mode = GetDeviceMode();
}
int RGBController_RGBFusion::GetDeviceMode()
{
int dev_mode = rgb_fusion->GetMode();
for(int mode = 0; mode < modes.size(); mode++)
{
if(modes[mode].value == dev_mode)
{
return(mode);
}
}
return(0);
}
void RGBController_RGBFusion::SetCustomMode()
{
rgb_fusion->SetMode(RGB_FUSION_MODE_STATIC, 0);
}
void RGBController_RGBFusion::UpdateMode()
{
rgb_fusion->SetMode(modes[active_mode].value, modes[active_mode].speed);
}
+3 -5
View File
@@ -16,15 +16,13 @@ class RGBController_RGBFusion : public RGBController
{
public:
RGBController_RGBFusion(RGBFusionController* rgb_fusion_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
RGBFusionController* rgb_fusion;
int GetDeviceMode();
};
+100
View File
@@ -0,0 +1,100 @@
/*-----------------------------------------*\
| RGBController_RGBFusion2.cpp |
| |
| Generic RGB Interface for OpenRGB |
| Gigabyte RGB Fusion 2.0 Driver |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#include "RGBController_RGBFusion2.h"
int RGBController_RGBFusion2::GetMode()
{
return(rgb_fusion->GetMode());
}
void RGBController_RGBFusion2::SetMode(int mode)
{
rgb_fusion->SetMode(mode);
}
void RGBController_RGBFusion2::SetCustomMode()
{
rgb_fusion->SetMode(0);
}
void RGBController_RGBFusion2::UpdateLEDs()
{
for (std::size_t led = 0; led < colors.size(); led++)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
rgb_fusion->SetLEDColor(led, red, grn, blu);
}
}
void RGBController_RGBFusion2::UpdateZoneLEDs(int zone)
{
RGBColor color = colors[zone];
unsigned char red = RGBGetRValue(color);
unsigned char grn = RGBGetGValue(color);
unsigned char blu = RGBGetBValue(color);
rgb_fusion->SetLEDColor(zone, red, grn, blu);
}
void RGBController_RGBFusion2::UpdateSingleLED(int led)
{
UpdateZoneLEDs(led);
}
RGBController_RGBFusion2::RGBController_RGBFusion2(RGBFusion2Controller* rgb_fusion_ptr)
{
rgb_fusion = rgb_fusion_ptr;
name = rgb_fusion->GetDeviceName();
description = "RGB Fusion 2.0";
location = rgb_fusion->GetDeviceLocation();
type = DEVICE_TYPE_MOTHERBOARD;
mode rgb_fusion_modes[1];
rgb_fusion_modes[0].name = "Static";
for (int i = 0; i < 1; i++)
{
modes.push_back(rgb_fusion_modes[i]);
}
colors.resize(rgb_fusion->GetLEDCount());
// Search through all LEDs and create zones for each channel type
for (unsigned int i = 0; i < rgb_fusion->GetLEDCount(); i++)
{
zone* new_zone = new zone();
led* new_led = new led();
std::vector<int>* zone_row = new std::vector<int>();
// Set zone name to channel name
new_zone->name = "Zone";
new_led->name = "LED";
zone_row->push_back(i);
// Aura devices can be either single or linear, never matrix
// That means only one row is needed
new_zone->map.push_back(*zone_row);
// Push new LED to LEDs vector
leds.push_back(*new_led);
// Push new zone to zones vector
zones.push_back(*new_zone);
}
}
+28
View File
@@ -0,0 +1,28 @@
/*-----------------------------------------*\
| RGBController_RGBFusion2.h |
| |
| Generic RGB Interface for OpenRGB |
| Gigabyte RGB Fusion 2.0 Driver |
| |
| Adam Honse (CalcProgrammer1) 1/15/2020 |
\*-----------------------------------------*/
#pragma once
#include "RGBController.h"
#include "RGBFusion2Controller.h"
class RGBController_RGBFusion2 : public RGBController
{
public:
RGBController_RGBFusion2(RGBFusion2Controller* rgb_fusion_ptr);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
private:
RGBFusion2Controller* rgb_fusion;
};
+15 -10
View File
@@ -70,6 +70,21 @@ RGBController_RazerChromaSDK::RGBController_RazerChromaSDK(unsigned int device_t
if(CreateChromaLinkEffect == NULL) CreateChromaLinkEffect = (CREATECHROMALINKEFFECT)GetProcAddress(*hModule, "CreateChromaLinkEffect");
}
int RGBController_RazerChromaSDK::GetMode()
{
return 0;
}
void RGBController_RazerChromaSDK::SetMode(int mode)
{
}
void RGBController_RazerChromaSDK::SetCustomMode()
{
}
void RGBController_RazerChromaSDK::UpdateLEDs()
{
switch (device->razer_type)
@@ -154,13 +169,3 @@ void RGBController_RazerChromaSDK::UpdateSingleLED(int led)
{
UpdateLEDs();
}
void RGBController_RazerChromaSDK::SetCustomMode()
{
}
void RGBController_RazerChromaSDK::UpdateMode()
{
}
+3 -3
View File
@@ -229,13 +229,13 @@ class RGBController_RazerChromaSDK : public RGBController
{
public:
RGBController_RazerChromaSDK(unsigned int device_type, HMODULE* hModule);
int GetMode();
void SetMode(int mode);
void SetCustomMode();
void UpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void SetCustomMode();
void UpdateMode();
private:
const razer_device* device;
-1
View File
@@ -31,7 +31,6 @@ int main(int argc, char* argv[])
{
DetectRGBControllers();
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
Ui::OpenRGBDialog2 dlg(busses, rgb_controllers);
+156 -86
View File
@@ -13,92 +13,162 @@
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="NameLabel">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="TypeLabel">
<property name="text">
<string>Type:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="DescriptionValue">
<property name="text">
<string>Description Value</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="VersionValue">
<property name="text">
<string>Version Value</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="LocationValue">
<property name="text">
<string>Location Value</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="TypeValue">
<property name="text">
<string>Type Value</string>
</property>
</widget>
</item>
<item row="3" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="VersionLabel">
<property name="text">
<string>Version:</string>
</property>
</widget>
</item>
<item row="5" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="SerialLabel">
<property name="text">
<string>Serial:</string>
</property>
</widget>
</item>
<item row="4" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="LocationLabel">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="SerialValue">
<property name="text">
<string>Serial Value</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="NameValue">
<property name="text">
<string>Name Value</string>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="DescriptionLabel">
<property name="text">
<string>Description:</string>
</property>
</widget>
</item>
</layout>
<widget class="QLabel" name="TypeLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>80</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
<widget class="QLabel" name="TypeValue">
<property name="geometry">
<rect>
<x>180</x>
<y>80</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Type Value</string>
</property>
</widget>
<widget class="QLabel" name="DescriptionValue">
<property name="geometry">
<rect>
<x>180</x>
<y>100</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Description Value</string>
</property>
</widget>
<widget class="QLabel" name="DescriptionLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>100</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Description:</string>
</property>
</widget>
<widget class="QLabel" name="VersionValue">
<property name="geometry">
<rect>
<x>180</x>
<y>120</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Version Value</string>
</property>
</widget>
<widget class="QLabel" name="VersionLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>120</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Version:</string>
</property>
</widget>
<widget class="QLabel" name="LocationLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>140</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Location:</string>
</property>
</widget>
<widget class="QLabel" name="LocationValue">
<property name="geometry">
<rect>
<x>180</x>
<y>140</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Location Value</string>
</property>
</widget>
<widget class="QLabel" name="NameValue">
<property name="geometry">
<rect>
<x>180</x>
<y>60</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Name Value</string>
</property>
</widget>
<widget class="QLabel" name="NameLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>60</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Name:</string>
</property>
</widget>
<widget class="QLabel" name="SerialValue">
<property name="geometry">
<rect>
<x>180</x>
<y>160</y>
<width>240</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Serial Value</string>
</property>
</widget>
<widget class="QLabel" name="SerialLabel">
<property name="geometry">
<rect>
<x>100</x>
<y>160</y>
<width>60</width>
<height>14</height>
</rect>
</property>
<property name="text">
<string>Serial:</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
+1 -246
View File
@@ -75,11 +75,6 @@ OpenRGBDevicePage::OpenRGBDevicePage(RGBController *dev, QWidget *parent) :
ui->ModeBox->setCurrentIndex(device->GetMode());
ui->ModeBox->blockSignals(false);
/*-----------------------------------------------------*\
| Update mode user interface elements |
\*-----------------------------------------------------*/
UpdateModeUi();
ui->ZoneBox->blockSignals(true);
ui->ZoneBox->clear();
@@ -134,243 +129,10 @@ void Ui::OpenRGBDevicePage::on_LEDBox_currentIndexChanged(int index)
void Ui::OpenRGBDevicePage::on_ModeBox_currentIndexChanged(int /*index*/)
{
/*-----------------------------------------------------*\
| Update mode user interface elements |
\*-----------------------------------------------------*/
UpdateModeUi();
/*-----------------------------------------------------*\
| Change device mode |
\*-----------------------------------------------------*/
UpdateMode();
}
void Ui::OpenRGBDevicePage::on_RandomCheck_clicked()
{
/*-----------------------------------------------------*\
| Change device mode |
\*-----------------------------------------------------*/
UpdateMode();
}
void Ui::OpenRGBDevicePage::on_SpeedSlider_valueChanged(int /*value*/)
{
/*-----------------------------------------------------*\
| Change device mode |
\*-----------------------------------------------------*/
UpdateMode();
}
void Ui::OpenRGBDevicePage::on_DirectionBox_currentIndexChanged(int /*index*/)
{
/*-----------------------------------------------------*\
| Change device mode |
\*-----------------------------------------------------*/
UpdateMode();
}
void Ui::OpenRGBDevicePage::UpdateModeUi()
{
/*-----------------------------------------------------*\
| Read new mode flags and settings |
\*-----------------------------------------------------*/
int selected_mode = ui->ModeBox->currentIndex();
/*-----------------------------------------------------*\
| Don't update the UI if the current mode is invalid |
\*-----------------------------------------------------*/
if(selected_mode < device->modes.size())
{
bool supports_random = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_COLOR )
&& ( device->modes[selected_mode].flags & MODE_FLAG_RANDOM_COLOR );
bool supports_speed = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_SPEED );
bool supports_dir_lr = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_DIRECTION_LR );
bool supports_dir_ud = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_DIRECTION_UD );
bool supports_dir_hv = ( device->modes[selected_mode].flags & MODE_FLAG_HAS_DIRECTION_HV );
bool random = device->modes[selected_mode].random;
unsigned int dir = device->modes[selected_mode].direction;
if(supports_speed)
{
if(device->modes[selected_mode].speed_min > device->modes[selected_mode].speed_max)
{
InvertedSpeed = true;
ui->SpeedSlider->setMinimum(device->modes[selected_mode].speed_max);
ui->SpeedSlider->setMaximum(device->modes[selected_mode].speed_min);
}
else
{
InvertedSpeed = false;
ui->SpeedSlider->setMinimum(device->modes[selected_mode].speed_min);
ui->SpeedSlider->setMaximum(device->modes[selected_mode].speed_max);
}
ui->SpeedSlider->setValue(device->modes[selected_mode].speed);
ui->SpeedSlider->setEnabled(true);
}
else
{
ui->SpeedSlider->setEnabled(false);
}
ui->DirectionBox->clear();
if(supports_dir_lr)
{
ui->DirectionBox->addItem("Left");
ui->DirectionBox->addItem("Right");
}
if(supports_dir_ud)
{
ui->DirectionBox->addItem("Up");
ui->DirectionBox->addItem("Down");
}
if(supports_dir_hv)
{
ui->DirectionBox->addItem("Horizontal");
ui->DirectionBox->addItem("Vertical");
}
if(supports_dir_lr || supports_dir_ud || supports_dir_hv)
{
if((supports_dir_lr)
&&((dir == MODE_DIRECTION_LEFT)
||(dir == MODE_DIRECTION_RIGHT)))
{
ui->DirectionBox->setCurrentIndex(dir);
}
if((supports_dir_ud)
&&((dir == MODE_DIRECTION_UP)
||(dir == MODE_DIRECTION_DOWN)))
{
if(supports_dir_lr)
{
ui->DirectionBox->setCurrentIndex(dir);
}
else
{
ui->DirectionBox->setCurrentIndex(dir - 2);
}
}
if((supports_dir_hv)
&&((dir == MODE_DIRECTION_HORIZONTAL)
||(dir == MODE_DIRECTION_VERTICAL)))
{
if(supports_dir_lr && supports_dir_ud)
{
ui->DirectionBox->setCurrentIndex(dir);
}
else if(supports_dir_lr || supports_dir_ud)
{
ui->DirectionBox->setCurrentIndex(dir - 2);
}
else
{
ui->DirectionBox->setCurrentIndex(dir - 4);
}
}
ui->DirectionBox->setEnabled(true);
}
else
{
ui->DirectionBox->setEnabled(false);
}
if(supports_random)
{
ui->RandomCheck->setEnabled(true);
ui->RandomCheck->setCheckState(random ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
}
else
{
ui->RandomCheck->setEnabled(false);
ui->RandomCheck->setCheckState(random ? Qt::CheckState::Checked : Qt::CheckState::Unchecked);
}
}
}
void Ui::OpenRGBDevicePage::UpdateMode()
{
/*-----------------------------------------------------*\
| Read user interface |
\*-----------------------------------------------------*/
int current_mode = ui->ModeBox->currentIndex();
int current_speed = ui->SpeedSlider->value();
bool current_random = ui->RandomCheck->checkState();
int current_dir_idx = ui->DirectionBox->currentIndex();
int current_direction = 0;
bool supports_dir_lr = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_LR );
bool supports_dir_ud = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_UD );
bool supports_dir_hv = ( device->modes[current_mode].flags & MODE_FLAG_HAS_DIRECTION_HV );
/*-----------------------------------------------------*\
| Set the direction value |
\*-----------------------------------------------------*/
if(supports_dir_hv)
{
if(supports_dir_lr && supports_dir_ud)
{
current_direction = current_dir_idx;
}
else if(supports_dir_lr || supports_dir_ud)
{
current_direction = current_dir_idx + 2;
}
else
{
current_direction = current_dir_idx + 4;
}
}
if(supports_dir_ud)
{
if(supports_dir_lr)
{
current_direction = current_dir_idx;
}
else
{
current_direction = current_dir_idx + 2;
}
}
if((supports_dir_lr)
&&(current_dir_idx < 2))
{
current_direction = current_dir_idx;
}
device->modes[current_mode].direction = current_direction;
/*-----------------------------------------------------*\
| If Speed Slider is inverted, invert value |
\*-----------------------------------------------------*/
if(InvertedSpeed)
{
current_speed = device->modes[current_mode].speed_min - current_speed + device->modes[current_mode].speed_max;
}
/*-----------------------------------------------------*\
| Don't set the mode if the current mode is invalid |
\*-----------------------------------------------------*/
if(current_mode < device->modes.size())
{
/*-----------------------------------------------------*\
| Update mode parameters |
\*-----------------------------------------------------*/
device->modes[current_mode].speed = current_speed;
device->modes[current_mode].random = current_random;
/*-----------------------------------------------------*\
| Change device mode |
\*-----------------------------------------------------*/
device->SetMode(current_mode);
}
device->SetMode(ui->ModeBox->currentIndex());
}
void Ui::OpenRGBDevicePage::SetDevice(unsigned char red, unsigned char green, unsigned char blue)
@@ -385,13 +147,6 @@ void Ui::OpenRGBDevicePage::SetDevice(unsigned char red, unsigned char green, un
on_SetDeviceButton_clicked();
}
void Ui::OpenRGBDevicePage::SetCustomMode()
{
device->SetCustomMode();
ui->ModeBox->setCurrentIndex(0);//device->active_mode);
UpdateModeUi();
}
void Ui::OpenRGBDevicePage::on_SetDeviceButton_clicked()
{
/*-----------------------------------------------------*\
-10
View File
@@ -19,9 +19,6 @@ public:
~OpenRGBDevicePage();
void SetDevice(unsigned char red, unsigned char green, unsigned char blue);
void SetCustomMode();
void UpdateMode();
void UpdateModeUi();
private slots:
void on_ButtonRed_clicked();
@@ -45,18 +42,11 @@ private slots:
void on_SetAllButton_clicked();
void on_RandomCheck_clicked();
void on_SpeedSlider_valueChanged(int value);
void on_DirectionBox_currentIndexChanged(int index);
private:
Ui::OpenRGBDevicePageUi *ui;
RGBController *device;
bool UpdatingColor = false;
bool InvertedSpeed = false;
void updateRGB();
+369 -225
View File
@@ -6,237 +6,381 @@
<rect>
<x>0</x>
<y>0</y>
<width>550</width>
<width>500</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="6" column="1" colspan="3">
<widget class="QCheckBox" name="RandomCheck">
<property name="text">
<string>Random Color</string>
</property>
</widget>
</item>
<item row="2" column="5" colspan="2">
<widget class="QSpinBox" name="RedSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="SetDeviceButton">
<property name="text">
<string>Device</string>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QLabel" name="SatLabel">
<property name="text">
<string>S:</string>
</property>
</widget>
</item>
<item row="4" column="8" colspan="2">
<widget class="QSpinBox" name="ValSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QPushButton" name="SetAllButton">
<property name="text">
<string>Set All Devices</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="ZoneBox"/>
</item>
<item row="3" column="8" colspan="2">
<widget class="QSpinBox" name="SatSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="1" column="1" colspan="3">
<widget class="QComboBox" name="LEDBox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="SetLabel">
<property name="text">
<string>Set:</string>
</property>
</widget>
</item>
<item row="4" column="4">
<widget class="QLabel" name="BlueLabel">
<property name="text">
<string>B:</string>
</property>
</widget>
</item>
<item row="3" column="5" colspan="2">
<widget class="QSpinBox" name="GreenSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="4" column="7">
<widget class="QLabel" name="ValLabel">
<property name="text">
<string>V:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="ZoneLabel">
<property name="text">
<string>Zone:</string>
</property>
</widget>
</item>
<item row="2" column="7">
<widget class="QLabel" name="HueLabel">
<property name="text">
<string>H:</string>
</property>
</widget>
</item>
<item row="2" column="8" colspan="2">
<widget class="QSpinBox" name="HueSpinBox">
<property name="maximum">
<number>359</number>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QLabel" name="RedLabel">
<property name="text">
<string>R:</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="SetZoneButton">
<property name="text">
<string>Zone</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="DirectionLabel">
<property name="text">
<string>Dir:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="SetLEDButton">
<property name="text">
<string>LED</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="ModeLabel">
<property name="text">
<string>Mode:</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="3">
<widget class="QSlider" name="SpeedSlider">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="LEDLabel">
<property name="text">
<string>LED:</string>
</property>
</widget>
</item>
<item row="8" column="1" colspan="3">
<widget class="QComboBox" name="DirectionBox"/>
</item>
<item row="3" column="4">
<widget class="QLabel" name="GreenLabel">
<property name="text">
<string>G:</string>
</property>
</widget>
</item>
<item row="4" column="5" colspan="2">
<widget class="QSpinBox" name="BlueSpinBox">
<property name="maximum">
<number>255</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="SpeedLabel">
<property name="text">
<string>Speed:</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="3">
<widget class="QComboBox" name="ModeBox"/>
</item>
<item row="6" column="4">
<widget class="QPushButton" name="ButtonBlue">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="5">
<widget class="QPushButton" name="ButtonYellow">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="6">
<widget class="QPushButton" name="ButtonRed">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="7">
<widget class="QPushButton" name="ButtonGreen">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="8">
<widget class="QPushButton" name="ButtonMagenta">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="9">
<widget class="QPushButton" name="ButtonCyan">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
<widget class="QComboBox" name="ZoneBox">
<property name="geometry">
<rect>
<x>71</x>
<y>50</y>
<width>160</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="ZoneLabel">
<property name="geometry">
<rect>
<x>31</x>
<y>50</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Zone:</string>
</property>
</widget>
<widget class="QLabel" name="LEDLabel">
<property name="geometry">
<rect>
<x>31</x>
<y>90</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>LED:</string>
</property>
</widget>
<widget class="QComboBox" name="LEDBox">
<property name="geometry">
<rect>
<x>71</x>
<y>90</y>
<width>160</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="ModeLabel">
<property name="geometry">
<rect>
<x>31</x>
<y>210</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Mode:</string>
</property>
</widget>
<widget class="QComboBox" name="ModeBox">
<property name="geometry">
<rect>
<x>71</x>
<y>210</y>
<width>160</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="SetLEDButton">
<property name="geometry">
<rect>
<x>190</x>
<y>140</y>
<width>41</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>LED</string>
</property>
</widget>
<widget class="QPushButton" name="SetZoneButton">
<property name="geometry">
<rect>
<x>130</x>
<y>140</y>
<width>41</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Zone</string>
</property>
</widget>
<widget class="QSpinBox" name="RedSpinBox">
<property name="geometry">
<rect>
<x>310</x>
<y>120</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QSpinBox" name="GreenSpinBox">
<property name="geometry">
<rect>
<x>310</x>
<y>160</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QSpinBox" name="BlueSpinBox">
<property name="geometry">
<rect>
<x>310</x>
<y>200</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QLabel" name="RedLabel">
<property name="geometry">
<rect>
<x>290</x>
<y>120</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>R:</string>
</property>
</widget>
<widget class="QLabel" name="GreenLabel">
<property name="geometry">
<rect>
<x>290</x>
<y>160</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>G:</string>
</property>
</widget>
<widget class="QLabel" name="BlueLabel">
<property name="geometry">
<rect>
<x>290</x>
<y>200</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>B:</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonGreen">
<property name="geometry">
<rect>
<x>350</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonBlue">
<property name="geometry">
<rect>
<x>410</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonCyan">
<property name="geometry">
<rect>
<x>380</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonMagenta">
<property name="geometry">
<rect>
<x>440</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonRed">
<property name="geometry">
<rect>
<x>290</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonYellow">
<property name="geometry">
<rect>
<x>320</x>
<y>250</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QSpinBox" name="HueSpinBox">
<property name="geometry">
<rect>
<x>410</x>
<y>120</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>359</number>
</property>
</widget>
<widget class="QLabel" name="HueLabel">
<property name="geometry">
<rect>
<x>390</x>
<y>120</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>H:</string>
</property>
</widget>
<widget class="QLabel" name="SatLabel">
<property name="geometry">
<rect>
<x>390</x>
<y>160</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>S:</string>
</property>
</widget>
<widget class="QSpinBox" name="SatSpinBox">
<property name="geometry">
<rect>
<x>410</x>
<y>160</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QSpinBox" name="ValSpinBox">
<property name="geometry">
<rect>
<x>410</x>
<y>200</y>
<width>50</width>
<height>22</height>
</rect>
</property>
<property name="maximum">
<number>255</number>
</property>
</widget>
<widget class="QLabel" name="ValLabel">
<property name="geometry">
<rect>
<x>390</x>
<y>200</y>
<width>20</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>V:</string>
</property>
</widget>
<widget class="QPushButton" name="SetDeviceButton">
<property name="geometry">
<rect>
<x>70</x>
<y>140</y>
<width>41</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Device</string>
</property>
</widget>
<widget class="QLabel" name="SetLabel">
<property name="geometry">
<rect>
<x>30</x>
<y>140</y>
<width>40</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Set:</string>
</property>
</widget>
<widget class="QPushButton" name="SetAllButton">
<property name="geometry">
<rect>
<x>110</x>
<y>170</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Set All Devices</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
+291 -142
View File
@@ -14,148 +14,297 @@
<string>OpenRGB</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="ButtonRed">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="ButtonYellow">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="ButtonGreen">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="ButtonCyan">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="ButtonBlue">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="5">
<widget class="QPushButton" name="ButtonMagenta">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QLabel" name="LabelAuraDevice">
<property name="text">
<string>Device</string>
</property>
</widget>
</item>
<item row="0" column="7">
<widget class="QComboBox" name="ComboDevices"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="LabelRed">
<property name="text">
<string>Red</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QLabel" name="LabelGreen">
<property name="text">
<string>Green</string>
</property>
</widget>
</item>
<item row="1" column="4" colspan="2">
<widget class="QLabel" name="LabelBlue">
<property name="text">
<string>Blue</string>
</property>
</widget>
</item>
<item row="1" column="6" rowspan="2">
<widget class="QLabel" name="LabelMode">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item row="1" column="7" rowspan="2">
<widget class="QComboBox" name="ComboModes"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="EditLED0R"/>
</item>
<item row="2" column="2" colspan="2">
<widget class="QLineEdit" name="EditLED0G"/>
</item>
<item row="2" column="4" colspan="2">
<widget class="QLineEdit" name="EditLED0B"/>
</item>
<item row="3" column="0" colspan="3">
<widget class="QPushButton" name="ButtonSetAll">
<property name="text">
<string>Set All</string>
</property>
</widget>
</item>
<item row="3" column="3" colspan="3">
<widget class="QPushButton" name="ButtonSetDevice">
<property name="text">
<string>Set Device</string>
</property>
</widget>
</item>
<item row="3" column="6">
<widget class="QLabel" name="LabelZone">
<property name="text">
<string>Zone</string>
</property>
</widget>
</item>
<item row="3" column="7">
<widget class="QComboBox" name="ComboZones"/>
</item>
<item row="4" column="0" colspan="3">
<widget class="QPushButton" name="ButtonSetZone">
<property name="text">
<string>Set Zone</string>
</property>
</widget>
</item>
<item row="4" column="3" colspan="3">
<widget class="QPushButton" name="ButtonSetLED">
<property name="text">
<string>Set LED</string>
</property>
</widget>
</item>
<item row="4" column="6">
<widget class="QLabel" name="LabelLED">
<property name="text">
<string>LED</string>
</property>
</widget>
</item>
<item row="4" column="7">
<widget class="QComboBox" name="ComboLEDs"/>
</item>
</layout>
<widget class="QPushButton" name="ButtonSetAll">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set All</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonSetZone">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set Zone</string>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0R">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0G">
<property name="geometry">
<rect>
<x>70</x>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="EditLED0B">
<property name="geometry">
<rect>
<x>130</x>
<y>50</y>
<width>50</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelRed">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Red</string>
</property>
</widget>
<widget class="QLabel" name="LabelGreen">
<property name="geometry">
<rect>
<x>70</x>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Green</string>
</property>
</widget>
<widget class="QLabel" name="LabelBlue">
<property name="geometry">
<rect>
<x>130</x>
<y>30</y>
<width>50</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Blue</string>
</property>
</widget>
<widget class="QComboBox" name="ComboDevices">
<property name="geometry">
<rect>
<x>290</x>
<y>10</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelAuraDevice">
<property name="geometry">
<rect>
<x>200</x>
<y>10</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Device</string>
</property>
</widget>
<widget class="QComboBox" name="ComboModes">
<property name="geometry">
<rect>
<x>290</x>
<y>40</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelMode">
<property name="geometry">
<rect>
<x>200</x>
<y>40</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Mode</string>
</property>
</widget>
<widget class="QComboBox" name="ComboZones">
<property name="geometry">
<rect>
<x>290</x>
<y>70</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelZone">
<property name="geometry">
<rect>
<x>200</x>
<y>70</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Zone</string>
</property>
</widget>
<widget class="QComboBox" name="ComboLEDs">
<property name="geometry">
<rect>
<x>290</x>
<y>100</y>
<width>200</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="LabelLED">
<property name="geometry">
<rect>
<x>200</x>
<y>100</y>
<width>90</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>LED</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonSetLED">
<property name="geometry">
<rect>
<x>100</x>
<y>110</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set LED</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonSetDevice">
<property name="geometry">
<rect>
<x>100</x>
<y>80</y>
<width>80</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Set Device</string>
</property>
</widget>
<widget class="QPushButton" name="ButtonRed">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonYellow">
<property name="geometry">
<rect>
<x>40</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonGreen">
<property name="geometry">
<rect>
<x>70</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonCyan">
<property name="geometry">
<rect>
<x>100</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonBlue">
<property name="geometry">
<rect>
<x>130</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="ButtonMagenta">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>21</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
</widget>
</widget>
<resources/>
-1
View File
@@ -261,7 +261,6 @@ void OpenRGBDialog2::on_SetAllDevices(unsigned char red, unsigned char green, un
{
for(int device = 0; device < ui->DevicesTabBar->count(); device++)
{
qobject_cast<OpenRGBDevicePage *>(ui->DevicesTabBar->widget(device))->SetCustomMode();
qobject_cast<OpenRGBDevicePage *>(ui->DevicesTabBar->widget(device))->SetDevice(red, green, blue);
}
}
+78 -62
View File
@@ -14,72 +14,88 @@
<string>OpenRGB</string>
</property>
<widget class="QWidget" name="centralWidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTabWidget" name="MainTabBar">
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
<widget class="QTabWidget" name="MainTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>351</height>
</rect>
</property>
<property name="tabShape">
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<widget class="QWidget" name="TabDevices">
<attribute name="title">
<string>Devices</string>
</attribute>
<widget class="QTabWidget" name="DevicesTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>320</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
</widget>
</widget>
<widget class="QWidget" name="TabEffects">
<attribute name="title">
<string>Synchronized Effects</string>
</attribute>
<widget class="QTabWidget" name="EffectsTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>321</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>-1</number>
</property>
<property name="iconSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<widget class="QWidget" name="TabDevices">
<attribute name="title">
<string>Devices</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QTabWidget" name="DevicesTabBar">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabEffects">
<attribute name="title">
<string>Synchronized Effects</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QTabWidget" name="EffectsTabBar">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabInformation">
<attribute name="title">
<string>Information</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTabWidget" name="InformationTabBar">
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabInformation">
<attribute name="title">
<string>Information</string>
</attribute>
<widget class="QTabWidget" name="InformationTabBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<height>321</height>
</rect>
</property>
<property name="tabPosition">
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</widget>
</widget>
</widget>
</widget>
<resources/>
+107 -59
View File
@@ -13,65 +13,113 @@
<property name="windowTitle">
<string>Frame</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="SMBusAdaptersLabel">
<property name="text">
<string>SMBus Adapters:</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="SMBusAdaptersBox"/>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="DetectButton">
<property name="text">
<string>Detect Devices</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="SMBusDumpLabel">
<property name="text">
<string>SMBus Dumper:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="DumpAddressLabel">
<property name="text">
<string>Address:</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QSpinBox" name="DumpAddressBox">
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>0x</string>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="displayIntegerBase">
<number>16</number>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="DumpButton">
<property name="text">
<string>Dump Device</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QPlainTextEdit" name="SMBusDataText"/>
</item>
</layout>
<widget class="QLabel" name="SMBusAdaptersLabel">
<property name="geometry">
<rect>
<x>50</x>
<y>10</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>SMBus Adapters:</string>
</property>
</widget>
<widget class="QComboBox" name="SMBusAdaptersBox">
<property name="geometry">
<rect>
<x>160</x>
<y>10</y>
<width>200</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QPlainTextEdit" name="SMBusDataText">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>400</width>
<height>210</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="DetectButton">
<property name="geometry">
<rect>
<x>370</x>
<y>10</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Detect Devices</string>
</property>
</widget>
<widget class="QPushButton" name="DumpButton">
<property name="geometry">
<rect>
<x>370</x>
<y>40</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Dump Device</string>
</property>
</widget>
<widget class="QLabel" name="SMBusDumpLabel">
<property name="geometry">
<rect>
<x>50</x>
<y>40</y>
<width>100</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>SMBus Dumper:</string>
</property>
</widget>
<widget class="QLabel" name="DumpAddressLabel">
<property name="geometry">
<rect>
<x>220</x>
<y>40</y>
<width>51</width>
<height>22</height>
</rect>
</property>
<property name="text">
<string>Address:</string>
</property>
</widget>
<widget class="QSpinBox" name="DumpAddressBox">
<property name="geometry">
<rect>
<x>280</x>
<y>40</y>
<width>80</width>
<height>22</height>
</rect>
</property>
<property name="suffix">
<string/>
</property>
<property name="prefix">
<string>0x</string>
</property>
<property name="maximum">
<number>255</number>
</property>
<property name="displayIntegerBase">
<number>16</number>
</property>
</widget>
</widget>
<resources/>
<connections/>