Implement support for ITE IT5711 RGB Controller 048D:5711.

This commit is contained in:
Daniel Clark 2025-05-12 20:01:42 +00:00 committed by Adam Honse
parent 478cf4e9da
commit 77728fd425
5 changed files with 681 additions and 200 deletions

View file

@ -30,10 +30,10 @@ static RGBCalibration GigabyteCalibrationsLookup
static calibration GigabyteBoardCalibration
{
{ "D_LED1", "GRB" },
{ "D_LED2", "GRB" },
{ "Mainboard", "BGR" },
{ "Spare", "BGR" }
{ "D_LED1", "GRB" },
{ "D_LED2/D_LED3", "GRB" },
{ "Mainboard", "BGR" },
{ "Spare", "BGR" }
};
static LEDCount LedCountToEnum(unsigned int c)
@ -60,7 +60,7 @@ static LEDCount LedCountToEnum(unsigned int c)
}
}
RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name) : dev(handle)
RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name, uint16_t pid) : dev(handle), product_id(pid)
{
int res = 0;
char text[64] = { 0x00 };
@ -69,7 +69,7 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
if(dev)
{
SetCalibration();
name = mb_name;
/*---------------------------------------------------------*\
@ -93,12 +93,14 @@ RGBFusion2USBController::RGBFusion2USBController(hid_device* handle, const char
snprintf(text, 11, "0x%08X", report.chip_id);
chip_id = text;
D_LED1_count = LedCountToEnum(report.total_leds & 0x0F);
D_LED2_count = LedCountToEnum(report.total_leds & 0xF0);
D_LED1_count = LedCountToEnum(report.curr_led_count_low & 0x0F);
D_LED2_count = LedCountToEnum((report.curr_led_count_low >> 4) & 0x0F);
D_LED3_count = LedCountToEnum(report.curr_led_count_high & 0x0F);
}
location = path;
ResetController(pid);
EnableBeat(false);
}
}
@ -160,6 +162,8 @@ void RGBFusion2USBController::SetCalibration()
| If Calibration settings are not found then write them out |
| Calibration will only be executed if it is explicitly |
| enabled by the user |
| *Note IT5711 calibration is only partially functional. |
| *Use Calibration at your own risk. |
\*---------------------------------------------------------*/
if(!device_settings.contains(json_cal))
{
@ -171,19 +175,19 @@ void RGBFusion2USBController::SetCalibration()
}
else if(device_settings[json_cal]["Enabled"])
{
GigabyteBoardCalibration["D_LED1"] = device_settings[json_cal]["Data"]["D_LED1"];
GigabyteBoardCalibration["D_LED2"] = device_settings[json_cal]["Data"]["D_LED2"];
GigabyteBoardCalibration["Mainboard"] = device_settings[json_cal]["Data"]["Mainboard"];
GigabyteBoardCalibration["Spare"] = device_settings[json_cal]["Data"]["Spare"];
GigabyteBoardCalibration["D_LED1"] = device_settings[json_cal]["Data"]["D_LED1"];
GigabyteBoardCalibration["D_LED2/D_LED3"] = device_settings[json_cal]["Data"]["D_LED2/D_LED3"];
GigabyteBoardCalibration["Mainboard"] = device_settings[json_cal]["Data"]["Mainboard"];
GigabyteBoardCalibration["Spare"] = device_settings[json_cal]["Data"]["Spare"];
uint8_t buffer[64] = { 0x00 };
buffer[0] = report_id;
buffer[1] = 0x33;
SetCalibrationBuffer( GigabyteBoardCalibration.find("D_LED1")->second, buffer, 2);
SetCalibrationBuffer( GigabyteBoardCalibration.find("D_LED2")->second, buffer, 6);
SetCalibrationBuffer( GigabyteBoardCalibration.find("Mainboard")->second, buffer, 10);
SetCalibrationBuffer( GigabyteBoardCalibration.find("Spare")->second, buffer, 14);
SetCalibrationBuffer(GigabyteBoardCalibration["D_LED1"], buffer, 2);
SetCalibrationBuffer(GigabyteBoardCalibration["D_LED2/D_LED3"], buffer, 6);
SetCalibrationBuffer(GigabyteBoardCalibration["Mainboard"], buffer, 10);
SetCalibrationBuffer(GigabyteBoardCalibration["Spare"], buffer, 14);
SendPacket(buffer);
}
@ -192,18 +196,27 @@ void RGBFusion2USBController::SetCalibration()
void RGBFusion2USBController::SetLedCount(unsigned int led, unsigned int count)
{
/*-----------------------------------------------------------------*\
| Check which Digital LED we're setting then send the value of both |
| Check which Digital LED we're setting then send the value of each |
\*-----------------------------------------------------------------*/
if(led == HDR_D_LED1)
{
D_LED1_count = LedCountToEnum(count);
}
else
else if(led == HDR_D_LED2)
{
D_LED2_count = LedCountToEnum(count);
}
else if(led == HDR_D_LED3)
{
D_LED3_count = LedCountToEnum(count);
}
unsigned char buffer[64] = { 0 };
buffer[0] = report_id; // 0xCC
buffer[1] = 0x34; // CC34 command
buffer[2] = (D_LED2_count << 4) | D_LED1_count;
buffer[3] = D_LED3_count;
SendPacket(0x34, D_LED1_count | (D_LED2_count << 4));
SendPacket(buffer); // Send full HID feature report
}
bool RGBFusion2USBController::DisableBuiltinEffect(int enable_bit, int mask)
@ -268,18 +281,19 @@ void RGBFusion2USBController::SetStripColors
PktRGB pkt;
pkt.Init(hdr, report_id);
/*-------------------------------------------------------------------------*\
| FIXME assuming that LED strips ports are 0x58/0x59 for all boards |
\*-------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------------*\
| byte order is correct for it5711 though there is more work to do. |
| For IT5711 defaults to byteorder1/2 for LED strips (Current Behavior is Functional) |
\*------------------------------------------------------------------------------------*/
uint32_t byteorder;
if(hdr == HDR_D_LED1_RGB)
{
byteorder = report.byteorder0;
byteorder = report.byteorder1;
}
else
{
byteorder = report.byteorder1;
byteorder = report.byteorder2;
}
unsigned char bo_r = byteorder >> 16;
@ -338,10 +352,14 @@ void RGBFusion2USBController::SetStripColors
{
DisableBuiltinEffect(0x01, 0x01);
}
else
else if(hdr == HDR_D_LED2_RGB)
{
DisableBuiltinEffect(0x02, 0x02);
}
else if(hdr == HDR_D_LED3_RGB)
{
DisableBuiltinEffect(0x08, 0x08);
}
}
static const std::array< std::array<int, 3>, 5> speeds =
@ -360,15 +378,57 @@ void RGBFusion2USBController::SetLEDEffect(unsigned int led, int mode, unsigned
PktEffect pkt;
pkt.Init(led, report_id);
/*-------------------------------------------------------------------------*\
| Add handling for different parts of the controller |
| IT8297, IT5702, and IT5711 seems to only support 5 levels of brightness |
\*-------------------------------------------------------------------------*/
if(led >= 0x20 && led <= 0x27)
{
pkt.e.zone0 = static_cast<uint32_t>(1 << (led - 0x20));
}
else if(led >= 0x90 && led <= 0x92)
{
pkt.e.zone0 = static_cast<uint32_t>(1 << (led - 0x90));
}
pkt.e.effect_type = mode;
pkt.e.color0 = r << 16 | g << 8 | b;
pkt.e.max_brightness = brightness;
/*--------------------------------------------------------------------*\
| Adjust brightness for 0x20-0x27 and 0x90-0x92 |
| Brightness values supported are as follows: |
| 0xFF = Max Brightness |
| 0xB3 = -1 Brightness |
| 0x80 = -2 Brightness |
| 0x4D = -3 Brightness |
| 0x1a = -4 Brightness |
| 0x00 = Min Brightness |
\*--------------------------------------------------------------------*/
if(brightness == 0)
pkt.e.max_brightness = 0x00;
else if(brightness == 1)
pkt.e.max_brightness = 0x1A;
else if(brightness == 2)
pkt.e.max_brightness = 0x4D;
else if(brightness == 3)
pkt.e.max_brightness = 0x80;
else if(brightness == 4)
pkt.e.max_brightness = 0xB3;
else
pkt.e.max_brightness = 0xFF;
switch(mode)
{
case 0: // Direct
case 1: // Static
case 1: // Static zero out other effect parameters (IT5711 needs this)
pkt.e.period0 = 0;
pkt.e.period1 = 0;
pkt.e.period2 = 0;
pkt.e.period3 = 0;
pkt.e.effect_param0 = 0;
pkt.e.effect_param1 = 0;
pkt.e.effect_param2 = 0;
pkt.e.effect_param3 = 0;
break;
case 2: //Breathing
@ -397,19 +457,30 @@ void RGBFusion2USBController::SetLEDEffect(unsigned int led, int mode, unsigned
pkt.e.effect_type = 3;
pkt.e.effect_param2 = 2; // flash twice
if (random)
if(random)
{
pkt.e.effect_param0 = 7;
}
break;
}
/*----------------------------------------*\
| Adjust offset formatting for 0x90-0x92 |
\*----------------------------------------*/
if(led >= 0x90 && led <= 0x92)
{
pkt.buffer[1] = led;
pkt.buffer[2] = 0x00;
pkt.buffer[3] = 1 << (led - 0x90);
}
SendPacket(pkt.buffer);
}
/*--------------------------------------------------*\
| IT8297 and IT5702 seem happy with sending 0x28FF |
| IT5711 needs 0x28FF07 to work properly (?) |
\*--------------------------------------------------*/
bool RGBFusion2USBController::ApplyEffect()
{
return SendPacket(0x28, 0xFF);
return SendPacket(0x28, 0xFF, 0x07);
}
bool RGBFusion2USBController::SendPacket(uint8_t a, uint8_t b, uint8_t c)
@ -428,3 +499,29 @@ int RGBFusion2USBController::SendPacket(unsigned char* packet)
{
return hid_send_feature_report(dev, packet, 64);
}
/*-----------------------------------------------------------------------------------------*\
| Init routine to zero out all registers before setting up the controllers. |
| This is required to prevent weird behaviors due to an inconsistent controller state. |
\*-----------------------------------------------------------------------------------------*/
void RGBFusion2USBController::ResetController(uint16_t pid)
{
for(uint8_t reg = 0x20; reg <= 0x27; ++reg)
SendPacket(reg, 0x00, 0x00);
SendPacket(0x32, 0x00, 0x00);
SendPacket(0x34, 0x00, 0x00);
if(pid == 0x5711)
{
for(uint8_t reg = 0x90; reg <= 0x92; ++reg)
SendPacket(reg, 0x00, 0x00);
}
SendPacket(0x28, 0xFF, 0x07);
}
uint16_t RGBFusion2USBController::GetProductID() const
{
return product_id;
}

View file

@ -48,10 +48,21 @@ const uint8_t HDR_D_LED2 = LED7;
const uint8_t HDR_LED_7 = LED8;
/*-------------------------------------------------------------*\
| FIXME assuming that it is 0x58 for all boards |
| IT8297/IT5702 ARGB Headers |
\*-------------------------------------------------------------*/
const uint8_t HDR_D_LED1_RGB = 0x58;
const uint8_t HDR_D_LED2_RGB = 0x59;
/*-------------------------------------------------------------*\
| 0x62 & 0x90-92 found on the new IT5711 controller chip |
\*-------------------------------------------------------------*/
const uint8_t LED9 = 0x90;
const uint8_t LED10 = 0x91;
const uint8_t LED11 = 0x92;
const uint8_t HDR_D_LED3_RGB = 0x62;
/*------------------------------------------*\
|Defines new mapping for third argb header |
\*------------------------------------------*/
const uint8_t HDR_D_LED3 = LED8;
enum EffectType
{
@ -173,7 +184,7 @@ union PktEffect
e.zone0 = (uint32_t)(1 << (e.header - 32));
e.effect_type = EFFECT_STATIC;
e.max_brightness = 100;
e.max_brightness = 255;
e.min_brightness = 0;
e.color0 = 0x00FF2100; //orange
e.period0 = 0; //Rising Timer - Needs to be 0 for "Direct"
@ -187,6 +198,17 @@ union PktEffect
}
};
/*--------------------------------------------------------------------------------------*\
| Definitions for Initial controller response struct. |
| curr_led_count_high and curr_led_count_low contain the numbers of leds in each header. |
| Byte orders are little endian little-endian 0x00RRGGBB? |
| byteorder0 is location of "Spare" calibration location. |
| byteorder1 is location of "D_LED1" calibration location. |
| byteorder2 is location of "D_LED2/D_LED3" calibration location. |
| byteorder3 is location of "Mainboard" calibration location. |
| byteorder4 is location of fifth calibration location. |
| *Note that the calibration locations aren't fully understood yet for the IT5711. |
\*--------------------------------------------------------------------------------------*/
struct IT8297Report
{
uint8_t report_id;
@ -194,14 +216,16 @@ struct IT8297Report
uint8_t device_num;
uint8_t total_leds;
uint32_t fw_ver;
uint16_t curr_led_count;
uint8_t curr_led_count_high;
uint8_t curr_led_count_low;
uint16_t reserved0;
char str_product[32]; // might be 28 and an extra byteorder3
uint32_t byteorder0; // is little-endian 0x00RRGGBB ?
char str_product[28];
uint32_t byteorder0;
uint32_t byteorder1;
uint32_t byteorder2;
uint32_t byteorder3;
uint32_t chip_id;
uint32_t reserved1;
uint32_t byteorder4;
};
#pragma pack(pop)
@ -209,7 +233,7 @@ struct IT8297Report
class RGBFusion2USBController
{
public:
RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name);
RGBFusion2USBController(hid_device* handle, const char *path, std::string mb_name, uint16_t pid);
~RGBFusion2USBController();
void SetStripColors
@ -220,6 +244,8 @@ public:
int single_led = -1
);
void ResetController(uint16_t pid);
uint16_t GetProductID() const;
void SetLEDEffect(unsigned int led, int mode, unsigned int speed, unsigned char brightness, bool random, unsigned char red, unsigned char green, unsigned char blue);
void SetLedCount(unsigned int led, unsigned int count);
void SetMode(int mode);
@ -240,6 +266,7 @@ private:
void SetCalibrationBuffer(std::string rgb_order, uint8_t* buffer, uint8_t offset);
hid_device* dev;
uint16_t product_id;
int mode;
IT8297Report report;
std::string name;
@ -251,4 +278,5 @@ private:
int report_id = 0xCC;
LEDCount D_LED1_count;
LEDCount D_LED2_count;
};
LEDCount D_LED3_count; //Third ARGB header count
};

