Get active mode and last color set from EVGA v1 cards

Improve the user experience by allowing the UI to be initialized with
the settings that are currently active on the hardware.
This commit is contained in:
Jonas Malaco
2020-11-19 12:56:27 -03:00
committed by Adam Honse
parent c1715f25f4
commit 8dd0d85104
3 changed files with 25 additions and 1 deletions

View File

@@ -30,6 +30,11 @@ std::string EVGAGPUv1Controller::GetDeviceLocation()
return("I2C: " + return_string);
}
unsigned char EVGAGPUv1Controller::GetMode()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_MODE));
}
unsigned char EVGAGPUv1Controller::GetRed()
{
return(bus->i2c_smbus_read_byte_data(dev, EVGA_GPU_V1_REG_RED));

View File

@@ -38,6 +38,7 @@ public:
std::string GetDeviceLocation();
unsigned char GetMode();
unsigned char GetRed();
unsigned char GetGreen();
unsigned char GetBlue();

View File

@@ -49,8 +49,26 @@ RGBController_EVGAGPUv1::RGBController_EVGAGPUv1(EVGAGPUv1Controller* evga_ptr)
SetupZones();
// Initialize active mode
// Initialize active mode and stored color
unsigned char raw_active_mode = evga->GetMode();
active_mode = 0;
for(unsigned int i = 0; i < modes.size(); i++)
{
if (modes[i].value == raw_active_mode)
{
active_mode = i;
break;
}
}
unsigned char r = evga->GetRed();
unsigned char g = evga->GetGreen();
unsigned char b = evga->GetBlue();
RGBColor color = ToRGBColor(r, g, b);
colors[0] = color;
}
void RGBController_EVGAGPUv1::SetupZones()