Skip to content

Commit 22b8cdb

Browse files
committed
GigabyteAorusLaptopController: Add brightness support for custom mode
1 parent 0f41d74 commit 22b8cdb

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ unsigned int GigabyteAorusLaptopController::GetLargestColour(unsigned int red, u
185185
return (largest == 0) ? 1 : largest;
186186
}
187187

188-
void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions)
188+
void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness)
189189
{
190190
/*---------------------------------------------------------*\
191191
| Custom mode protocol |
@@ -207,7 +207,7 @@ void GigabyteAorusLaptopController::SetCustom(std::vector<RGBColor> colors, std:
207207
usb_buf[1] = GIGABYTE_AORUS_LAPTOP_REPORT_ID;
208208
usb_buf[3] = GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE;
209209
usb_buf[4] = 0x01;
210-
usb_buf[5] = 0x32;
210+
usb_buf[5] = brightness;
211211
usb_buf[6] = 0x05;
212212
usb_buf[7] = 0x01;
213213

Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class GigabyteAorusLaptopController
5656

5757
void SetDirect(uint8_t brightness, RGBColor color);
5858
void SetMode(uint8_t mode_value, uint8_t speed, uint8_t brightness, uint8_t direction, RGBColor color);
59-
void SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions);
59+
void SetCustom(std::vector<RGBColor> colors, std::vector<unsigned int> positions, unsigned char brightness);
6060

6161
protected:
6262
hid_device* dev;

Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
big led, only custom mode can do real per key lightning.
2323
This is impossible to determine if it auto saves to flash
2424
(the battery cannot be removed) then we assume it does.
25+
This device has 5 onboard memory profiles, we only use
26+
the first one.
2527
\*-------------------------------------------------------------------*/
2628

2729
#define NA 0xFFFFFFFF
@@ -337,7 +339,7 @@ RGBController_GigabyteAorusLaptop::RGBController_GigabyteAorusLaptop(GigabyteAor
337339
mode Custom;
338340
Custom.name = "Custom";
339341
Custom.value = GIGABYTE_AORUS_LAPTOP_CUSTOM_MODE_VALUE;
340-
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
342+
Custom.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_AUTOMATIC_SAVE;
341343
Custom.color_mode = MODE_COLORS_PER_LED;
342344
Custom.brightness_min = GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MIN;
343345
Custom.brightness_max = GIGABYTE_AORUS_LAPTOP_BRIGHTNESS_MAX;
@@ -464,7 +466,7 @@ void RGBController_GigabyteAorusLaptop::DeviceUpdateLEDs()
464466
layout_zone_colors.push_back(colors[i]);
465467
}
466468

467-
controller->SetCustom(layout_zone_colors, aorus_laptop_default_keyboard_layout.led_sequence_positions);
469+
controller->SetCustom(layout_zone_colors, aorus_laptop_default_keyboard_layout.led_sequence_positions, modes[active_mode].brightness);
468470
}
469471
}
470472

0 commit comments

Comments
 (0)