Controllers/MNTKeyboardController: MSVC does not like C99 variable length...

master
josch 5 months ago committed by Adam Honse
parent 246150b44a
commit 0b5010cda6

@ -20,7 +20,7 @@ void MNTKeyboardController::SendColorMatrix(unsigned char *color_map)
{
unsigned char row_size = kbd_cols * KBD_COLOR_SIZE;
unsigned char cmdbuf_size = CMD_OFFSET + row_size;
unsigned char usb_buf[cmdbuf_size];
unsigned char *usb_buf = new unsigned char[cmdbuf_size];
memcpy(usb_buf, CMD_PREFIX, CMD_PREFIX_LEN);
for(unsigned int row_idx = 0; row_idx < KBD_ROWS; row_idx++)
{
@ -28,4 +28,5 @@ void MNTKeyboardController::SendColorMatrix(unsigned char *color_map)
memcpy(usb_buf + CMD_OFFSET, color_map + row_idx * row_size, row_size);
hid_write(dev, usb_buf, cmdbuf_size);
}
delete[] usb_buf;
}

@ -52,7 +52,7 @@ void RGBController_MNTKeyboard::SetupZones()
void RGBController_MNTKeyboard::DeviceUpdateLEDs()
{
unsigned char color_map[zones[0].leds_count * KBD_COLOR_SIZE];
unsigned char *color_map = new unsigned char[zones[0].leds_count * KBD_COLOR_SIZE];
for(unsigned int led_idx = 0; led_idx < zones[0].leds_count; led_idx++)
{
RGBColor color = colors[led_idx];
@ -62,6 +62,7 @@ void RGBController_MNTKeyboard::DeviceUpdateLEDs()
color_map[offset + 0] = RGBGetBValue(color);
}
controller->SendColorMatrix(color_map);
delete[] color_map;
}
void RGBController_MNTKeyboard::ResizeZone(int, int)

Loading…
Cancel
Save