Store name in EVGATuringGPUController to avoid setting it in detector
This commit is contained in:
parent
df75659778
commit
d7f0872690
5 changed files with 34 additions and 29 deletions
|
|
@ -11,10 +11,11 @@
|
||||||
|
|
||||||
#include "EVGAGPUv2Controller.h"
|
#include "EVGAGPUv2Controller.h"
|
||||||
|
|
||||||
EVGAGPUv2Controller::EVGAGPUv2Controller(i2c_smbus_interface* bus, evga_dev_id dev)
|
EVGAGPUv2Controller::EVGAGPUv2Controller(i2c_smbus_interface* bus, evga_dev_id dev, std::string dev_name)
|
||||||
{
|
{
|
||||||
this->bus = bus;
|
this->bus = bus;
|
||||||
this->dev = dev;
|
this->dev = dev;
|
||||||
|
this->name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVGAGPUv2Controller::~EVGAGPUv2Controller()
|
EVGAGPUv2Controller::~EVGAGPUv2Controller()
|
||||||
|
|
@ -33,6 +34,11 @@ std::string EVGAGPUv2Controller::GetDeviceLocation()
|
||||||
return("I2C: " + return_string);
|
return("I2C: " + return_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string EVGAGPUv2Controller::GetDeviceName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char EVGAGPUv2Controller::GetBrightnessA()
|
unsigned char EVGAGPUv2Controller::GetBrightnessA()
|
||||||
{
|
{
|
||||||
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_BRIGHTNESS));
|
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V2_REG_COLOR_A_BRIGHTNESS));
|
||||||
|
|
|
||||||
|
|
@ -86,10 +86,11 @@ enum
|
||||||
class EVGAGPUv2Controller
|
class EVGAGPUv2Controller
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EVGAGPUv2Controller(i2c_smbus_interface* bus, evga_dev_id dev);
|
EVGAGPUv2Controller(i2c_smbus_interface* bus, evga_dev_id dev, std::string dev_name);
|
||||||
~EVGAGPUv2Controller();
|
~EVGAGPUv2Controller();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetDeviceName();
|
||||||
|
|
||||||
unsigned char GetBrightnessA();
|
unsigned char GetBrightnessA();
|
||||||
RGBColor GetColorA();
|
RGBColor GetColorA();
|
||||||
|
|
@ -110,4 +111,5 @@ private:
|
||||||
|
|
||||||
i2c_smbus_interface* bus;
|
i2c_smbus_interface* bus;
|
||||||
evga_dev_id dev;
|
evga_dev_id dev;
|
||||||
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,11 @@
|
||||||
|
|
||||||
void DetectEVGATuringGPUControllers(i2c_smbus_interface* bus, uint8_t address, const std::string& name)
|
void DetectEVGATuringGPUControllers(i2c_smbus_interface* bus, uint8_t address, const std::string& name)
|
||||||
{
|
{
|
||||||
if (bus->port_id == 1)
|
if(bus->port_id == 1)
|
||||||
{
|
{
|
||||||
EVGAGPUv2Controller* controller;
|
EVGAGPUv2Controller* controller = new EVGAGPUv2Controller(bus, address, name);
|
||||||
RGBController_EVGAGPUv2* rgb_controller;
|
RGBController_EVGAGPUv2* rgb_controller = new RGBController_EVGAGPUv2(controller);
|
||||||
|
|
||||||
controller = new EVGAGPUv2Controller(bus, address);
|
|
||||||
rgb_controller = new RGBController_EVGAGPUv2(controller);
|
|
||||||
rgb_controller->name = name.c_str();
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
} /* DetectEVGATuringGPUControllers() */
|
} /* DetectEVGATuringGPUControllers() */
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,15 @@
|
||||||
@comment
|
@comment
|
||||||
\*-------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
RGBController_EVGAGPUv2::RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_ptr)
|
RGBController_EVGAGPUv2::RGBController_EVGAGPUv2(EVGAGPUv2Controller* controller_ptr)
|
||||||
{
|
{
|
||||||
evga = evga_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "EVGA GPU";
|
name = controller->GetDeviceName();
|
||||||
vendor = "EVGA";
|
vendor = "EVGA";
|
||||||
description = "EVGA Turing RGB GPU Device";
|
description = "EVGA Turing RGB GPU Device";
|
||||||
location = evga->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
|
type = DEVICE_TYPE_GPU;
|
||||||
type = DEVICE_TYPE_GPU;
|
|
||||||
|
|
||||||
mode Off;
|
mode Off;
|
||||||
Off.name = "Off";
|
Off.name = "Off";
|
||||||
|
|
@ -99,7 +98,7 @@ RGBController_EVGAGPUv2::RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_ptr)
|
||||||
SetupZones();
|
SetupZones();
|
||||||
|
|
||||||
// Initialize active mode
|
// Initialize active mode
|
||||||
active_mode = getModeIndex(evga->GetMode());
|
active_mode = getModeIndex(controller->GetMode());
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
/*---------------------------------------------------------*\
|
||||||
| The LED color (color[0]) will always be set. Mode colors |
|
| The LED color (color[0]) will always be set. Mode colors |
|
||||||
|
|
@ -107,8 +106,8 @@ RGBController_EVGAGPUv2::RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_ptr)
|
||||||
| by extension colorB is only necessary if its not black |
|
| by extension colorB is only necessary if its not black |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
|
|
||||||
colors[0] = evga->GetColorA();
|
colors[0] = controller->GetColorA();
|
||||||
RGBColor colorB = evga->GetColorB();
|
RGBColor colorB = controller->GetColorB();
|
||||||
|
|
||||||
int breathing_mode_index = getModeIndex(EVGA_GPU_V2_RGB_MODE_BREATHING);
|
int breathing_mode_index = getModeIndex(EVGA_GPU_V2_RGB_MODE_BREATHING);
|
||||||
int pulse_mode_index = getModeIndex(EVGA_GPU_V2_RGB_MODE_PULSE);
|
int pulse_mode_index = getModeIndex(EVGA_GPU_V2_RGB_MODE_PULSE);
|
||||||
|
|
@ -124,13 +123,13 @@ RGBController_EVGAGPUv2::RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load speed settings from the card:
|
// Load speed settings from the card:
|
||||||
modes[active_mode].speed = evga->GetSpeed();
|
modes[active_mode].speed = controller->GetSpeed();
|
||||||
modes[active_mode].brightness = evga->GetBrightnessA();
|
modes[active_mode].brightness = controller->GetBrightnessA();
|
||||||
}
|
}
|
||||||
|
|
||||||
RGBController_EVGAGPUv2::~RGBController_EVGAGPUv2()
|
RGBController_EVGAGPUv2::~RGBController_EVGAGPUv2()
|
||||||
{
|
{
|
||||||
delete evga;
|
delete controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
int RGBController_EVGAGPUv2::getModeIndex(unsigned char mode_value)
|
int RGBController_EVGAGPUv2::getModeIndex(unsigned char mode_value)
|
||||||
|
|
@ -187,7 +186,7 @@ void RGBController_EVGAGPUv2::DeviceUpdateLEDs()
|
||||||
| modes and as such colorB will always be black (0x000000) |
|
| modes and as such colorB will always be black (0x000000) |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
|
|
||||||
evga->SetColor(colors[0], /* colorB*/ 0, modes[active_mode].brightness);
|
controller->SetColor(colors[0], /* colorB*/ 0, modes[active_mode].brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_EVGAGPUv2::UpdateZoneLEDs(int /*zone*/)
|
void RGBController_EVGAGPUv2::UpdateZoneLEDs(int /*zone*/)
|
||||||
|
|
@ -217,10 +216,10 @@ void RGBController_EVGAGPUv2::DeviceUpdateMode()
|
||||||
colorB = (modes[active_mode].colors.size() == 2) ? modes[active_mode].colors[1] : 0 ;
|
colorB = (modes[active_mode].colors.size() == 2) ? modes[active_mode].colors[1] : 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
evga->SetMode( modes[active_mode].value, colorA, colorB, modes[active_mode].speed, modes[active_mode].brightness);
|
controller->SetMode( modes[active_mode].value, colorA, colorB, modes[active_mode].speed, modes[active_mode].brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RGBController_EVGAGPUv2::DeviceSaveMode()
|
void RGBController_EVGAGPUv2::DeviceSaveMode()
|
||||||
{
|
{
|
||||||
evga->SaveSettings();
|
controller->SaveSettings();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
class RGBController_EVGAGPUv2 : public RGBController
|
class RGBController_EVGAGPUv2 : public RGBController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RGBController_EVGAGPUv2(EVGAGPUv2Controller* evga_ptr);
|
RGBController_EVGAGPUv2(EVGAGPUv2Controller* controller_ptr);
|
||||||
~RGBController_EVGAGPUv2();
|
~RGBController_EVGAGPUv2();
|
||||||
|
|
||||||
void SetupZones();
|
void SetupZones();
|
||||||
|
|
@ -32,6 +32,7 @@ public:
|
||||||
void DeviceSaveMode();
|
void DeviceSaveMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
EVGAGPUv2Controller* controller;
|
||||||
|
|
||||||
int getModeIndex(unsigned char mode_value);
|
int getModeIndex(unsigned char mode_value);
|
||||||
EVGAGPUv2Controller* evga;
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue