GigabyteAorusLaptopController: Add brightness support for custom mode

master
morg 3 years ago
parent 0f41d7443a
commit 22b8cdbe01

@ -185,7 +185,7 @@ unsigned int GigabyteAorusLaptopController::GetLargestColour(unsigned int red, u
return (largest == 0) ? 1 : largest;
}
void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions)
void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness)
{
/*---------------------------------------------------------*\
| Custom mode protocol |
@ -207,7 +207,7 @@ void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std:
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
usb_buf[3] = GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE;
usb_buf[4] = 0x01;
usb_buf[5] = 0x32;
usb_buf[5] = brightness;
usb_buf[6] = 0x05;
usb_buf[7] = 0x01;

@ -56,7 +56,7 @@ public:
void SetDirect(uint8_t brightness, RGBColor color);
void SetMode(uint8_t mode_value, uint8_t speed, uint8_t brightness, uint8_t direction, RGBColor color);
void SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions);
void SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness);
protected:
hid_device* dev;

@ -22,6 +22,8 @@
big led, only custom mode can do real per key lightning.
This is impossible to determine if it auto saves to flash
(the battery cannot be removed) then we assume it does.
This device has 5 onboard memory profiles, we only use
the first one.
\*-------------------------------------------------------------------*/
#define NA 0xFFFFFFFF
@ -337,7 +339,7 @@ RGBController_GigabyteAorusLaptop::RGBController_GigabyteAorusLaptop(GigabyteAor
mode Custom;
Custom.name = "Custom";
Custom.value = GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE;
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE;
Custom.color_mode = MODE_COLORS_PER_LED;
Custom.brightness_min = GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MIN;
Custom.brightness_max = GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MAX;
@ -464,7 +466,7 @@ void RGBController_GigabyteAorusLaptop::DeviceUpdateLEDs()
layout_zone_colors.push_back(colors[i]);
}
controller->SetCustom(layout_zone_colors, aorus_laptop_default_keyboard_layout.led_sequence_positions);
controller->SetCustom(layout_zone_colors, aorus_laptop_default_keyboard_layout.led_sequence_positions, modes[active_mode].brightness);
}
}

Loading…
Cancel
Save