Skip to content

Commit 53d2321

Browse files
Fix issue in ArcticController where it was trying to create a variable-length buffer and breaking Windows build
1 parent 4e14f03 commit 53d2321

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Controllers/ArcticController/ArcticController.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ const unsigned char identify_payload[] =
4646
};
4747

4848
ArcticController::ArcticController(const std::string &portname)
49-
: port_name(portname),
50-
serialport(portname.c_str(), 250000, SERIAL_PORT_PARITY_NONE, SERIAL_PORT_SIZE_8, SERIAL_PORT_STOP_BITS_2, false)
49+
: serialport(portname.c_str(), 250000, SERIAL_PORT_PARITY_NONE, SERIAL_PORT_SIZE_8, SERIAL_PORT_STOP_BITS_2, false)
5150
{
51+
port_name = portname;
5252
serialport.serial_set_dtr(true);
5353
}
5454

@@ -65,7 +65,7 @@ static void FormatCommandBuffer(char *buffer, char command)
6565

6666
void ArcticController::SetChannels(std::vector<RGBColor> colors)
6767
{
68-
char buffer[ARCTIC_COMMAND_BUFFER_LENGTH(colors.size() * 3)];
68+
char* buffer = new char[ARCTIC_COMMAND_BUFFER_LENGTH(colors.size() * 3)];
6969

7070
FormatCommandBuffer(buffer, ARCTIC_COMMAND_SET_RGB);
7171

@@ -79,6 +79,8 @@ void ArcticController::SetChannels(std::vector<RGBColor> colors)
7979
}
8080

8181
serialport.serial_write(buffer, sizeof(buffer));
82+
83+
delete[] buffer;
8284
}
8385

8486
static char XORChecksum(char *data, int length)

0 commit comments

Comments
 (0)