diff --git a/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp b/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp index 166d8aa0..30764885 100644 --- a/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp +++ b/Controllers/GalaxGPUController/GalaxGPUControllerDetect.cpp @@ -29,9 +29,9 @@ bool TestForGalaxGPUController(i2c_smbus_interface* bus, unsigned char address) { bool pass = false; - unsigned char res = bus->i2c_smbus_read_byte_data(address, 0x00); - - if(res == 0x10 || res == 0x27) //Windows reads 0x10, Linux reads 0x27 which is correct as 0x10 is at 0x01 + unsigned char res = bus->i2c_smbus_read_byte_data(address, 0x00); + unsigned char res2 = bus->i2c_smbus_read_byte_data(address, 0x01); + if(res == 0x27 && res2 == 0x10) { pass = true; } diff --git a/RGBController/RGBController_GalaxGPU.cpp b/RGBController/RGBController_GalaxGPU.cpp index 98eb6f99..58ac4320 100644 --- a/RGBController/RGBController_GalaxGPU.cpp +++ b/RGBController/RGBController_GalaxGPU.cpp @@ -8,6 +8,40 @@ #include "RGBController_GalaxGPU.h" +int RGBController_GalaxGPU::GetDeviceMode() +{ + int modereg1 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_1); + int modereg2 = galax_gpu->GalaxGPURegisterRead(GALAX_MODE_REGISTER_2); + int color_mode = MODE_COLORS_PER_LED; + + if (modereg1 == GALAX_MODE_STATIC_VALUE_1 && modereg2 == GALAX_MODE_STATIC_VALUE_2) + { + active_mode = 1; + modes[active_mode].color_mode = MODE_COLORS_PER_LED; + } + + if (modereg1 == GALAX_MODE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_BREATHING_VALUE_2) + { + active_mode = 2; + modes[active_mode].color_mode = MODE_COLORS_PER_LED; + } + + if (modereg1 == GALAX_MODE_RAINBOW_VALUE_1 && modereg2 == GALAX_MODE_RAINBOW_VALUE_2) + { + active_mode = 3; + modes[active_mode].color_mode = MODE_COLORS_NONE; + } + + if (modereg1 == GALAX_MODE_CYCLE_BREATHING_VALUE_1 && modereg2 == GALAX_MODE_CYCLE_BREATHING_VALUE_2) + { + active_mode = 4; + modes[active_mode].color_mode = MODE_COLORS_NONE; + } + + + return(active_mode); +} + RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController * galax_gpu_ptr) { galax_gpu = galax_gpu_ptr; @@ -49,7 +83,7 @@ RGBController_GalaxGPU::RGBController_GalaxGPU(GalaxGPUController * galax_gpu_pt SetupZones(); - //active_mode = GetDeviceMode(); + active_mode = GetDeviceMode(); } void RGBController_GalaxGPU::SetupZones() diff --git a/RGBController/RGBController_GalaxGPU.h b/RGBController/RGBController_GalaxGPU.h index 4151679a..45c2c6a0 100644 --- a/RGBController/RGBController_GalaxGPU.h +++ b/RGBController/RGBController_GalaxGPU.h @@ -29,4 +29,6 @@ public: private: GalaxGPUController* galax_gpu; + + int GetDeviceMode(); };