mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-10 23:53:08 -04:00
Add TPM2 protocol support for LED Strip controller
This commit is contained in:
@@ -34,6 +34,11 @@ void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < ledstrip_settings["devices"].size(); device_idx++)
|
||||
{
|
||||
/*-------------------------------------------------*\
|
||||
| Default to the Keyboard Visualizer protocol |
|
||||
\*-------------------------------------------------*/
|
||||
dev.protocol = LED_PROTOCOL_KEYBOARD_VISUALIZER;
|
||||
|
||||
if(ledstrip_settings["devices"][device_idx].contains("port"))
|
||||
{
|
||||
dev.port = ledstrip_settings["devices"][device_idx]["port"];
|
||||
@@ -49,10 +54,28 @@ void DetectLEDStripControllers(std::vector<RGBController*> &rgb_controllers)
|
||||
dev.num_leds = ledstrip_settings["devices"][device_idx]["num_leds"];
|
||||
}
|
||||
|
||||
if(ledstrip_settings["devices"][device_idx].contains("protocol"))
|
||||
{
|
||||
std::string protocol_string = ledstrip_settings["devices"][device_idx]["protocol"];
|
||||
|
||||
if(protocol_string == "keyboard_visualizer")
|
||||
{
|
||||
dev.protocol = LED_PROTOCOL_KEYBOARD_VISUALIZER;
|
||||
}
|
||||
else if(protocol_string == "adalight")
|
||||
{
|
||||
dev.protocol = LED_PROTOCOL_ADALIGHT;
|
||||
}
|
||||
else if(protocol_string == "tpm2")
|
||||
{
|
||||
dev.protocol = LED_PROTOCOL_TPM2;
|
||||
}
|
||||
}
|
||||
|
||||
std::string value = dev.port + "," + std::to_string(dev.baud) + "," + std::to_string(dev.num_leds);
|
||||
|
||||
new_ledstrip = new LEDStripController();
|
||||
new_ledstrip->Initialize((char *)value.c_str());
|
||||
new_ledstrip->Initialize((char *)value.c_str(), dev.protocol);
|
||||
|
||||
new_controller = new RGBController_LEDStrip(new_ledstrip);
|
||||
rgb_controllers.push_back(new_controller);
|
||||
|
||||
Reference in New Issue
Block a user