diff --git a/OpenRGB.cpp b/OpenRGB.cpp index 021690db..cffacb35 100644 --- a/OpenRGB.cpp +++ b/OpenRGB.cpp @@ -321,7 +321,7 @@ void DetectRGBControllers(void) //DetectCrucialControllers(busses, rgb_controllers); DetectHyperXControllers(busses, rgb_controllers); //DetectPatriotViperControllers(busses, rgb_controllers); - //DetectPolychromeControllers(busses, rgb_controllers); + DetectPolychromeControllers(busses, rgb_controllers); DetectRGBFusionGPUControllers(busses, rgb_controllers); DetectRGBFusionControllers(busses, rgb_controllers); diff --git a/OpenRGB.pro b/OpenRGB.pro index 2e654251..89f95d40 100644 --- a/OpenRGB.pro +++ b/OpenRGB.pro @@ -45,7 +45,7 @@ INCLUDEPATH += \ # Controllers/MSI3ZoneController/ \ Controllers/MSIRGBController/ \ # Controllers/PatriotViperController/ \ -# Controllers/PolychromeController/ \ + Controllers/PolychromeController/ \ # Controllers/PoseidonZRGBController/ \ Controllers/RGBFusionController/ \ # Controllers/RGBFusion2Controller/ \ @@ -107,8 +107,8 @@ SOURCES += \ Controllers/MSIRGBController/MSIRGBControllerDetect.cpp \ # Controllers/PatriotViperController/PatriotViperController.cpp \ # Controllers/PatriotViperController/PatriotViperControllerDetect.cpp \ -# Controllers/PolychromeController/PolychromeController.cpp \ -# Controllers/PolychromeController/PolychromeControllerDetect.cpp \ + Controllers/PolychromeController/PolychromeController.cpp \ + Controllers/PolychromeController/PolychromeControllerDetect.cpp \ # Controllers/PoseidonZRGBController/PoseidonZRGBController.cpp \ # Controllers/PoseidonZRGBController/PoseidonZRGBControllerDetect.cpp \ Controllers/RGBFusionController/RGBFusionController.cpp \ @@ -139,7 +139,7 @@ SOURCES += \ # RGBController/RGBController_MSI3Zone.cpp \ RGBController/RGBController_MSIRGB.cpp \ # RGBController/RGBController_PatriotViper.cpp \ -# RGBController/RGBController_Polychrome.cpp \ + RGBController/RGBController_Polychrome.cpp \ # RGBController/RGBController_PoseidonZRGB.cpp \ RGBController/RGBController_RGBFusion.cpp \ # RGBController/RGBController_RGBFusion2.cpp \ diff --git a/RGBController/RGBController_Polychrome.cpp b/RGBController/RGBController_Polychrome.cpp index 70763ffe..03e7b2d7 100644 --- a/RGBController/RGBController_Polychrome.cpp +++ b/RGBController/RGBController_Polychrome.cpp @@ -9,29 +9,6 @@ #include "RGBController_Polychrome.h" - -void RGBController_Polychrome::UpdateLEDs() -{ - for (std::size_t led = 0; led < colors.size(); led++) - { - unsigned char red = RGBGetRValue(colors[led]); - unsigned char grn = RGBGetGValue(colors[led]); - unsigned char blu = RGBGetBValue(colors[led]); - - polychrome->SetColor(red, grn, blu); - } -} - -void RGBController_Polychrome::UpdateZoneLEDs(int zone) -{ - UpdateLEDs(); -} - -void RGBController_Polychrome::UpdateSingleLED(int led) -{ - UpdateLEDs(); -} - static const char* polychrome_zone_names[] = { "Motherboard" @@ -86,7 +63,7 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr Random.flags = MODE_FLAG_HAS_SPEED; Random.color_mode = MODE_COLORS_NONE; modes.push_back(Random); - + mode Music; Music.name = "Music"; Music.value = ASRLED_MODE_MUSIC; @@ -202,32 +179,80 @@ RGBController_Polychrome::RGBController_Polychrome(PolychromeController* polychr modes.push_back(Rainbow); } - colors.resize(polychrome->GetLEDCount()); + SetupZones(); +} - // Search through all LEDs and create zones for each channel type +void RGBController_Polychrome::SetupZones() +{ + /*---------------------------------------------------------*\ + | Set up zones | + \*---------------------------------------------------------*/ for (unsigned int i = 0; i < polychrome->GetLEDCount(); i++) { zone* new_zone = new zone(); - led* new_led = new led(); - std::vector* zone_row = new std::vector(); + /*---------------------------------------------------------*\ + | Set zone name to channel name | + \*---------------------------------------------------------*/ + new_zone->name = polychrome_zone_names[i]; + new_zone->leds_min = 1; + new_zone->leds_max = 1; + new_zone->leds_count = 1; - // Set zone name to channel name - new_zone->name = polychrome_zone_names[i]; - new_led->name = polychrome_zone_names[i]; - - zone_row->push_back(i); - - // Aura devices can be either single or linear, never matrix - // That means only one row is needed - new_zone->map.push_back(*zone_row); - - // Push new LED to LEDs vector - leds.push_back(*new_led); - - // Push new zone to zones vector + /*---------------------------------------------------------*\ + | Push new zone to zones vector | + \*---------------------------------------------------------*/ zones.push_back(*new_zone); } + + /*---------------------------------------------------------*\ + | Set up LEDs | + \*---------------------------------------------------------*/ + for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++) + { + /*---------------------------------------------------------*\ + | Each zone only has one LED | + \*---------------------------------------------------------*/ + led* new_led = new led(); + + new_led->name = polychrome_zone_names[zone_idx]; + + /*---------------------------------------------------------*\ + | Push new LED to LEDs vector | + \*---------------------------------------------------------*/ + leds.push_back(*new_led); + } + + SetupColors(); +} + +void RGBController_Polychrome::ResizeZone(int zone, int new_size) +{ + /*---------------------------------------------------------*\ + | This device does not support resizing zones | + \*---------------------------------------------------------*/ +} + +void RGBController_Polychrome::UpdateLEDs() +{ + for (std::size_t led = 0; led < colors.size(); led++) + { + unsigned char red = RGBGetRValue(colors[led]); + unsigned char grn = RGBGetGValue(colors[led]); + unsigned char blu = RGBGetBValue(colors[led]); + + polychrome->SetColor(red, grn, blu); + } +} + +void RGBController_Polychrome::UpdateZoneLEDs(int zone) +{ + UpdateLEDs(); +} + +void RGBController_Polychrome::UpdateSingleLED(int led) +{ + UpdateLEDs(); } void RGBController_Polychrome::SetCustomMode() diff --git a/RGBController/RGBController_Polychrome.h b/RGBController/RGBController_Polychrome.h index c8fa9cca..cd2d87f3 100644 --- a/RGBController/RGBController_Polychrome.h +++ b/RGBController/RGBController_Polychrome.h @@ -16,6 +16,11 @@ class RGBController_Polychrome : public RGBController { public: RGBController_Polychrome(PolychromeController* polychrome_ptr); + + void SetupZones(); + + void ResizeZone(int zone, int new_size); + void UpdateLEDs(); void UpdateZoneLEDs(int zone); void UpdateSingleLED(int led);