diff --git a/Controllers/EVGAGPUController/EVGAGPUv1Controller.cpp b/Controllers/EVGAGPUController/EVGAGPUv1Controller.cpp index 9e175a1f2..fb83b6d3a 100644 --- a/Controllers/EVGAGPUController/EVGAGPUv1Controller.cpp +++ b/Controllers/EVGAGPUController/EVGAGPUv1Controller.cpp @@ -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)); diff --git a/Controllers/EVGAGPUController/EVGAGPUv1Controller.h b/Controllers/EVGAGPUController/EVGAGPUv1Controller.h index 570d5abe6..a1c69d532 100644 --- a/Controllers/EVGAGPUController/EVGAGPUv1Controller.h +++ b/Controllers/EVGAGPUController/EVGAGPUv1Controller.h @@ -38,6 +38,7 @@ public: std::string GetDeviceLocation(); + unsigned char GetMode(); unsigned char GetRed(); unsigned char GetGreen(); unsigned char GetBlue(); diff --git a/Controllers/EVGAGPUController/RGBController_EVGAGPUv1.cpp b/Controllers/EVGAGPUController/RGBController_EVGAGPUv1.cpp index eaa3e324f..f8a2f0194 100644 --- a/Controllers/EVGAGPUController/RGBController_EVGAGPUv1.cpp +++ b/Controllers/EVGAGPUController/RGBController_EVGAGPUv1.cpp @@ -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()