View file

@ -37,7 +37,7 @@ void DetectGigabyteRGBFusion2USBControllers(hid_device_info* info, const std::st
if(dev)
{
RGBFusion2USBController* controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard());
RGBFusion2USBController* controller = new RGBFusion2USBController(dev, info->path, MB_info.getMainboard(), info->product_id);
RGBController_RGBFusion2USB* rgb_controller = new RGBController_RGBFusion2USB(controller, DETECTOR_NAME);
// Constructor sets the name
ResourceManager::get()->RegisterRGBController(rgb_controller);
@ -47,8 +47,10 @@ void DetectGigabyteRGBFusion2USBControllers(hid_device_info* info, const std::st
#ifdef USE_HID_USAGE
REGISTER_HID_DETECTOR_PU(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x8297, IT8297_UPG, IT8297_U);
REGISTER_HID_DETECTOR_PU(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5702, IT8297_UPG, IT8297_U);
REGISTER_HID_DETECTOR_PU(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5711, IT8297_UPG, IT8297_U);
#else
REGISTER_HID_DETECTOR_I(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x8297, IT8297_IFC);
REGISTER_HID_DETECTOR_I(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5702, IT8297_IFC);
REGISTER_HID_DETECTOR_I(DETECTOR_NAME, DetectGigabyteRGBFusion2USBControllers, IT8297_VID, 0x5711, IT8297_IFC);
#endif

View file

@ -21,9 +21,10 @@
\*-------------------------------------------------*/
static FwdLedHeaders LedLookup
{
{"LED1", 0x20}, {"LED2", 0x21}, {"LED3", 0x22}, {"LED4", 0x23},
{"LED5", 0x24}, {"LED6", 0x25}, {"LED7", 0x26}, {"LED8", 0x27},
{"D_LED1", 0x58}, {"D_LED2", 0x59},
{"LED1", 0x20}, {"LED2", 0x21}, {"LED3", 0x22}, {"LED4", 0x23},
{"LED5", 0x24}, {"LED6", 0x25}, {"LED7", 0x26}, {"LED8", 0x27},
{"D_LED1", 0x58}, {"D_LED2", 0x59}, {"D_LED3", 0x62}, {"LED9", 0x90},
{"LED10", 0x91}, {"LED11", 0x92},
};
/*-------------------------------------------------*\
@ -32,25 +33,39 @@ static FwdLedHeaders LedLookup
\*-------------------------------------------------*/
static MBName MBName2LayoutLookup
{
{"B550 AORUS ELITE", "STD_ATX" },
{"B550 AORUS PRO", "STD_ATX" },
{"B550I AORUS PRO AX", "ITX" },
{"X570 AORUS ELITE", "STD_ATX" },
{"X570 AORUS MASTER", "MSTR_ATX_3"},
{"X570 AORUS PRO", "STD_ATX" },
{"X570 AORUS ELITE WIFI", "STD_ATX" },
{"X570 AORUS PRO WIFI", "STD_ATX" },
{"X570 AORUS ULTRA", "STD_ATX" },
{"X570 I AORUS PRO WIFI", "ITX" },
{"X670E AORUS MASTER", "MSTR_ATX_2"},
{"Z390 AORUS MASTER-CF", "MSTR_ATX" },
{"B550 AORUS ELITE", "STD_ATX" },
{"B550 AORUS PRO", "STD_ATX" },
{"B550I AORUS PRO AX", "ITX" },
{"B650 EAGLE AX", "B650-Eagle-AX" },
{"B650E AORUS STEALTH", "B650E-AORUS-STEALTH" },
{"B650E AORUS STEALTH ICE", "B650E-AORUS-STEALTH" },
{"B650M DS3H", "B650M-DS3H" },
{"B850 AORUS ELITE WIFI7", "X870-WIFI7" },
{"B850 AORUS ELITE WIFI7 ICE", "X870-WIFI7" },
{"X570 AORUS ELITE", "STD_ATX" },
{"X570 AORUS ELITE WIFI", "STD_ATX" },
{"X570 AORUS MASTER", "MSTR_ATX_3" },
{"X570 AORUS PRO", "STD_ATX" },
{"X570 AORUS PRO WIFI", "STD_ATX" },
{"X570 AORUS ULTRA", "STD_ATX" },
{"X570 I AORUS PRO WIFI", "ITX" },
{"X670E AORUS MASTER", "MSTR_ATX_2" },
{"X870 AORUS ELITE WIFI7", "X870-WIFI7" },
{"X870 AORUS ELITE WIFI7 ICE", "X870-WIFI7" },
{"X870E AORUS ELITE WIFI7", "X870E-WIFI7" },
{"X870E AORUS ELITE WIFI7 ICE", "X870E-WIFI7" },
{"X870E AORUS PRO", "X870E-PRO" },
{"X870E AORUS PRO ICE", "X870E-PRO" },
{"Z390 AORUS MASTER-CF", "MSTR_ATX" },
{"Z890 AORUS ELITE WIFI7", "Z890-WIFI7" },
{"Z890 AORUS ELITE WIFI7 ICE", "Z890-WIFI7" }
};
/*-------------------------------------------------*\
| This is the default Custom layout that will be |
| written into config if it doesn't exist |
\*-------------------------------------------------*/
static const KnownLayout HardcodedCustom
static const KnownLayout HardcodedCustom_Gen1
{
{
"Custom",
@ -58,12 +73,12 @@ static const KnownLayout HardcodedCustom
{
"Motherboard",
{
{ "Name for Led 1", LED1, 1 },
{ "Name for Led 2", LED2, 1 },
{ "Name for Led 3", LED3, 1 },
{ "Name for Led 4", LED4, 1 },
{ "Name for Led 5", LED5, 1 },
{ "Name for Led 8", LED8, 1 },
{ "Name for Led 1", LED1, 1 },
{ "Name for Led 2", LED2, 1 },
{ "Name for Led 3", LED3, 1 },
{ "Name for Led 4", LED4, 1 },
{ "Name for Led 5", LED5, 1 },
{ "Name for Led 8", LED8, 1 },
}
},
{
@ -82,6 +97,47 @@ static const KnownLayout HardcodedCustom
}
};
static const KnownLayout HardcodedCustom_Gen2
{
{
"Custom",
{
{
"Motherboard",
{
{ "0x20", LED1, 1 }, //This one should apply everything globally (testing needed).
{ "0x21", LED2, 1 },
{ "0x22", LED3, 1 }, //Confirmed accent Lighting for X870 Aorus Elite Boards.
{ "0x23", LED4, 1 },
{ "0x24", LED5, 1 }, //should be LED_C on most if not all models.
{ "0x90", LED9, 1 },
{ "0x91", LED10, 1 },//Should be logo on pro models.
{ "0x92", LED11, 1 },//Should be accent on pro models.
}
},
{
"ARGB V2.3",
{
{ "ARGB V2.3", HDR_D_LED3, 0 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
};
/*-------------------------------------------------*\
| KnownLayoutsLookup now needs to be variable to |
| allow for a custom addition from config |
@ -89,7 +145,366 @@ static const KnownLayout HardcodedCustom
static KnownLayout knownLayoutsLookup
{
{
"IT8297BX-GBX570", //Left as a catch all
"STD_ATX",
{
{
"Motherboard",
{
{ "Back I/O", HDR_BACK_IO, 1 },
{ "CPU Header", HDR_CPU, 1 },
{ "PCIe", HDR_PCIE, 1 },
{ "LED C1/C2", HDR_LED_C1C2, 1 },
}
},
{
"D_LED1 Bottom",
{
{ "D_LED1 Bottom", HDR_D_LED1, 0 },
}
},
{
"D_LED2 Top",
{
{ "D_LED2 Top", HDR_D_LED2, 0 },
}
}
}
},
{
"ITX",
{
{
"Motherboard",
{
{ "LED Group0", HDR_BACK_IO, 1 },
{ "LED Group1", HDR_CPU, 1 },
{ "LED Group2", HDR_LED_2, 1 },
{ "LED Group3", HDR_PCIE, 1 },
{ "LED C1/C2", HDR_LED_C1C2, 1 },
}
},
{
"D_LED1",
{
{ "D_LED1", HDR_D_LED1, 0 },
}
}
}
},
{
"B650-Eagle-AX",
{
{
"Motherboard",
{
{ "LED_C", LED5, 1 },
}
},
{
"ARGB V2.3",
{
{ "ARGB V2.3", HDR_D_LED3, 0 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
{
"B650E-AORUS-STEALTH",
{
{
"Motherboard",
{
{ "Logo", LED10, 1 },
{ "Accent", LED11, 1 },
{ "LED C", LED5, 1 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
{
"B650M-DS3H",
{
{
"Motherboard",
{
{ "LED_C", LED5, 1 },
}
},
{
"D_LED1",
{
{ "D_LED1", HDR_D_LED1, 0 },
}
},
{
"D_LED2",
{
{ "D_LED2", HDR_D_LED1, 0 },
}
}
}
},
{
"X870-WIFI7",
{
{
"Motherboard",
{
{ "Accent", LED3, 1 },
{ "LED C", LED5, 1 },
}
},
{
"ARGB V2.3",
{
{ "ARGB V2.3", HDR_D_LED3, 0 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
{
"X870E-WIFI7",
{
{
"Motherboard",
{
{ "Accent", LED11, 1 },
{ "LED C", LED5, 1 },
}
},
{
"ARGB V2.3",
{
{ "ARGB V2.3", HDR_D_LED3, 0 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
{
"X870E-PRO",
{
{
"Motherboard",
{
{ "Logo", LED10, 1 },
{ "Accent", LED11, 1 },
{ "LED C", LED5, 1 },
}
},
{
"ARGB V2.3",
{
{ "ARGB V2.3", HDR_D_LED3, 0 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
{
"MSTR_ATX_2",
{
{
"D_LED1 Bottom",
{
{ "D_LED1 Bottom", HDR_D_LED2, 0 },
}
},
{
"D_LED2 Top",
{
{ "D_LED2 Top", HDR_D_LED1, 0 },
}
},
{
"Motherboard",
{
{ "LED C1", LED2, 1 },
{ "LED C2", LED5, 1 },
{ "CPU Header", LED3, 1 },
{ "Cover Left", LED4, 1 },
{ "Cover Right", LED1, 1 },
}
}
}
},
{
"MSTR_ATX_3",
{
{
"Digital Headers",
{
{ "D_LED1 / D_LED2", HDR_D_LED1, 0 },
}
},
{
"ARGB Strip",
{
{ "LED C1/C2", LED5, 1 },
}
},
{
"Motherboard",
{
{ "Aorus Logo", LED7, 1 },
{ "ESS Logo", LED4, 1 },
}
}
}
},
{
"MSTR_ATX",
{
{
"Digital Headers",
{
{ "D_LED1 / D_LED2", LED6, 0 },
}
},
{
"ARGB Strip",
{
{ "Back IO / VRM", LED7, 0 },
}
},
{
"Motherboard",
{
{ "XMP Logo", LED2, 1 },
{ "Chipset Logo", LED3, 1 },
{ "PCIe", LED4, 1 },
{ "LED C1/C2", LED5, 1 },
}
}
}
},
{
"Z890-WIFI7",
{
{
"Motherboard",
{
{ "Logo", LED10, 1 },
{ "Accent", LED3, 1 },
{ "LED C", LED5, 1 },
}
},
{
"ARGB V2.3",
{
{ "ARGB V2.3", HDR_D_LED3, 0 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
{
"IT5711-Generic",
{
{
"Motherboard",
{
{ "0x20", LED1, 1 },
{ "Ox21", LED2, 1 },
{ "0x22", LED3, 1 },
{ "0x23", LED4, 1 },
{ "0x24", LED5, 1 },
{ "0x90", LED9, 1 },
{ "0x91", LED10, 1 },
{ "0x92", LED11, 1 },
}
},
{
"ARGB V2.3",
{
{ "ARGB V2.3", HDR_D_LED3, 0 },
}
},
{
"ARGB V2.1",
{
{ "ARGB V2.1", HDR_D_LED1, 0 },
}
},
{
"ARGB V2.2",
{
{ "ARGB V2.2", HDR_D_LED2, 0 },
}
}
}
},
{
"IT8297BX-GBX570",
{
{
"Motherboard",
@ -117,133 +532,10 @@ static KnownLayout knownLayoutsLookup
}
}
}
},
{
"STD_ATX",
{
{
"Motherboard",
{
{ "Back I/O", HDR_BACK_IO, 1 },
{ "CPU Header", HDR_CPU, 1 },
{ "PCIe", HDR_PCIE, 1},
{ "LED C1/C2", HDR_LED_C1C2, 1 }, // 12VGRB headers seem to be connected
}
},
{
"D_LED1 Bottom",
{
{ "D_LED1 Bottom", HDR_D_LED1, 0 },
}
},
{
"D_LED2 Top",
{
{ "D_LED2 Top", HDR_D_LED2, 0 },
}
}
}
},
{
"ITX",
{
{
"Motherboard",
{
{ "LED Group0", HDR_BACK_IO, 1 },
{ "LED Group1", HDR_CPU, 1 },
{ "LED Group2", HDR_LED_2, 1 },
{ "LED Group3", HDR_PCIE, 1 },
{ "LED C1/C2", HDR_LED_C1C2, 1 }, // 12VGRB headers seem to be connected
}
},
{
"D_LED1",
{
{ "D_LED1", HDR_D_LED1, 0 },
}
}
}
},
{
"MSTR_ATX",
{
{
"Digital Headers",
{
{ "D_LED1 / D_LED2", LED6, 0},
}
},
{
"ARGB Strip",
{
{ "Back IO / VRM", LED7, 0},
}
},
{
"Motherboard",
{
{ "XMP Logo", LED2, 1},
{ "Chipset Logo", LED3, 1},
{ "PCIe", LED4, 1},
{ "LED C1/C2", LED5, 1},
}
}
}
},
{
"MSTR_ATX_2",
{
{
"D_LED1 Bottom",
{
{ "D_LED1 Bottom", HDR_D_LED2, 0},
}
},
{
"D_LED2 Top",
{
{ "D_LED2 Top", HDR_D_LED1, 0},
}
},
{
"Motherboard",
{
{ "LED C1", LED2, 1},
{ "LED C2", LED5, 1},
{ "CPU Header", LED3, 1},
{ "Cover Left", LED4, 1},
{ "Cover Right", LED1, 1},
}
}
}
},
{
"MSTR_ATX_3",
{
{
"Digital Headers",
{
{ "D_LED1 / D_LED2", HDR_D_LED1, 0},
}
},
{
"ARGB Strip",
{
{ "LED C1/C2", LED5, 1},
}
},
{
"Motherboard",
{
{ "Aorus Logo", LED7, 1},
{ "ESS Logo", LED4, 1},
}
}
}
},
}
};
/**------------------------------------------------------------------*\
@name Gigabyte RGB Fusion 2 USB
@category Motherboard
@ -392,9 +684,20 @@ void RGBController_RGBFusion2USB::Load_Device_Config()
}
/*-------------------------------------------------*\
| Get Custom Layout from the settings manager |
| Get Custom Layout from the settings manager. |
| Selects appropriate layout based on controller. |
\*-------------------------------------------------*/
layout = HardcodedCustom.find("Custom")->second;
uint16_t pid = controller->GetProductID();
if(pid == 0x5711)
{
layout = HardcodedCustom_Gen2.find("Custom")->second;
}
else
{
layout = HardcodedCustom_Gen1.find("Custom")->second;
}
if (!device_settings.contains(SectionCustom))
{
/*---------------------------------------------*\
@ -454,7 +757,10 @@ void RGBController_RGBFusion2USB::Load_Device_Config()
\*---------------------------------*/
lp.name = json_vlp["name"].get<std::string>();
lp.header = LedLookup.find(json_vlp["header"].get<std::string>())->second;
lp.count = ((lp.header == LED6) || (lp.header == LED7)) ? 0 : 1;
if(lp.header == HDR_D_LED1 || lp.header == HDR_D_LED2 || lp.header == HDR_D_LED3)
lp.count = 0;
else
lp.count = 1;
v_lp.push_back(lp);
}
@ -469,7 +775,7 @@ void RGBController_RGBFusion2USB::Init_Controller()
/*---------------------------------------------------------*\
| Look up channel map based on device name |
\*---------------------------------------------------------*/
if (!custom_layout)
if(!custom_layout)
{
/*-----------------------------------------------------*\
| If the layout is custom then it's loaded and ready, |
@ -482,7 +788,24 @@ void RGBController_RGBFusion2USB::Init_Controller()
}
else
{
layout = knownLayoutsLookup.find("IT8297BX-GBX570")->second;
uint16_t pid = controller->GetProductID();
std::string fallback_layout;
switch(pid)
{
case 0x5711:
fallback_layout = "IT5711-Generic";
break;
case 0x5702:
fallback_layout = "STD_ATX";
break;
case 0x8297:
fallback_layout = "STD_ATX";
break;
default:
fallback_layout = "IT5711-Generic"; // safest default
break;
}
}
}
@ -659,8 +982,25 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone)
\*---------------------------------------------------------*/
if(mode_value == 0xFFFF)
{
hdr += RGBFusion2_Digital_Direct_Offset;
controller->DisableBuiltinEffect(1, ((hdr == HDR_D_LED1_RGB) ? 0x01 : 0x02));
//Updated: Proper RGB register mapping for each header
switch(hdr)
{
case HDR_D_LED1:
hdr = HDR_D_LED1_RGB;
controller->DisableBuiltinEffect(1, 0x01);
break;
case HDR_D_LED2:
hdr = HDR_D_LED2_RGB;
controller->DisableBuiltinEffect(1, 0x02);
break;
case HDR_D_LED3:
hdr = HDR_D_LED3_RGB;
controller->DisableBuiltinEffect(1, 0x08);
break;
default:
break;
}
controller->SetStripColors(hdr, zones[zone].colors, zones[zone].leds_count);
}
/*---------------------------------------------------------*\
@ -685,8 +1025,23 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone)
/*---------------------------------------------------------*\
| Apply built-in effects to LED strips |
\*---------------------------------------------------------*/
controller->DisableBuiltinEffect(0, hdr == HDR_D_LED1 ? 0x01 : 0x02);
controller->SetLEDEffect(hdr, modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, random, red, grn, blu);
switch(hdr)
{
case HDR_D_LED1:
controller->DisableBuiltinEffect(0, 0x01);
break;
case HDR_D_LED2:
controller->DisableBuiltinEffect(0, 0x02);
break;
case HDR_D_LED3:
controller->DisableBuiltinEffect(0, 0x08);
break;
default:
break;
}
controller->SetLEDEffect(hdr, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, red, grn, blu);
controller->ApplyEffect();
}
}
@ -767,4 +1122,4 @@ int RGBController_RGBFusion2USB::GetLED_Zone(int led_idx)
| If zone is not found, return -1 |
\*---------------------------------*/
return(-1);
}
}

View file

@ -20,8 +20,7 @@
#define RGBFusion2_Digital_LEDS_Min 0;
#define RGBFusion2_Digital_LEDS_Max 1024;
#define RGBFUSION2_BRIGHTNESS_MIN 0;
#define RGBFUSION2_BRIGHTNESS_MAX 100;
#define RGBFusion2_Digital_Direct_Offset (HDR_D_LED1_RGB - HDR_D_LED1);
#define RGBFUSION2_BRIGHTNESS_MAX 5;
template<typename K, typename V>
static std::map<V, K> reverse_map(const std::map<K, V>& map)