Add direction support for NZXT Hue 2

This commit is contained in:
Adam Honse committed 2020-01-25 17:37:32 -06:00
1 parent 7ba610df77
commit 64f11b42f4
4 files changed
+34 -13

No files matched your search

+13 -5
View File
@@ -19,8 +19,9 @@ Hue2Controller::Hue2Controller(libusb_device_handle* dev_handle)
Hue2Controller::~Hue2Controller()
{
current_mode = HUE_2_MODE_FIXED;
current_speed = HUE_2_SPEED_NORMAL;
current_mode = HUE_2_MODE_FIXED;
current_speed = HUE_2_SPEED_NORMAL;
current_direction = false;
}
unsigned int Hue2Controller::GetStripsOnChannel(unsigned int /*channel*/)
@@ -84,10 +85,11 @@ unsigned int Hue2Controller::GetStripsOnChannel(unsigned int /*channel*/)
return(ret_val);
}
void Hue2Controller::SetMode(unsigned char mode, unsigned char speed)
void Hue2Controller::SetMode(unsigned char mode, unsigned char speed, bool direction)
{
current_mode = mode;
current_speed = speed;
current_mode = mode;
current_speed = speed;
current_direction = direction;
}
void Hue2Controller::SetChannelLEDs(unsigned char channel, std::vector<RGBColor> colors)
@@ -127,6 +129,12 @@ void Hue2Controller::SetChannelLEDs(unsigned char channel, std::vector<RGBColor>
| 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 |
\*-----------------------------------------------------*/
+2 -1
View File
@@ -59,7 +59,7 @@ 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);
void SetMode(unsigned char mode, unsigned char speed, bool direction);
unsigned int channel_leds[HUE_2_NUM_CHANNELS];
@@ -68,4 +68,5 @@ private:
unsigned char current_mode;
unsigned char current_speed;
bool current_direction;
};
@@ -24,8 +24,9 @@ static void Sleep(unsigned int milliseconds)
HuePlusController::HuePlusController()
{
current_mode = HUE_PLUS_MODE_FIXED;
current_speed = HUE_PLUS_SPEED_NORMAL;
current_mode = HUE_PLUS_MODE_FIXED;
current_speed = HUE_PLUS_SPEED_NORMAL;
current_direction = false;
}
HuePlusController::~HuePlusController()