diff --git a/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.cpp b/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.cpp index 11f883be..3d2af818 100644 --- a/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.cpp +++ b/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.cpp @@ -216,7 +216,16 @@ void CorsairHydroPlatinumController::SendColors(std::vector colors, un unsigned int CorsairHydroPlatinumController::GetSequenceNumber() { - return ((sequence_number < 32) ? sequence_number++ : sequence_number = 1) << 3; + if(sequence_number < 31) + { + sequence_number++; + } + else + { + sequence_number = 1; + } + + return(sequence_number << 3); } uint8_t CorsairHydroPlatinumController::ComputePEC(const void * data, size_t size) diff --git a/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.h b/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.h index 514f6e96..e8f7be79 100644 --- a/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.h +++ b/Controllers/CorsairHydroPlatinumController/CorsairHydroPlatinumController.h @@ -43,7 +43,7 @@ private: std::string location; std::string firmware_version; - unsigned int sequence_number; + std::atomic sequence_number; void SendMagic(const uint8_t* magic, unsigned int command); void SendColors(std::vector colors, unsigned int start, unsigned int end, unsigned int command);