diff --git a/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp b/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp index 3f9e0bff..961b5b2c 100644 --- a/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp @@ -43,7 +43,7 @@ bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address) pass = true; } break; - + /*-----------------------------------------------------------------*\ | V1 Controller - RTX 3080 | \*-----------------------------------------------------------------*/ @@ -89,9 +89,8 @@ void DetectGalaxGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const case 0x32: case 0x23: { - GalaxGPUv1Controller* controller = new GalaxGPUv1Controller(bus, i2c_addr); + GalaxGPUv1Controller* controller = new GalaxGPUv1Controller(bus, i2c_addr, name); RGBController_GalaxGPUv1* rgb_controller = new RGBController_GalaxGPUv1(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } @@ -102,9 +101,8 @@ void DetectGalaxGPUControllers(i2c_smbus_interface* bus, uint8_t i2c_addr, const \*-----------------------------------------------------------------*/ case 0x51: { - GalaxGPUv2Controller* controller = new GalaxGPUv2Controller(bus, i2c_addr); + GalaxGPUv2Controller* controller = new GalaxGPUv2Controller(bus, i2c_addr, name); RGBController_GalaxGPUv2* rgb_controller = new RGBController_GalaxGPUv2(controller); - rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } diff --git a/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp b/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp index 39d384d6..209b5b39 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.cpp @@ -12,12 +12,11 @@ #include #include "GalaxGPUv1Controller.h" -GalaxGPUv1Controller::GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev) +GalaxGPUv1Controller::GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev, std::string dev_name) { - this->bus = bus; - this->dev = dev; - - strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder. + this->bus = bus; + this->dev = dev; + this->name = name; } GalaxGPUv1Controller::~GalaxGPUv1Controller() @@ -25,11 +24,6 @@ GalaxGPUv1Controller::~GalaxGPUv1Controller() } -std::string GalaxGPUv1Controller::GetDeviceName() -{ - return(device_name); -} - std::string GalaxGPUv1Controller::GetDeviceLocation() { std::string return_string(bus->device_name); @@ -40,6 +34,11 @@ std::string GalaxGPUv1Controller::GetDeviceLocation() return("I2C: " + return_string); } +std::string GalaxGPUv1Controller::GetDeviceName() +{ + return(name); +} + unsigned char GalaxGPUv1Controller::GetLEDRed() { return(GalaxGPURegisterRead(GALAX_V1_RED_REGISTER)); diff --git a/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.h b/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.h index b1d9a15e..92c580d8 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.h +++ b/Controllers/GalaxGPUController/GalaxGPUv1Controller/GalaxGPUv1Controller.h @@ -46,11 +46,11 @@ enum class GalaxGPUv1Controller { public: - GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id); + GalaxGPUv1Controller(i2c_smbus_interface* bus, galax_gpu_dev_id, std::string dev_name); ~GalaxGPUv1Controller(); - std::string GetDeviceName(); std::string GetDeviceLocation(); + std::string GetDeviceName(); unsigned char GetLEDRed(); unsigned char GetLEDGreen(); unsigned char GetLEDBlue(); @@ -64,7 +64,7 @@ public: bool direct = false; // Temporary solution to check if we are in "Direct" mode private: - char device_name[16]; i2c_smbus_interface * bus; galax_gpu_dev_id dev; + std::string name; }; diff --git a/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp b/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp index 35838fd5..9fb20902 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv1Controller/RGBController_GalaxGPUv1.cpp @@ -56,40 +56,40 @@ int RGBController_GalaxGPUv1::GetDeviceMode() RGBController_GalaxGPUv1::RGBController_GalaxGPUv1(GalaxGPUv1Controller* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = controller->GetDeviceName(); - vendor = "GALAX"; - type = DEVICE_TYPE_GPU; - description = "GALAX / KFA2 RTX GPU"; - location = controller->GetDeviceLocation(); + name = controller->GetDeviceName(); + vendor = "GALAX"; + type = DEVICE_TYPE_GPU; + description = "GALAX / KFA2 RTX GPU"; + location = controller->GetDeviceLocation(); mode Direct; - Direct.name = "Direct"; - Direct.value = 1; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.value = 1; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); mode Breathing; - Breathing.name = "Breathing"; - Breathing.value = 2; - Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Breathing.color_mode = MODE_COLORS_PER_LED; + Breathing.name = "Breathing"; + Breathing.value = 2; + Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Breathing.color_mode = MODE_COLORS_PER_LED; modes.push_back(Breathing); mode Rainbow; - Rainbow.name = "Rainbow"; - Rainbow.value = 3; - Rainbow.flags = 0; - Rainbow.color_mode = MODE_COLORS_NONE; + Rainbow.name = "Rainbow"; + Rainbow.value = 3; + Rainbow.flags = 0; + Rainbow.color_mode = MODE_COLORS_NONE; modes.push_back(Rainbow); mode Cycle_Breathing; - Cycle_Breathing.name = "Cycle Breathing"; - Cycle_Breathing.value = 4; - Cycle_Breathing.flags = 0; - Cycle_Breathing.color_mode = MODE_COLORS_NONE; + Cycle_Breathing.name = "Cycle Breathing"; + Cycle_Breathing.value = 4; + Cycle_Breathing.flags = 0; + Cycle_Breathing.color_mode = MODE_COLORS_NONE; modes.push_back(Cycle_Breathing); SetupZones(); diff --git a/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp b/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp index e4cb02fa..e078b8e3 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.cpp @@ -12,12 +12,11 @@ #include #include "GalaxGPUv2Controller.h" -GalaxGPUv2Controller::GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev) +GalaxGPUv2Controller::GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id dev, std::string dev_name) { - this->bus = bus; - this->dev = dev; - - strcpy(device_name, "Galax RTX GPU"); // Would be nice to get the actual GPU name. Using this as a placeholder. + this->bus = bus; + this->dev = dev; + this->name = dev_name; } GalaxGPUv2Controller::~GalaxGPUv2Controller() @@ -25,11 +24,6 @@ GalaxGPUv2Controller::~GalaxGPUv2Controller() } -std::string GalaxGPUv2Controller::GetDeviceName() -{ - return(device_name); -} - std::string GalaxGPUv2Controller::GetDeviceLocation() { std::string return_string(bus->device_name); @@ -40,6 +34,11 @@ std::string GalaxGPUv2Controller::GetDeviceLocation() return("I2C: " + return_string); } +std::string GalaxGPUv2Controller::GetDeviceName() +{ + return(name); +} + unsigned char GalaxGPUv2Controller::GetLEDRed() { return(GalaxGPURegisterRead(GALAX_V2_RED_REGISTER)); diff --git a/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.h b/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.h index 80897d43..505a99e9 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.h +++ b/Controllers/GalaxGPUController/GalaxGPUv2Controller/GalaxGPUv2Controller.h @@ -51,11 +51,11 @@ enum class GalaxGPUv2Controller { public: - GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id); + GalaxGPUv2Controller(i2c_smbus_interface* bus, galax_gpu_dev_id, std::string dev_name); ~GalaxGPUv2Controller(); - std::string GetDeviceName(); std::string GetDeviceLocation(); + std::string GetDeviceName(); unsigned char GetLEDRed(); unsigned char GetLEDGreen(); unsigned char GetLEDBlue(); @@ -76,7 +76,7 @@ public: bool direct = false; // Temporary solution to check if we are in "Direct" mode private: - char device_name[16]; i2c_smbus_interface * bus; galax_gpu_dev_id dev; + std::string name; }; diff --git a/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp b/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp index 32468d29..45ceff95 100644 --- a/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUv2Controller/RGBController_GalaxGPUv2.cpp @@ -56,65 +56,65 @@ int RGBController_GalaxGPUv2::GetDeviceMode() RGBController_GalaxGPUv2::RGBController_GalaxGPUv2(GalaxGPUv2Controller* controller_ptr) { - controller = controller_ptr; + controller = controller_ptr; - name = controller->GetDeviceName(); - vendor = "GALAX"; - type = DEVICE_TYPE_GPU; - description = "GALAX RTX 40+ GPU"; - location = controller->GetDeviceLocation(); + name = controller->GetDeviceName(); + vendor = "GALAX"; + type = DEVICE_TYPE_GPU; + description = "GALAX RTX 40+ GPU"; + location = controller->GetDeviceLocation(); mode Direct; - Direct.name = "Direct"; - Direct.value = 0; - Direct.brightness_min = 0x01; - Direct.brightness_max = 0x03; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.value = 0; + Direct.brightness_min = 0x01; + Direct.brightness_max = 0x03; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); mode Breathing; - Breathing.name = "Breathing"; - Breathing.value = 1; - Breathing.brightness_min = 0x01; - Breathing.brightness_max = 0x03; - Breathing.speed_min = 0x00; - Breathing.speed_max = 0x09; - Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE; - Breathing.color_mode = MODE_COLORS_PER_LED; + Breathing.name = "Breathing"; + Breathing.value = 1; + Breathing.brightness_min = 0x01; + Breathing.brightness_max = 0x03; + Breathing.speed_min = 0x00; + Breathing.speed_max = 0x09; + Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE; + Breathing.color_mode = MODE_COLORS_PER_LED; modes.push_back(Breathing); mode Rainbow; - Rainbow.name = "Rainbow"; - Rainbow.value = 2; - Rainbow.flags = 0; - Rainbow.brightness_min = 0x01; - Rainbow.brightness_max = 0x03; - Rainbow.speed_min = 0x00; - Rainbow.speed_max = 0x09; - Rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE; - Rainbow.color_mode = MODE_COLORS_NONE; + Rainbow.name = "Rainbow"; + Rainbow.value = 2; + Rainbow.flags = 0; + Rainbow.brightness_min = 0x01; + Rainbow.brightness_max = 0x03; + Rainbow.speed_min = 0x00; + Rainbow.speed_max = 0x09; + Rainbow.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_MANUAL_SAVE; + Rainbow.color_mode = MODE_COLORS_NONE; modes.push_back(Rainbow); mode Sync; - Sync.name = "External Sync"; - Sync.value = 3; - Sync.flags = MODE_FLAG_MANUAL_SAVE; - Sync.color_mode = MODE_COLORS_NONE; + Sync.name = "External Sync"; + Sync.value = 3; + Sync.flags = MODE_FLAG_MANUAL_SAVE; + Sync.color_mode = MODE_COLORS_NONE; modes.push_back(Sync); mode Off; - Off.name = "Off"; - Off.value = 4; - Off.flags = MODE_FLAG_MANUAL_SAVE; - Off.color_mode = MODE_COLORS_NONE; + Off.name = "Off"; + Off.value = 4; + Off.flags = MODE_FLAG_MANUAL_SAVE; + Off.color_mode = MODE_COLORS_NONE; modes.push_back(Off); SetupZones(); - active_mode = GetDeviceMode(); - modes[active_mode].brightness = controller->GetBrightness(); - modes[active_mode].speed = controller->GetSpeed(); + active_mode = GetDeviceMode(); + modes[active_mode].brightness = controller->GetBrightness(); + modes[active_mode].speed = controller->GetSpeed(); } RGBController_GalaxGPUv2::~RGBController_GalaxGPUv2()