From 22b8cdbe0140914214d744cf8e454f29a7316048 Mon Sep 17 00:00:00 2001 From: morg Date: Thu, 21 Sep 2023 17:56:08 +0200 Subject: [PATCH] GigabyteAorusLaptopController: Add brightness support for custom mode --- .../GigabyteAorusLaptopController.cpp | 4 ++-- .../GigabyteAorusLaptopController.h | 2 +- .../RGBController_GigabyteAorusLaptop.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.cpp b/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.cpp index b50a5cdd..9b8677d5 100644 --- a/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.cpp +++ b/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.cpp @@ -185,7 +185,7 @@ unsigned int GigabyteAorusLaptopController::GetLargestColour(unsigned int red, u return (largest == 0) ? 1 : largest; } -void GigabyteAorusLaptopController::SetCustom(std::vector colors, std::vector positions) +void GigabyteAorusLaptopController::SetCustom(std::vector colors, std::vector positions, unsigned char brightness) { /*---------------------------------------------------------*\ | Custom mode protocol | @@ -207,7 +207,7 @@ void GigabyteAorusLaptopController::SetCustom(std::vector 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; diff --git a/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.h b/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.h index 40491a95..ee4cc5bf 100644 --- a/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.h +++ b/Controllers/GigabyteAorusLaptopController/GigabyteAorusLaptopController.h @@ -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 colors, std::vector positions); + void SetCustom(std::vector colors, std::vector positions, unsigned char brightness); protected: hid_device* dev; diff --git a/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp b/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp index 0a50e25a..1f3c4206 100644 --- a/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp +++ b/Controllers/GigabyteAorusLaptopController/RGBController_GigabyteAorusLaptop.cpp @@ -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); } }