Even more warning fixes

This commit is contained in:
Adam Honse 2024-04-29 19:57:57 -05:00
parent d3c81d3306
commit ba57bad361
29 changed files with 116 additions and 117 deletions

View file

@ -150,7 +150,7 @@ void RGBController_CorsairV2SW::SetupZones()
LOG_DEBUG("[%s] Created KB matrix with %d rows and %d columns containing %d keys",
controller->GetName().c_str(), new_kb.GetRowCount(), new_kb.GetColumnCount(), new_zone.leds_count);
for(size_t led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
for(unsigned int led_idx = 0; led_idx < new_zone.leds_count; led_idx++)
{
led new_led;

View file

@ -107,9 +107,9 @@ void CryorigH7QuadLumiController::SetChannelEffect
/*-----------------------------------------------------*\
| Fill in color data (up to 40 colors) |
\*-----------------------------------------------------*/
for(int idx = 0; idx < num_colors; idx++)
for(unsigned int idx = 0; idx < num_colors; idx++)
{
int pixel_idx = idx * 3;
unsigned int pixel_idx = idx * 3;
RGBColor color = colors[idx];
color_data[pixel_idx + 0x00] = RGBGetGValue(color);
color_data[pixel_idx + 0x01] = RGBGetRValue(color);
@ -135,9 +135,9 @@ void CryorigH7QuadLumiController::SetChannelLEDs
/*-----------------------------------------------------*\
| Fill in color data (up to 40 colors) |
\*-----------------------------------------------------*/
for(int idx = 0; idx < num_colors; idx++)
for(unsigned int idx = 0; idx < num_colors; idx++)
{
int pixel_idx = idx * 3;
unsigned int pixel_idx = idx * 3;
RGBColor color = colors[idx];
color_data[pixel_idx + 0x00] = RGBGetGValue(color);
color_data[pixel_idx + 0x01] = RGBGetRValue(color);

View file

@ -240,7 +240,7 @@ void RGBController_CryorigH7QuadLumi::DeviceUpdateMode()
modes[active_mode].speed,
direction,
colors,
modes[active_mode].colors.size()
(unsigned int)modes[active_mode].colors.size()
);
}
}

View file

@ -333,9 +333,9 @@ int DasKeyboardController::ReceiveData(unsigned char *data, const unsigned int m
{
return(-1);
}
if(response_size > max_length)
if(response_size > (int)max_length)
{
response_size = static_cast<int>(max_length);
response_size = (int)max_length;
}
/*-----------------------------------------------------*\

View file

@ -455,7 +455,7 @@ void RGBController_EVGAKeyboard::SetupZones()
\*---------------------------------------------------------*/
for(std::size_t zone_index = 0; zone_index < zones.size(); zone_index++)
{
int zone_offset = leds.size();
unsigned int zone_offset = (unsigned int)leds.size();
for(unsigned int led_index = 0; led_index < zones[zone_index].leds_count; led_index++)
{

View file

@ -37,10 +37,10 @@ static uint8_t endorfy_map[EVISION_V2_MATRIX_WIDTH * EVISION_V2_MATRIX_HEIGHT] =
{
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 19 19 20 */
0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 80, 81, 82,
84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 99, 101, 102, 103, 104,
84, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97, 99, 101, 102, 103, 104,
105, 106, 107, 111, 115, 116, 117, 118, 119, 120, 121, 123, 124,
};
@ -73,7 +73,7 @@ EVisionV2KeyboardController::EVisionV2KeyboardController(hid_device* dev_handle,
map_size = buffer[5];
macros_size = buffer[6] * 0x80;
switch(layout)
{
case EVISION_V2_KEYBOARD_LAYOUT:
@ -197,7 +197,7 @@ int EVisionV2KeyboardController::Read(uint8_t cmd, uint16_t offset, uint16_t siz
{
while(size > 0)
{
uint8_t pktsz = std::min<size_t>(size, EVISION_V2_PACKET_SIZE - 8);
uint8_t pktsz = (uint8_t)std::min<size_t>(size, EVISION_V2_PACKET_SIZE - 8);
int result = Query(cmd, offset, nullptr, pktsz, odata);
if(result <= 0)
{
@ -218,7 +218,7 @@ int EVisionV2KeyboardController::Write(uint8_t cmd, uint16_t offset, const uint8
{
while(size > 0)
{
uint8_t pktsz = std::min<size_t>(size, EVISION_V2_PACKET_SIZE - 8);
uint8_t pktsz = (uint8_t)std::min<size_t>(size, EVISION_V2_PACKET_SIZE - 8);
int result = Query(cmd, offset, idata, pktsz);
if(result <= 0)
{
@ -387,7 +387,7 @@ void EVisionV2KeyboardController::SetLedsDirect(const std::vector<RGBColor>& col
buffer[j + 2] = RGBGetBValue(colours[i]);
}
Write(EVISION_V2_CMD_SEND_DYNAMIC_COLORS, 0, buffer, 3 * map_size);
Write(EVISION_V2_CMD_SEND_DYNAMIC_COLORS, 0, buffer, (uint16_t)(3 * map_size));
delete[] buffer;
}
@ -425,7 +425,7 @@ int EVisionV2KeyboardController::GetLedsCustom(uint8_t colorset, std::vector<RGB
uint8_t* buffer = new uint8_t[3 * map_size];
memset(buffer, 0, 3 * map_size);
int ret = Read(EVISION_V2_CMD_READ_CUSTOM_COLORS, 512 * colorset, 3 * map_size, buffer);
int ret = Read(EVISION_V2_CMD_READ_CUSTOM_COLORS, 512 * colorset, (uint16_t)(3 * map_size), buffer);
if(ret < 0)
{
return ret;
@ -462,7 +462,7 @@ void EVisionV2KeyboardController::SetLedsCustom(uint8_t colorset, const std::vec
}
BeginConfigure();
Write(EVISION_V2_CMD_WRITE_CUSTOM_COLORS, 512 * colorset, buffer, 3 * map_size);
Write(EVISION_V2_CMD_WRITE_CUSTOM_COLORS, 512 * colorset, buffer, (uint16_t)(3 * map_size));
EndConfigure();
delete[] buffer;

View file

@ -819,7 +819,7 @@ void RGBController_EVisionV2Keyboard::LoadConfig()
config.direction = (config.direction == 0) ? 0 : 1;
// Define default colors
for(std::size_t mode_index = 0; mode_index < modes.size(); mode_index++)
for(int mode_index = 0; mode_index < (int)modes.size(); mode_index++)
{
if(config.random_colours)
{

View file

@ -18,20 +18,20 @@ FanBusInterface::FanBusInterface(const char* portname)
/*-----------------------------------------------------*\
| Flush any data in the receive queue |
\*-----------------------------------------------------*/
char read_buf[6];
unsigned char read_buf[6];
while(serialport->serial_read(read_buf, 6) > 0)
while(serialport->serial_read((char *)read_buf, 6) > 0)
{
}
read_buf[0] = 0xFF;
serialport->serial_write(read_buf, 1);
serialport->serial_write((char *)read_buf, 1);
std::this_thread::sleep_for(10ms);
int test = serialport->serial_read(read_buf, 1);
int test = serialport->serial_read((char *)read_buf, 1);
if(test > 0)
{
@ -121,10 +121,10 @@ void FanBusInterface::write_queue
int FanBusInterface::process_queue()
{
int return_val = serialport->serial_write((char *)&fanbus_msg_queued[0], fanbus_msg_queued.size());
int return_val = serialport->serial_write((char *)&fanbus_msg_queued[0], (int)fanbus_msg_queued.size());
fanbus_msg_queued.clear();
return(return_val);
}

View file

@ -162,9 +162,9 @@ unsigned char GigabyteAorusLaptopController::GetColourIndex(unsigned char red, u
| 0x07 white |
\*-----------------------------------------------------*/
unsigned int divisor = GetLargestColour( red, green, blue);
unsigned int r = round( red / divisor );
unsigned int g = round( green / divisor );
unsigned int b = round( blue / divisor );
unsigned int r = (int)round( red / divisor );
unsigned int g = (int)round( green / divisor );
unsigned int b = (int)round( blue / divisor );
unsigned char idx = argb_colour_index_data[r][g][b];
return idx;
}

View file

@ -84,7 +84,7 @@ void RGBFusion2SMBusController::WriteLED(int led)
std::cout << std::endl;
#endif
bus->i2c_smbus_write_block_data(RGB_FUSION_2_SMBUS_ADDR, write_register, 32, led_data[led]);
bus->i2c_smbus_write_block_data(RGB_FUSION_2_SMBUS_ADDR, (u8)write_register, 32, led_data[led]);
}
void RGBFusion2SMBusController::Apply()

View file

@ -246,7 +246,7 @@ void RGBController_RGBFusion2SMBus::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_RGBFusion2SMBus::DeviceUpdateLEDs()
{
for (std::size_t led = 0; led < colors.size(); led++)
for(unsigned int led = 0; led < (unsigned int)colors.size(); led++)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
@ -292,4 +292,4 @@ void RGBController_RGBFusion2SMBus::DeviceUpdateMode()
int RGBController_RGBFusion2SMBus::GetDeviceMode()
{
return(0);
}
}

View file

@ -583,7 +583,7 @@ void RGBController_RGBFusion2USB::ResizeZone(int zone, int new_size)
void RGBController_RGBFusion2USB::DeviceUpdateLEDs()
{
for(size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++)
{
UpdateZoneLEDs(zone_idx);
}
@ -750,7 +750,7 @@ void RGBController_RGBFusion2USB::DeviceUpdateMode()
int RGBController_RGBFusion2USB::GetLED_Zone(int led_idx)
{
for(size_t zone_idx = 0; zone_idx < zones.size(); zone_idx++)
for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++)
{
int zone_start = zones[zone_idx].start_idx;
int zone_end = zone_start + zones[zone_idx].leds_count - 1;

View file

@ -126,7 +126,7 @@ void RGBController_RGBFusion::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_RGBFusion::DeviceUpdateLEDs()
{
for (std::size_t led = 0; led < colors.size(); led++)
for(unsigned int led = 0; led < (unsigned int)colors.size(); led++)
{
RGBColor color = colors[led];
unsigned char red = RGBGetRValue(color);
@ -156,7 +156,7 @@ int RGBController_RGBFusion::GetDeviceMode()
{
int dev_mode = controller->GetMode();
for(std::size_t mode = 0; mode < modes.size(); mode++)
for(int mode = 0; mode < (int)modes.size(); mode++)
{
if(modes[mode].value == dev_mode)
{

View file

@ -155,9 +155,9 @@ void HPOmen30LController::SendZoneUpdate(int zone, std::vector<RGBColor> colors)
}
else
{
usb_buf[0x04] = colors.size();
usb_buf[0x04] = (unsigned char)colors.size();
for(unsigned int i = 0; i < colors.size(); i++)
for(unsigned int i = 0; i < (unsigned int)colors.size(); i++)
{
usb_buf[0x05] = i + 1;

View file

@ -168,7 +168,7 @@ void RGBController_HyperXDRAM::SetupZones()
new_led->name.append(", LED ");
new_led->name.append(std::to_string(led_idx + 1));
new_led->value = leds.size();
new_led->value = (unsigned int)leds.size();
leds.push_back(*new_led);
}
@ -188,7 +188,7 @@ void RGBController_HyperXDRAM::DeviceUpdateLEDs()
{
if(controller->GetMode() == HYPERX_MODE_DIRECT)
{
for (std::size_t led_idx = 0; led_idx < colors.size(); led_idx++ )
for(unsigned int led_idx = 0; led_idx < (unsigned int)colors.size(); led_idx++ )
{
RGBColor color = colors[led_idx];
unsigned char red = RGBGetRValue(color);
@ -213,7 +213,7 @@ void RGBController_HyperXDRAM::UpdateZoneLEDs(int zone)
{
if(controller->GetMode() == HYPERX_MODE_DIRECT)
{
for (std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++ )
for(std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++ )
{
unsigned int led = zones[zone].leds[led_idx].value;
RGBColor color = colors[led];

View file

@ -49,7 +49,7 @@ void HyperXAlloyOrigins60and65Controller::SetLEDsDirect(std::vector<RGBColor> co
| Set up variables to track progress of color transmit |
| Do this after inserting blanks |
\*-----------------------------------------------------*/
int colors_to_send = colors.size();
int colors_to_send = (int)colors.size();
int colors_sent = 0;
SendDirectInitialization();

View file

@ -60,7 +60,7 @@ void HyperXAlloyOriginsController::SetLEDsDirect(std::vector<RGBColor> colors)
| Set up variables to track progress of color transmit |
| Do this after inserting blanks |
\*-----------------------------------------------------*/
int colors_to_send = colors.size();
int colors_to_send = (int)colors.size();
int colors_sent = 0;
SendDirectInitialization();

View file

@ -76,7 +76,7 @@ void IonicoController::SetColors(int device, std::vector<RGBColor> array_colors,
for(size_t i = 0; i < array_colors.size(); i++)
{
usb_buf[1] = IONICO_DIRECT_CMD;
usb_buf[3] = i+1;
usb_buf[3] = (uint8_t)(i + 1);
usb_buf[4] = RGBGetRValue(array_colors[i]);
usb_buf[5] = RGBGetGValue(array_colors[i]);
usb_buf[6] = RGBGetBValue(array_colors[i]);

View file

@ -138,9 +138,9 @@ void RGBController_Ionico::SetupZones()
zone zone_keyboard;
zone_keyboard.name = "Keyboard";
zone_keyboard.type = ZONE_TYPE_LINEAR;
zone_keyboard.leds_min = leds.size();
zone_keyboard.leds_max = leds.size();
zone_keyboard.leds_count = leds.size();
zone_keyboard.leds_min = (unsigned int)leds.size();
zone_keyboard.leds_max = (unsigned int)leds.size();
zone_keyboard.leds_count = (unsigned int)leds.size();
zone_keyboard.matrix_map = nullptr;
zones.emplace_back(zone_keyboard);
for(size_t i = 0; i < leds.size(); ++i)
@ -154,9 +154,9 @@ void RGBController_Ionico::SetupZones()
zone zone_bar;
zone_bar.name = "Front Bar";
zone_bar.type = ZONE_TYPE_LINEAR;
zone_bar.leds_min = leds.size();
zone_bar.leds_max = leds.size();
zone_bar.leds_count = leds.size();
zone_bar.leds_min = (unsigned int)leds.size();
zone_bar.leds_max = (unsigned int)leds.size();
zone_bar.leds_count = (unsigned int)leds.size();
zone_bar.matrix_map = nullptr;
zones.emplace_back(zone_bar);
for(size_t i = 0; i < leds.size(); ++i)

View file

@ -236,7 +236,7 @@ void KasaSmartController::TurnOff()
bool KasaSmartController::SendCommand(std::string command, std::string &response)
{
const unsigned char* encrypted_payload = KasaSmartController::Encrypt(command);
port.tcp_client_write((char*)encrypted_payload, command.length() + sizeof(unsigned long));
port.tcp_client_write((char*)encrypted_payload, (int)(command.length() + sizeof(unsigned long)));
delete[] encrypted_payload;
unsigned char* receive_buffer = new unsigned char[KASA_SMART_RECEIVE_BUFFER_SIZE];
@ -283,13 +283,13 @@ unsigned char* KasaSmartController::Encrypt(const std::string request)
/*----------------------------------------------------------------*\
| "Encrypted" payload consists of size as a uint32 + XOR'd payload |
\*----------------------------------------------------------------*/
uint32_t size = htonl(request.length());
int payload_size = request.length() + sizeof(size);
uint32_t size = htonl((uint32_t)request.length());
int payload_size = (int)(request.length() + sizeof(size));
unsigned char* payload = new unsigned char[payload_size];
memcpy(payload, &size, sizeof(size));
unsigned char* request_data = new unsigned char[request.length()];
memcpy(request_data, request.data(), request.length());
KasaSmartController::XorPayload(request_data, request.length());
KasaSmartController::XorPayload(request_data, (int)request.length());
memcpy(payload + sizeof(size), request_data, request.length());
delete[] request_data;
return payload;

View file

@ -195,7 +195,7 @@ void LEDStripController::SetLEDsKeyboardVisualizer(std::vector<RGBColor> colors)
| n+1: Checksum MSB |
| n+2: Checksum LSB |
\*-------------------------------------------------------------*/
unsigned int payload_size = (colors.size() * 3);
unsigned int payload_size = (unsigned int)(colors.size() * 3);
unsigned int packet_size = payload_size + 3;
serial_buf = new unsigned char[packet_size];
@ -265,7 +265,7 @@ void LEDStripController::SetLEDsAdalight(std::vector<RGBColor> colors)
| 5: Checksum (MSB xor LSB xor 0x55) |
| 6-n: Data Bytes |
\*-------------------------------------------------------------*/
unsigned int led_count = colors.size();
unsigned int led_count = (unsigned int)colors.size();
unsigned int payload_size = (led_count * 3);
unsigned int packet_size = payload_size + 6;
@ -320,7 +320,7 @@ void LEDStripController::SetLEDsTPM2(std::vector<RGBColor> colors)
| 4-n: Data Bytes |
| n+1: Packet End Byte (0x36) |
\*-------------------------------------------------------------*/
unsigned int payload_size = (colors.size() * 3);
unsigned int payload_size = (unsigned int)(colors.size() * 3);
unsigned int packet_size = payload_size + 5;
serial_buf = new unsigned char[packet_size];

View file

@ -58,7 +58,7 @@ void LenovoGen7USBController::setLedsByGroup(uint8_t profile_id, vector<led_grou
for(size_t group = 0; group < led_groups.size() && i < PACKET_SIZE - 21; group++)
{
buffer[i++] = group + 1; //Group index
buffer[i++] = (uint8_t)(group + 1); //Group index
buffer[i++] = 0x06;
buffer[i++] = 0x01;
buffer[i++] = led_groups[group].mode;
@ -73,7 +73,7 @@ void LenovoGen7USBController::setLedsByGroup(uint8_t profile_id, vector<led_grou
buffer[i++] = 0x06;
buffer[i++] = 0x00;
buffer[i++] = led_groups[group].colors.size();
buffer[i++] = (uint8_t)led_groups[group].colors.size();
for(RGBColor c : led_groups[group].colors)
{
buffer[i++] = RGBGetRValue(c);
@ -83,13 +83,13 @@ void LenovoGen7USBController::setLedsByGroup(uint8_t profile_id, vector<led_grou
vector<uint16_t> leds = led_groups[group].leds;
size_t led_count = min(leds.size(), (PACKET_SIZE - i)/2);
buffer[i++] = led_count;
buffer[i++] = (uint8_t)led_count;
uint8_t* byte_ptr = reinterpret_cast<uint8_t*>(leds.data());
std::copy(byte_ptr, byte_ptr + led_count * sizeof(uint16_t), buffer + i);
i+= led_count * sizeof(uint16_t);
}
buffer[2] = i;
buffer[2] = (uint8_t)i;
sendFeatureReport(buffer, PACKET_SIZE);
}

View file

@ -58,7 +58,7 @@ void LenovoGen7And8USBController::setLedsByGroup(uint8_t profile_id, vector<led_
for(size_t group = 0; group < led_groups.size() && i < PACKET_SIZE - 21; group++)
{
buffer[i++] = group + 1; //Group index
buffer[i++] = (uint8_t)group + 1; //Group index
buffer[i++] = 0x06;
buffer[i++] = 0x01;
buffer[i++] = led_groups[group].mode;
@ -73,7 +73,7 @@ void LenovoGen7And8USBController::setLedsByGroup(uint8_t profile_id, vector<led_
buffer[i++] = 0x06;
buffer[i++] = 0x00;
buffer[i++] = led_groups[group].colors.size();
buffer[i++] = (uint8_t)led_groups[group].colors.size();
for(RGBColor c : led_groups[group].colors)
{
buffer[i++] = RGBGetRValue(c);
@ -83,13 +83,13 @@ void LenovoGen7And8USBController::setLedsByGroup(uint8_t profile_id, vector<led_
vector<uint16_t> leds = led_groups[group].leds;
size_t led_count = min(leds.size(), (PACKET_SIZE - i)/2);
buffer[i++] = led_count;
buffer[i++] = (uint8_t)led_count;
uint8_t* byte_ptr = reinterpret_cast<uint8_t*>(leds.data());
std::copy(byte_ptr, byte_ptr + led_count * sizeof(uint16_t), buffer + i);
i+= led_count * sizeof(uint16_t);
}
buffer[2] = i;
buffer[2] = (uint8_t)i;
sendFeatureReport(buffer, PACKET_SIZE);
}

View file

@ -89,7 +89,7 @@ void RGBController_LenovoM300::SetupZones()
SetupColors();
}
void RGBController_LenovoM300::ResizeZone(int zone, int new_size)
void RGBController_LenovoM300::ResizeZone(int /*zone*/, int /*new_size*/)
{
// Not Supported
}
@ -100,12 +100,12 @@ void RGBController_LenovoM300::DeviceUpdateLEDs()
controller->SetMode(active.colors, active.value, active.brightness);
}
void RGBController_LenovoM300::UpdateZoneLEDs(int zone)
void RGBController_LenovoM300::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_LenovoM300::UpdateSingleLED(int led)
void RGBController_LenovoM300::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}

View file

@ -338,12 +338,12 @@ void LenovoRGBController_Gen7_8::ResizeZone(int /*zone*/, int /*new_size*/)
\*---------------------------------------------------------*/
}
void LenovoRGBController_Gen7_8::UpdateSingleLED(int led)
void LenovoRGBController_Gen7_8::UpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void LenovoRGBController_Gen7_8::UpdateZoneLEDs(int led)
void LenovoRGBController_Gen7_8::UpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}

View file

@ -105,18 +105,18 @@ void LianLiUniHubALController::SetChannelLEDs(unsigned char channel, RGBColor *
//Determine current position of led_data array from colors array
cur_led_idx = ((mod_led_idx + (fan_idx * 8)) * 3);
fan_led_data[cur_led_idx + 0] = RGBGetRValue(colors[led_idx]) * brightness;
fan_led_data[cur_led_idx + 1] = RGBGetBValue(colors[led_idx]) * brightness;
fan_led_data[cur_led_idx + 2] = RGBGetGValue(colors[led_idx]) * brightness;
fan_led_data[cur_led_idx + 0] = (unsigned char)RGBGetRValue(colors[led_idx]) * brightness;
fan_led_data[cur_led_idx + 1] = (unsigned char)RGBGetBValue(colors[led_idx]) * brightness;
fan_led_data[cur_led_idx + 2] = (unsigned char)RGBGetGValue(colors[led_idx]) * brightness;
}
else // Edge LEDs, 12 LEDs per fan
{
//Determine current position of led_data array from colors array
cur_led_idx = (((mod_led_idx - 8) + (fan_idx * 12)) * 3);
edge_led_data[cur_led_idx + 0] = RGBGetRValue(colors[led_idx]) * brightness;
edge_led_data[cur_led_idx + 1] = RGBGetBValue(colors[led_idx]) * brightness;
edge_led_data[cur_led_idx + 2] = RGBGetGValue(colors[led_idx]) * brightness;
edge_led_data[cur_led_idx + 0] = (unsigned char)RGBGetRValue(colors[led_idx]) * brightness;
edge_led_data[cur_led_idx + 1] = (unsigned char)RGBGetBValue(colors[led_idx]) * brightness;
edge_led_data[cur_led_idx + 2] = (unsigned char)RGBGetGValue(colors[led_idx]) * brightness;
}
}
@ -228,17 +228,17 @@ void LianLiUniHubALController::SetChannelMode(unsigned char channel, unsigned in
for(unsigned int led_idx = 0; led_idx < 22; led_idx += 3)
{
cur_led_idx = (i * 8 * 3) + led_idx;
fan_led_data[cur_led_idx + 0] = (RGBGetRValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (RGBGetBValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (RGBGetGValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[i]) * brightness_scale);
}
for(unsigned int led_idx = 0; led_idx < 34; led_idx += 3)
{
cur_led_idx = (i * 12 * 3) + led_idx;
edge_led_data[cur_led_idx + 0] = (RGBGetRValue(colors[i]) * brightness_scale);
edge_led_data[cur_led_idx + 1] = (RGBGetBValue(colors[i]) * brightness_scale);
edge_led_data[cur_led_idx + 2] = (RGBGetGValue(colors[i]) * brightness_scale);
edge_led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[i]) * brightness_scale);
edge_led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[i]) * brightness_scale);
edge_led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[i]) * brightness_scale);
}
}
break;

View file

@ -109,9 +109,9 @@ void LianLiUniHubSLInfinityController::SetChannelLEDs(unsigned char channel, RGB
//Determine current position of led_data array from colors array
cur_led_idx = ((mod_led_idx + (fan_idx * 16)) * 3);
led_data[cur_led_idx + 0] = RGBGetRValue(colors[led_idx]) * brightness_scale;
led_data[cur_led_idx + 1] = RGBGetBValue(colors[led_idx]) * brightness_scale;
led_data[cur_led_idx + 2] = RGBGetGValue(colors[led_idx]) * brightness_scale;
led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[led_idx]) * brightness_scale);
led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[led_idx]) * brightness_scale);
led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[led_idx]) * brightness_scale);
}
/*---------------------------------------------------------*\
@ -185,9 +185,9 @@ void LianLiUniHubSLInfinityController::SetChannelMode(unsigned char channel, con
for(unsigned int led_idx = 0; led_idx < 16 * 3; led_idx += 3)
{
cur_led_idx = (i * 16 * 3) + led_idx;
fan_led_data[cur_led_idx + 0] = (RGBGetRValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (RGBGetBValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (RGBGetGValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[i]) * brightness_scale);
}
}
}
@ -206,9 +206,9 @@ void LianLiUniHubSLInfinityController::SetChannelMode(unsigned char channel, con
for(unsigned int i = 0; i < 6; i++)
{
cur_led_idx = (i * 12) + (j * 3);
fan_led_data[cur_led_idx + 0] = RGBGetRValue(colors[j]) * brightness_scale;
fan_led_data[cur_led_idx + 1] = RGBGetBValue(colors[j]) * brightness_scale;
fan_led_data[cur_led_idx + 2] = RGBGetGValue(colors[j]) * brightness_scale;
fan_led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[j]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[j]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[j]) * brightness_scale);
}
}
}
@ -217,28 +217,28 @@ void LianLiUniHubSLInfinityController::SetChannelMode(unsigned char channel, con
SendStartAction
(
channel, // Current channel
(num_fans + 1) // Number of fans
channel, // Current channel
(num_fans + 1) // Number of fans
);
SendColorData
(
channel, // Channel
channel, // Channel
(num_fans + 1)*16,
fan_led_data // Data
fan_led_data // Data
);
SendCommitAction
(
channel, // Channel
active_mode.value, // Effect
speed_code[active_mode.speed], // Speed
active_mode.direction, // Direction
brightness_code[active_mode.brightness] // Brightness
channel, // Channel
active_mode.value, // Effect
speed_code[active_mode.speed], // Speed
active_mode.direction, // Direction
brightness_code[active_mode.brightness] // Brightness
);
}
void LianLiUniHubSLInfinityController::SendStartAction(unsigned char channel, unsigned int num_fans)
void LianLiUniHubSLInfinityController::SendStartAction(unsigned char channel, unsigned int /*num_fans*/)
{
unsigned char usb_buf[65];

View file

@ -108,9 +108,9 @@ void LianLiUniHubSLV2Controller::SetChannelLEDs(unsigned char channel, RGBColor
//Determine current position of led_data array from colors array
cur_led_idx = ((mod_led_idx + (fan_idx * 16)) * 3);
led_data[cur_led_idx + 0] = RGBGetRValue(colors[led_idx]) * brightness_scale;
led_data[cur_led_idx + 1] = RGBGetBValue(colors[led_idx]) * brightness_scale;
led_data[cur_led_idx + 2] = RGBGetGValue(colors[led_idx]) * brightness_scale;
led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[led_idx]) * brightness_scale);
led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[led_idx]) * brightness_scale);
led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[led_idx]) * brightness_scale);
}
/*---------------------------------------------------------*\
@ -184,9 +184,9 @@ void LianLiUniHubSLV2Controller::SetChannelMode(unsigned char channel, const mod
for(unsigned int led_idx = 0; led_idx < 16 * 3; led_idx += 3)
{
cur_led_idx = (i * 16 * 3) + led_idx;
fan_led_data[cur_led_idx + 0] = (RGBGetRValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (RGBGetBValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (RGBGetGValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[i]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[i]) * brightness_scale);
}
}
}
@ -205,13 +205,12 @@ void LianLiUniHubSLV2Controller::SetChannelMode(unsigned char channel, const mod
for(unsigned int i = 0; i < 6; i++)
{
cur_led_idx = (i * 12) + (j * 3);
fan_led_data[cur_led_idx + 0] = RGBGetRValue(colors[j]) * brightness_scale;
fan_led_data[cur_led_idx + 1] = RGBGetBValue(colors[j]) * brightness_scale;
fan_led_data[cur_led_idx + 2] = RGBGetGValue(colors[j]) * brightness_scale;
fan_led_data[cur_led_idx + 0] = (unsigned char)(RGBGetRValue(colors[j]) * brightness_scale);
fan_led_data[cur_led_idx + 1] = (unsigned char)(RGBGetBValue(colors[j]) * brightness_scale);
fan_led_data[cur_led_idx + 2] = (unsigned char)(RGBGetGValue(colors[j]) * brightness_scale);
}
}
}
}
SendStartAction

View file

@ -754,14 +754,14 @@ void LianLiUniHub_AL10Controller::SendConfig(uint16_t wIndex, uint8_t *config,
/*-------------------------------------*\
| Send packet |
\*-------------------------------------*/
size_t ret = libusb_control_transfer(handle, /* dev_handle */
0x40, /* bmRequestType */
0x80, /* bRequest */
0x00, /* wValue */
wIndex, /* wIndex */
config, /* data */
length, /* wLength */
1000); /* timeout */
size_t ret = libusb_control_transfer(handle, /* dev_handle */
0x40, /* bmRequestType */
0x80, /* bRequest */
0x00, /* wValue */
wIndex, /* wIndex */
config, /* data */
(uint16_t)length, /* wLength */
1000); /* timeout */
std::this_thread::sleep_for(5ms);
/*-------------------------------------*\
| Check for communication error |