From f38b90ad52af646e75dca24fe55680e27db76e18 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Tue, 31 Dec 2019 18:44:09 -0600 Subject: [PATCH] Use a list of motherboard addresses to detect Aura motherboards --- .../AuraController/AuraControllerDetect.cpp | 50 ++++++++----------- 1 file changed, 22 insertions(+), 28 deletions(-) diff --git a/Controllers/AuraController/AuraControllerDetect.cpp b/Controllers/AuraController/AuraControllerDetect.cpp index 355954f2..df5270b7 100644 --- a/Controllers/AuraController/AuraControllerDetect.cpp +++ b/Controllers/AuraController/AuraControllerDetect.cpp @@ -43,6 +43,19 @@ static const unsigned char aura_ram_addresses[] = 0x67 }; +/*---------------------------------------------------------------------------------*\ +| This list contains the available SMBus addresses for mapping Aura motherboards | +\*---------------------------------------------------------------------------------*/ +#define AURA_MOBO_ADDRESS_COUNT 4 + +static const unsigned char aura_mobo_addresses[] = +{ + 0x40, + 0x4E, + 0x4F, + 0x66 +}; + /******************************************************************************************\ * * * TestForAuraController * @@ -145,36 +158,17 @@ void DetectAuraControllers(std::vector &busses, std::vecto Sleep(1); } - // Check for Aura controller at 0x40 - if (TestForAuraController(busses[bus], 0x40)) + // Add Aura-enabled motherboard controllers + for (unsigned int address_list_idx = 0; address_list_idx < AURA_MOBO_ADDRESS_COUNT; address_list_idx++) { - new_aura = new AuraController(busses[bus], 0x40); - new_controller = new RGBController_Aura(new_aura); - rgb_controllers.push_back(new_controller); - } + if (TestForAuraController(busses[bus], aura_mobo_addresses[address_list_idx])) + { + new_aura = new AuraController(busses[bus], aura_mobo_addresses[address_list_idx]); + new_controller = new RGBController_Aura(new_aura); + rgb_controllers.push_back(new_controller); + } - // Check for Aura controller at 0x4E - if (TestForAuraController(busses[bus], 0x4E)) - { - new_aura = new AuraController(busses[bus], 0x4E); - new_controller = new RGBController_Aura(new_aura); - rgb_controllers.push_back(new_controller); - } - - // Check for Aura controller at 0x4F - if (TestForAuraController(busses[bus], 0x4F)) - { - new_aura = new AuraController(busses[bus], 0x4F); - new_controller = new RGBController_Aura(new_aura); - rgb_controllers.push_back(new_controller); - } - - // Check for Aura controller at 0x66 - if (TestForAuraController(busses[bus], 0x66)) - { - new_aura = new AuraController(busses[bus], 0x66); - new_controller = new RGBController_Aura(new_aura); - rgb_controllers.push_back(new_controller); + Sleep(1); } }