Add Aer 1 fan support to NZXT Hue 2 and Hue+

This commit is contained in:
Adam Honse 2020-01-08 21:21:11 -06:00
parent 50c9f7b84b
commit b06d56bb2d
5 changed files with 20 additions and 8 deletions

View file

@ -60,7 +60,11 @@ unsigned int Hue2Controller::GetStripsOnChannel(unsigned int /*channel*/)
case 0x01: //Hue 1 strip
num_leds_on_channel += 10;
break;
case 0x02: //Aer 1 fan
num_leds_on_channel += 8;
break;
case 0x04: //Hue 2 strip
num_leds_on_channel += 10;
break;

View file

@ -37,8 +37,8 @@ void HuePlusController::Initialize(char* port_name)
serialport = new serial_port(port_name, HUE_PLUS_BAUD);
channel_leds[HUE_PLUS_CHANNEL_1_IDX] = GetStripsOnChannel(HUE_PLUS_CHANNEL_1) * 10;
channel_leds[HUE_PLUS_CHANNEL_2_IDX] = GetStripsOnChannel(HUE_PLUS_CHANNEL_2) * 10;
channel_leds[HUE_PLUS_CHANNEL_1_IDX] = GetLEDsOnChannel(HUE_PLUS_CHANNEL_1);
channel_leds[HUE_PLUS_CHANNEL_2_IDX] = GetLEDsOnChannel(HUE_PLUS_CHANNEL_2);
}
char* HuePlusController::GetLEDString()
@ -46,7 +46,7 @@ char* HuePlusController::GetLEDString()
return(led_string);
}
unsigned int HuePlusController::GetStripsOnChannel(unsigned int channel)
unsigned int HuePlusController::GetLEDsOnChannel(unsigned int channel)
{
unsigned char serial_buf[] =
{
@ -68,9 +68,17 @@ unsigned int HuePlusController::GetStripsOnChannel(unsigned int channel)
int bytes_read = serialport->serial_read((char *)serial_buf, 5);
printf("%x %x %x %x %x \r\n", serial_buf[0], serial_buf[1], serial_buf[2], serial_buf[3], serial_buf[4]);
if(bytes_read == 5)
{
ret_val = serial_buf[4];
if(serial_buf[3] == 0x01)
{
ret_val = serial_buf[4] * 8;
}
else
{
ret_val += serial_buf[4] * 10;
}
}
return(ret_val);

View file

@ -55,7 +55,7 @@ public:
void Initialize(char* port_name);
char* GetLEDString();
unsigned int GetStripsOnChannel(unsigned int channel);
unsigned int GetLEDsOnChannel(unsigned int channel);
void SetChannelEffect(unsigned int channel, unsigned int mode, std::vector<RGBColor> colors);
void SetChannelLEDs(unsigned int channel, std::vector<RGBColor> colors);

View file

@ -92,7 +92,7 @@ void RGBController_Hue2::SetCustomMode()
void RGBController_Hue2::UpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx <= zones.size(); zone_idx++)
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];

View file

@ -94,7 +94,7 @@ void RGBController_HuePlus::SetCustomMode()
void RGBController_HuePlus::UpdateLEDs()
{
for(std::size_t zone_idx = 0; zone_idx <= zones.size(); zone_idx++)
for(std::size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
{
unsigned int channel = zones_channel[zone_idx];