Asus Mainboard: Fix send color

Byte 3 of the send color message is currently sending the channel id.
Byte 4 is set to a hard coded 0xff and 0x00 for mainboard LEDs and
addressable LEDs respectively. Apparently this is a 16 bit mask to
select the colors to be updated instead.

Commit amended for code style by Adam Honse <calcprogrammer1@gmail.com>
This commit is contained in:
Martin Hartl
2021-04-07 18:28:33 +02:00
committed by Adam Honse
parent fc463db074
commit 87150072c8
2 changed files with 15 additions and 10 deletions

View File

@@ -102,11 +102,15 @@ void AuraMainboardController::SetMode
channel,
start_led,
device_info[channel].num_leds,
led_data,
device_info[channel].device_type == AuraDeviceType::FIXED
led_data
);
}
unsigned short AuraMainboardController::GetMask(int start, int size)
{
return(((1 << size) - 1) << start);
}
void AuraMainboardController::SendEffect
(
unsigned char channel,
@@ -141,11 +145,11 @@ void AuraMainboardController::SendColor
unsigned char channel,
unsigned char start_led,
unsigned char led_count,
unsigned char* led_data,
bool fixed
unsigned char* led_data
)
{
unsigned char usb_buf[65];
unsigned short mask = GetMask(start_led, led_count);
unsigned char usb_buf[65];
/*-----------------------------------------------------*\
| Zero out buffer |
@@ -157,8 +161,8 @@ void AuraMainboardController::SendColor
\*-----------------------------------------------------*/
usb_buf[0x00] = 0xEC;
usb_buf[0x01] = AURA_MAINBOARD_CONTROL_MODE_EFFECT_COLOR;
usb_buf[0x02] = channel;
usb_buf[0x03] = fixed ? 0xFF : 0x00;
usb_buf[0x02] = mask >> 8;
usb_buf[0x03] = mask & 0xff;
usb_buf[0x04] = 0x00;
/*-----------------------------------------------------*\
@@ -192,4 +196,4 @@ void AuraMainboardController::SendCommit()
| Send packet |
\*-----------------------------------------------------*/
hid_write(dev, usb_buf, 65);
}
}

View File

@@ -47,6 +47,8 @@ public:
private:
unsigned int mode;
unsigned short GetMask(int start, int size);
void SendEffect
(
unsigned char channel,
@@ -58,8 +60,7 @@ private:
unsigned char channel,
unsigned char start_led,
unsigned char led_count,
unsigned char* led_data,
bool fixed
unsigned char* led_data
);
void SendCommit();