Fix Thermaltake Riing controller

This commit is contained in:
Adam Honse 2020-03-08 17:07:57 -05:00
parent 57b8377f5a
commit da54e89839
3 changed files with 30 additions and 31 deletions

View file

@ -41,7 +41,7 @@ void ThermaltakeRiingController::SetChannelLEDs(unsigned char channel, RGBColor
color_data[color_idx + 2] = RGBGetBValue(colors[color]);
}
SendRGB(channel, current_mode, current_speed, num_colors, color_data);
SendRGB(channel + 1, current_mode, current_speed, num_colors, color_data);
delete[] color_data;
}

View file

@ -42,6 +42,8 @@ enum
THERMALTAKE_SPEED_EXTREME = 0x00
};
#define THERMALTAKE_NUM_CHANNELS 5
class ThermaltakeRiingController
{
public:
@ -51,7 +53,7 @@ public:
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
void SetMode(unsigned char mode, unsigned char speed);
unsigned int channel_leds[5];
unsigned int channel_leds[THERMALTAKE_NUM_CHANNELS];
private:
libusb_device_handle* dev;

View file

@ -115,40 +115,37 @@ void RGBController_ThermaltakeRiing::SetupZones()
/*-------------------------------------------------*\
| Set zones and leds |
\*-------------------------------------------------*/
for (unsigned int channel_idx = 0; channel_idx < 5; channel_idx++)
for (unsigned int channel_idx = 0; channel_idx < THERMALTAKE_NUM_CHANNELS; channel_idx++)
{
if(riing->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 = "Riing Channel ";
new_zone->name.append(ch_idx_string);
new_zone->type = ZONE_TYPE_LINEAR;
new_zone->leds_min = 0;
new_zone->leds_max = 60;
new_zone->leds_count = riing->channel_leds[channel_idx];
for (unsigned int led_ch_idx = 0; led_ch_idx < riing->channel_leds[channel_idx]; led_ch_idx++)
{
zone* new_zone = new zone;
char led_idx_string[3];
sprintf(led_idx_string, "%d", led_ch_idx + 1);
char ch_idx_string[2];
sprintf(ch_idx_string, "%d", channel_idx + 1);
led new_led;
new_led.name = "Riing Channel ";
new_led.name.append(ch_idx_string);
new_led.name.append(", LED ");
new_led.name.append(led_idx_string);
new_zone->name = "Riing Channel ";
new_zone->name.append(ch_idx_string);
new_zone->type = ZONE_TYPE_LINEAR;
new_zone->leds_min = 0;
new_zone->leds_max = 60;
new_zone->leds_count = riing->channel_leds[channel_idx];
for (unsigned int led_ch_idx = 0; led_ch_idx < riing->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 = "Riing 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 + 1);
}
zones.push_back(*new_zone);
leds.push_back(new_led);
leds_channel.push_back(channel_idx);
}
zones.push_back(*new_zone);
}
SetupColors();