From 98e7126184964e222983c3abaa3fed3c8765cd1a Mon Sep 17 00:00:00 2001 From: morg Date: Fri, 10 Jun 2022 03:52:46 +0000 Subject: [PATCH] Add support for Roccat Burst Pro. Closes #1561 --- .../RGBController_RoccatBurst.cpp | 199 ++++++++++++++++++ ...urstCore.h => RGBController_RoccatBurst.h} | 61 +++--- .../RGBController_RoccatBurstCore.cpp | 181 ---------------- ...ntroller.cpp => RoccatBurstController.cpp} | 77 ++++--- ...reController.h => RoccatBurstController.h} | 46 ++-- .../RoccatControllerDetect.cpp | 23 +- OpenRGB.pro | 8 +- 7 files changed, 319 insertions(+), 276 deletions(-) create mode 100644 Controllers/RoccatController/RGBController_RoccatBurst.cpp rename Controllers/RoccatController/{RGBController_RoccatBurstCore.h => RGBController_RoccatBurst.h} (61%) delete mode 100644 Controllers/RoccatController/RGBController_RoccatBurstCore.cpp rename Controllers/RoccatController/{RoccatBurstCoreController.cpp => RoccatBurstController.cpp} (53%) rename Controllers/RoccatController/{RoccatBurstCoreController.h => RoccatBurstController.h} (50%) diff --git a/Controllers/RoccatController/RGBController_RoccatBurst.cpp b/Controllers/RoccatController/RGBController_RoccatBurst.cpp new file mode 100644 index 00000000..d117a6d1 --- /dev/null +++ b/Controllers/RoccatController/RGBController_RoccatBurst.cpp @@ -0,0 +1,199 @@ +/*-----------------------------------------*\ +| RGBController_RoccatBurst.cpp | +| | +| Generic RGB Interface for OpenRGB | +| | +| | +| Morgan Guimard (morg) 6/01/2022 | +\*-----------------------------------------*/ + +#include "RGBController_RoccatBurst.h" + +/**------------------------------------------------------------------*\ + @name Roccat Burst Core + @category Mouse + @type USB + @save :warning: + @direct :white_check_mark: + @effects :white_check_mark: + @detectors DetectRoccatBurstCoreControllers + @comment +\*-------------------------------------------------------------------*/ + +/**------------------------------------------------------------------*\ + @name Roccat Burst Pro + @category Mouse + @type USB + @save :warning: + @direct :white_check_mark: + @effects :white_check_mark: + @detectors DetectRoccatBurstProControllers + @comment +\*-------------------------------------------------------------------*/ + +RGBController_RoccatBurst::RGBController_RoccatBurst(RoccatBurstController* controller_ptr, unsigned int leds_count): + leds_count(leds_count) +{ + controller = controller_ptr; + + name = "Roccat Burst Core"; + vendor = "Roccat"; + type = DEVICE_TYPE_MOUSE; + description = "Roccat Burst Core Mouse"; + + mode Direct; + Direct.name = "Direct"; + Direct.value = ROCCAT_BURST_DIRECT_MODE_VALUE; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; + Direct.color_mode = MODE_COLORS_PER_LED; + modes.push_back(Direct); + + mode Static; + Static.name = "Static"; + Static.value = ROCCAT_BURST_STATIC_MODE_VALUE; + Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS; + Static.color_mode = MODE_COLORS_MODE_SPECIFIC; + Static.brightness = ROCCAT_BURST_BRIGHTNESS_MAX; + Static.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN; + Static.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX; + Static.colors.resize(leds_count); + modes.push_back(Static); + + mode Rainbow; + Rainbow.name = "Rainbow"; + Rainbow.value = ROCCAT_BURST_WAVE_MODE_VALUE; + Rainbow.flags = MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; + Rainbow.color_mode = MODE_COLORS_NONE; + Rainbow.brightness = ROCCAT_BURST_BRIGHTNESS_MAX; + Rainbow.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN; + Rainbow.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX; + Rainbow.speed = ROCCAT_BURST_SPEED_MIN; + Rainbow.speed_min = ROCCAT_BURST_SPEED_MIN; + Rainbow.speed_max = ROCCAT_BURST_SPEED_MAX; + modes.push_back(Rainbow); + + mode HeartBeat; + HeartBeat.name = "HeartBeat"; + HeartBeat.value = ROCCAT_BURST_HEARTBEAT_MODE_VALUE; + HeartBeat.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; + HeartBeat.color_mode = MODE_COLORS_MODE_SPECIFIC; + HeartBeat.brightness = ROCCAT_BURST_BRIGHTNESS_MAX; + HeartBeat.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN; + HeartBeat.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX; + HeartBeat.speed = ROCCAT_BURST_SPEED_MIN; + HeartBeat.speed_min = ROCCAT_BURST_SPEED_MIN; + HeartBeat.speed_max = ROCCAT_BURST_SPEED_MAX; + HeartBeat.colors.resize(leds_count); + modes.push_back(HeartBeat); + + mode Breathing; + Breathing.name = "Breathing"; + Breathing.value = ROCCAT_BURST_BREATHING_MODE_VALUE; + Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; + Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC; + Breathing.brightness = ROCCAT_BURST_BRIGHTNESS_MAX; + Breathing.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN; + Breathing.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX; + Breathing.speed = ROCCAT_BURST_SPEED_MIN; + Breathing.speed_min = ROCCAT_BURST_SPEED_MIN; + Breathing.speed_max = ROCCAT_BURST_SPEED_MAX; + Breathing.colors.resize(leds_count); + modes.push_back(Breathing); + + mode Blinking; + Blinking.name = "Blinking"; + Blinking.value = ROCCAT_BURST_BLINKING_MODE_VALUE; + Blinking.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; + Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC; + Blinking.brightness = ROCCAT_BURST_BRIGHTNESS_MAX; + Blinking.brightness_min = ROCCAT_BURST_BRIGHTNESS_MIN; + Blinking.brightness_max = ROCCAT_BURST_BRIGHTNESS_MAX; + Blinking.speed = ROCCAT_BURST_SPEED_MIN; + Blinking.speed_min = ROCCAT_BURST_SPEED_MIN; + Blinking.speed_max = ROCCAT_BURST_SPEED_MAX; + Blinking.colors.resize(leds_count); + modes.push_back(Blinking); + + SetupZones(); +} + +RGBController_RoccatBurst::~RGBController_RoccatBurst() +{ + delete controller; +} + +void RGBController_RoccatBurst::SetupZones() +{ + zone new_zone; + new_zone.name = "Mouse"; + new_zone.type = ZONE_TYPE_LINEAR; + new_zone.leds_min = leds_count; + new_zone.leds_max = leds_count; + new_zone.leds_count = leds_count; + new_zone.matrix_map = NULL; + zones.push_back(new_zone); + + std::string led_names[2] = + { + "Scroll Wheel", + "Logo" + }; + + for(unsigned int i = 0; i < leds_count; i++) + { + led new_led; + new_led.name = led_names[i]; + leds.push_back(new_led); + } + + SetupColors(); +} + +void RGBController_RoccatBurst::ResizeZone(int /*zone*/, int /*new_size*/) +{ + /*---------------------------------------------------------*\ + | This device does not support resizing zones | + \*---------------------------------------------------------*/ +} + +void RGBController_RoccatBurst::DeviceUpdateLEDs() +{ + UpdateZoneLEDs(0); +} + +void RGBController_RoccatBurst::UpdateZoneLEDs(int /*zone_idx*/) +{ + const mode& active = modes[active_mode]; + + if(active.value == ROCCAT_BURST_DIRECT_MODE_VALUE) + { + controller->SendDirect(colors); + } + else + { + controller->SetMode(active.colors, active.value, active.speed, active.brightness, active.color_mode, active.flags); + } + +} + +void RGBController_RoccatBurst::UpdateSingleLED(int /*led_idx*/) +{ + UpdateZoneLEDs(0); +} + +void RGBController_RoccatBurst::SetCustomMode() +{ + active_mode = 0; +} + +void RGBController_RoccatBurst::DeviceUpdateMode() +{ + if(modes[active_mode].value == ROCCAT_BURST_DIRECT_MODE_VALUE) + { + controller->SetupDirectMode(); + } + else + { + DeviceUpdateLEDs(); + } +} diff --git a/Controllers/RoccatController/RGBController_RoccatBurstCore.h b/Controllers/RoccatController/RGBController_RoccatBurst.h similarity index 61% rename from Controllers/RoccatController/RGBController_RoccatBurstCore.h rename to Controllers/RoccatController/RGBController_RoccatBurst.h index 20656c22..78a03aca 100644 --- a/Controllers/RoccatController/RGBController_RoccatBurstCore.h +++ b/Controllers/RoccatController/RGBController_RoccatBurst.h @@ -1,30 +1,31 @@ -/*-----------------------------------------*\ -| RGBController_RoccatBurstCore.h | -| | -| Generic RGB Interface for Roccat Burst | -| Core Mouse controller | -| | -| Morgan Guimard (morg) 6/01/2022 | -\*-----------------------------------------*/ - -#pragma once -#include "RGBController.h" -#include "RoccatBurstCoreController.h" - -class RGBController_RoccatBurstCore : public RGBController -{ -public: - RGBController_RoccatBurstCore(RoccatBurstCoreController* controller_ptr); - ~RGBController_RoccatBurstCore(); - - void SetupZones(); - void ResizeZone(int zone, int new_size); - void DeviceUpdateLEDs(); - void UpdateZoneLEDs(int zone); - void UpdateSingleLED(int led); - void SetCustomMode(); - void DeviceUpdateMode(); - -private: - RoccatBurstCoreController* controller; -}; +/*-----------------------------------------*\ +| RGBController_RoccatBurst.h | +| | +| Generic RGB Interface for Roccat Burst | +| Core and Pro Mouse controller | +| | +| Morgan Guimard (morg) 6/01/2022 | +\*-----------------------------------------*/ + +#pragma once +#include "RGBController.h" +#include "RoccatBurstController.h" + +class RGBController_RoccatBurst : public RGBController +{ +public: + RGBController_RoccatBurst(RoccatBurstController* controller_ptr, unsigned int leds_count); + ~RGBController_RoccatBurst(); + + void SetupZones(); + void ResizeZone(int zone, int new_size); + void DeviceUpdateLEDs(); + void UpdateZoneLEDs(int zone); + void UpdateSingleLED(int led); + void SetCustomMode(); + void DeviceUpdateMode(); + +private: + RoccatBurstController* controller; + unsigned int leds_count; +}; diff --git a/Controllers/RoccatController/RGBController_RoccatBurstCore.cpp b/Controllers/RoccatController/RGBController_RoccatBurstCore.cpp deleted file mode 100644 index 1bc3e558..00000000 --- a/Controllers/RoccatController/RGBController_RoccatBurstCore.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/*-----------------------------------------*\ -| RGBController_RoccatBurstCore.cpp | -| | -| Generic RGB Interface for OpenRGB | -| | -| | -| Morgan Guimard (morg) 6/01/2022 | -\*-----------------------------------------*/ - -#include "RGBController_RoccatBurstCore.h" - -/**------------------------------------------------------------------*\ - @name Roccat Burst Core - @category Mouse - @type USB - @save :warning: - @direct :white_check_mark: - @effects :white_check_mark: - @detectors DetectRoccatBurstCoreControllers - @comment -\*-------------------------------------------------------------------*/ - -RGBController_RoccatBurstCore::RGBController_RoccatBurstCore(RoccatBurstCoreController* controller_ptr) -{ - controller = controller_ptr; - - name = "Roccat Burst Core"; - vendor = "Roccat"; - type = DEVICE_TYPE_MOUSE; - description = "Roccat Burst Core Mouse"; - - mode Direct; - Direct.name = "Direct"; - Direct.value = ROCCAT_BURST_CORE_DIRECT_MODE_VALUE; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; - modes.push_back(Direct); - - mode Static; - Static.name = "Static"; - Static.value = ROCCAT_BURST_CORE_STATIC_MODE_VALUE; - Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS; - Static.color_mode = MODE_COLORS_MODE_SPECIFIC; - Static.brightness = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Static.brightness_min = ROCCAT_BURST_CORE_BRIGHTNESS_MIN; - Static.brightness_max = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Static.colors.resize(1); - modes.push_back(Static); - - mode Rainbow; - Rainbow.name = "Rainbow"; - Rainbow.value = ROCCAT_BURST_CORE_WAVE_MODE_VALUE; - Rainbow.flags = MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; - Rainbow.color_mode = MODE_COLORS_NONE; - Rainbow.brightness = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Rainbow.brightness_min = ROCCAT_BURST_CORE_BRIGHTNESS_MIN; - Rainbow.brightness_max = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Rainbow.speed = ROCCAT_BURST_CORE_SPEED_MIN; - Rainbow.speed_min = ROCCAT_BURST_CORE_SPEED_MIN; - Rainbow.speed_max = ROCCAT_BURST_CORE_SPEED_MAX; - modes.push_back(Rainbow); - - mode HeartBeat; - HeartBeat.name = "HeartBeat"; - HeartBeat.value = ROCCAT_BURST_CORE_HEARTBEAT_MODE_VALUE; - HeartBeat.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; - HeartBeat.color_mode = MODE_COLORS_MODE_SPECIFIC; - HeartBeat.brightness = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - HeartBeat.brightness_min = ROCCAT_BURST_CORE_BRIGHTNESS_MIN; - HeartBeat.brightness_max = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - HeartBeat.speed = ROCCAT_BURST_CORE_SPEED_MIN; - HeartBeat.speed_min = ROCCAT_BURST_CORE_SPEED_MIN; - HeartBeat.speed_max = ROCCAT_BURST_CORE_SPEED_MAX; - HeartBeat.colors.resize(1); - modes.push_back(HeartBeat); - - mode Breathing; - Breathing.name = "Breathing"; - Breathing.value = ROCCAT_BURST_CORE_BREATHING_MODE_VALUE; - Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; - Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC; - Breathing.brightness = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Breathing.brightness_min = ROCCAT_BURST_CORE_BRIGHTNESS_MIN; - Breathing.brightness_max = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Breathing.speed = ROCCAT_BURST_CORE_SPEED_MIN; - Breathing.speed_min = ROCCAT_BURST_CORE_SPEED_MIN; - Breathing.speed_max = ROCCAT_BURST_CORE_SPEED_MAX; - Breathing.colors.resize(1); - modes.push_back(Breathing); - - mode Blinking; - Blinking.name = "Blinking"; - Blinking.value = ROCCAT_BURST_CORE_BLINKING_MODE_VALUE; - Blinking.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_AUTOMATIC_SAVE | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED; - Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC; - Blinking.brightness = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Blinking.brightness_min = ROCCAT_BURST_CORE_BRIGHTNESS_MIN; - Blinking.brightness_max = ROCCAT_BURST_CORE_BRIGHTNESS_MAX; - Blinking.speed = ROCCAT_BURST_CORE_SPEED_MIN; - Blinking.speed_min = ROCCAT_BURST_CORE_SPEED_MIN; - Blinking.speed_max = ROCCAT_BURST_CORE_SPEED_MAX; - Blinking.colors.resize(1); - modes.push_back(Blinking); - - SetupZones(); -} - -RGBController_RoccatBurstCore::~RGBController_RoccatBurstCore() -{ - delete controller; -} - -void RGBController_RoccatBurstCore::SetupZones() -{ - zone new_zone; - new_zone.name = "Scroll wheel"; - new_zone.type = ZONE_TYPE_LINEAR; - new_zone.leds_min = ROCCAT_BURST_CORE_NUMBER_OF_LEDS; - new_zone.leds_max = ROCCAT_BURST_CORE_NUMBER_OF_LEDS; - new_zone.leds_count = ROCCAT_BURST_CORE_NUMBER_OF_LEDS; - new_zone.matrix_map = NULL; - zones.push_back(new_zone); - - for(unsigned int i = 0; i < ROCCAT_BURST_CORE_NUMBER_OF_LEDS; i++) - { - led new_led; - new_led.name = "LED " + std::to_string(i + 1); - leds.push_back(new_led); - } - - SetupColors(); -} - -void RGBController_RoccatBurstCore::ResizeZone(int /*zone*/, int /*new_size*/) -{ - /*---------------------------------------------------------*\ - | This device does not support resizing zones | - \*---------------------------------------------------------*/ -} - -void RGBController_RoccatBurstCore::DeviceUpdateLEDs() -{ - UpdateZoneLEDs(0); -} - -void RGBController_RoccatBurstCore::UpdateZoneLEDs(int /*zone_idx*/) -{ - const mode& active = modes[active_mode]; - - if(active.value == ROCCAT_BURST_CORE_DIRECT_MODE_VALUE) - { - controller->SendDirect(colors); - } - else - { - controller->SetMode(active.colors, active.value, active.speed, active.brightness, active.color_mode, active.flags); - } - -} - -void RGBController_RoccatBurstCore::UpdateSingleLED(int /*led_idx*/) -{ - UpdateZoneLEDs(0); -} - -void RGBController_RoccatBurstCore::SetCustomMode() -{ - active_mode = 0; -} - -void RGBController_RoccatBurstCore::DeviceUpdateMode() -{ - if(modes[active_mode].value == ROCCAT_BURST_CORE_DIRECT_MODE_VALUE) - { - controller->SetupDirectMode(); - } - else - { - DeviceUpdateLEDs(); - } -} diff --git a/Controllers/RoccatController/RoccatBurstCoreController.cpp b/Controllers/RoccatController/RoccatBurstController.cpp similarity index 53% rename from Controllers/RoccatController/RoccatBurstCoreController.cpp rename to Controllers/RoccatController/RoccatBurstController.cpp index 1e3cbe87..27b40f90 100644 --- a/Controllers/RoccatController/RoccatBurstCoreController.cpp +++ b/Controllers/RoccatController/RoccatBurstController.cpp @@ -1,17 +1,17 @@ /*-------------------------------------------------------------------*\ -| RoccatBurstCoreController.cpp | +| RoccatBurstController.cpp | | | -| Driver for Roccat Horde Aimo Keyboard | +| Driver for Roccat Burst Core and Pro Mouse | | | | Morgan Guimard (morg) 2/24/2022 | | | \*-------------------------------------------------------------------*/ -#include "RoccatBurstCoreController.h" +#include "RoccatBurstController.h" #include -RoccatBurstCoreController::RoccatBurstCoreController(hid_device* dev_handle, const hid_device_info& info) +RoccatBurstController::RoccatBurstController(hid_device* dev_handle, const hid_device_info& info) { dev = dev_handle; version = ""; @@ -33,34 +33,34 @@ RoccatBurstCoreController::RoccatBurstCoreController(hid_device* dev_handle, con SetupDirectMode(); } -RoccatBurstCoreController::~RoccatBurstCoreController() +RoccatBurstController::~RoccatBurstController() { hid_close(dev); } -std::string RoccatBurstCoreController::GetFirmwareVersion() +std::string RoccatBurstController::GetFirmwareVersion() { return version; } -std::string RoccatBurstCoreController::GetSerialString() +std::string RoccatBurstController::GetSerialString() { return serial_number; } -std::string RoccatBurstCoreController::GetDeviceLocation() +std::string RoccatBurstController::GetDeviceLocation() { return("HID: " + location); } -void RoccatBurstCoreController::SetupDirectMode() +void RoccatBurstController::SetupDirectMode() { SwitchControl(true); } -void RoccatBurstCoreController::SwitchControl(bool direct) +void RoccatBurstController::SwitchControl(bool direct) { - unsigned char usb_buf[ROCCAT_BURST_CORE_CONTROL_MODE_PACKET_LENGTH]; + unsigned char usb_buf[ROCCAT_BURST_CONTROL_MODE_PACKET_LENGTH]; usb_buf[0x00] = 0x0E; usb_buf[0x01] = 0x06; @@ -69,36 +69,39 @@ void RoccatBurstCoreController::SwitchControl(bool direct) usb_buf[0x04] = 0x00; usb_buf[0x05] = 0xFF; - hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_CORE_CONTROL_MODE_PACKET_LENGTH); + hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_CONTROL_MODE_PACKET_LENGTH); } -void RoccatBurstCoreController::SendDirect(std::vector colors) +void RoccatBurstController::SendDirect(std::vector colors) { - unsigned char usb_buf[ROCCAT_BURST_CORE_DIRECT_MODE_PACKET_LENGTH]; + unsigned char usb_buf[ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH]; - memset(usb_buf, 0x00, ROCCAT_BURST_CORE_DIRECT_MODE_PACKET_LENGTH); + memset(usb_buf, 0x00, ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH); - usb_buf[0x00] = ROCCAT_BURST_CORE_DIRECT_MODE_REPORT_ID; - usb_buf[0x01] = ROCCAT_BURST_CORE_DIRECT_MODE_BYTE; + usb_buf[0x00] = ROCCAT_BURST_DIRECT_MODE_REPORT_ID; + usb_buf[0x01] = ROCCAT_BURST_DIRECT_MODE_BYTE; - usb_buf[0x02] = RGBGetRValue(colors[0]); - usb_buf[0x03] = RGBGetGValue(colors[0]); - usb_buf[0x04] = RGBGetBValue(colors[0]); + for(unsigned int i = 0; i < colors.size(); i++) + { + usb_buf[0x02 + 3 * i] = RGBGetRValue(colors[i]); + usb_buf[0x03 + 3 * i] = RGBGetGValue(colors[i]); + usb_buf[0x04 + 3 * i] = RGBGetBValue(colors[i]); + } - hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_CORE_DIRECT_MODE_PACKET_LENGTH); + hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH); } -void RoccatBurstCoreController::SetMode(std::vector colors, unsigned char mode_value, unsigned char speed, unsigned char brightness, unsigned int color_mode, unsigned int mode_flags) +void RoccatBurstController::SetMode(std::vector colors, unsigned char mode_value, unsigned char speed, unsigned char brightness, unsigned int color_mode, unsigned int mode_flags) { /*---------------------------------------------------------*\ | 1. Read from flash | \*---------------------------------------------------------*/ - unsigned char usb_buf[ROCCAT_BURST_CORE_FLASH_PACKET_LENGTH]; - memset(usb_buf, 0x00, ROCCAT_BURST_CORE_FLASH_PACKET_LENGTH); + unsigned char usb_buf[ROCCAT_BURST_FLASH_PACKET_LENGTH]; + memset(usb_buf, 0x00, ROCCAT_BURST_FLASH_PACKET_LENGTH); usb_buf[0x00] = 0x06; - hid_get_feature_report(dev, usb_buf, ROCCAT_BURST_CORE_FLASH_PACKET_LENGTH); + hid_get_feature_report(dev, usb_buf, ROCCAT_BURST_FLASH_PACKET_LENGTH); /*---------------------------------------------------------*\ | 2. Update needed bytes | @@ -118,15 +121,21 @@ void RoccatBurstCoreController::SetMode(std::vector colors, unsigned c { usb_buf[36] = 0x14; usb_buf[37] = 0xFF; - usb_buf[38] = RGBGetRValue(colors[0]); - usb_buf[39] = RGBGetGValue(colors[0]); - usb_buf[40] = RGBGetBValue(colors[0]); + for(unsigned int i = 0; i < colors.size(); i++) + { + usb_buf[38 + 10 * i] = RGBGetRValue(colors[i]); + usb_buf[39 + 10 * i] = RGBGetGValue(colors[i]); + usb_buf[40 + 10 * i] = RGBGetBValue(colors[i]); + } } else if (color_mode & MODE_COLORS_NONE) { - usb_buf[38] = 0xF4; - usb_buf[39] = 0x00; - usb_buf[40] = 0x00; + for(unsigned int i = 0; i < colors.size(); i++) + { + usb_buf[38 + 10 * i] = 0xF4; + usb_buf[39 + 10 * i] = 0x00; + usb_buf[40 + 10 * i] = 0x00; + } } unsigned int crc = CalculateCRC(&usb_buf[0]); @@ -137,7 +146,7 @@ void RoccatBurstCoreController::SetMode(std::vector colors, unsigned c /*---------------------------------------------------------*\ | 3. Send to flash | \*---------------------------------------------------------*/ - hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_CORE_FLASH_PACKET_LENGTH); + hid_send_feature_report(dev, usb_buf, ROCCAT_BURST_FLASH_PACKET_LENGTH); std::this_thread::sleep_for(std::chrono::milliseconds(10)); @@ -147,11 +156,11 @@ void RoccatBurstCoreController::SetMode(std::vector colors, unsigned c SwitchControl(false); } -unsigned int RoccatBurstCoreController::CalculateCRC(unsigned char* bytes) +unsigned int RoccatBurstController::CalculateCRC(unsigned char* bytes) { unsigned int crc = 0; - for(unsigned int i = 0; i < ROCCAT_BURST_CORE_FLASH_PACKET_LENGTH - 2; i++) + for(unsigned int i = 0; i < ROCCAT_BURST_FLASH_PACKET_LENGTH - 2; i++) { crc += bytes[i]; } diff --git a/Controllers/RoccatController/RoccatBurstCoreController.h b/Controllers/RoccatController/RoccatBurstController.h similarity index 50% rename from Controllers/RoccatController/RoccatBurstCoreController.h rename to Controllers/RoccatController/RoccatBurstController.h index 20c5ff45..704167f4 100644 --- a/Controllers/RoccatController/RoccatBurstCoreController.h +++ b/Controllers/RoccatController/RoccatBurstController.h @@ -1,7 +1,7 @@ /*-------------------------------------------------------------------*\ -| RoccatBurstCoreController.h | +| RoccatBurstController.h | | | -| Driver for Roccat Burst Core Mouse | +| Driver for Roccat Burst Core and Pro Mouse | | | | Morgan Guimard (morg) 6/01/2022 | \*-------------------------------------------------------------------*/ @@ -11,37 +11,37 @@ #include "RGBController.h" #include -#define ROCCAT_BURST_CORE_CONTROL_MODE_PACKET_LENGTH 6 -#define ROCCAT_BURST_CORE_DIRECT_MODE_PACKET_LENGTH 11 -#define ROCCAT_BURST_CORE_FLASH_PACKET_LENGTH 63 -#define ROCCAT_BURST_CORE_FLASH_REPORT_ID 0x06 -#define ROCCAT_BURST_CORE_DIRECT_MODE_REPORT_ID 0x0D -#define ROCCAT_BURST_CORE_DIRECT_MODE_BYTE 0x0B -#define ROCCAT_BURST_CORE_NUMBER_OF_LEDS 1 - +#define ROCCAT_BURST_CONTROL_MODE_PACKET_LENGTH 6 +#define ROCCAT_BURST_DIRECT_MODE_PACKET_LENGTH 11 +#define ROCCAT_BURST_FLASH_PACKET_LENGTH 63 +#define ROCCAT_BURST_FLASH_REPORT_ID 0x06 +#define ROCCAT_BURST_DIRECT_MODE_REPORT_ID 0x0D +#define ROCCAT_BURST_DIRECT_MODE_BYTE 0x0B +#define ROCCAT_BURST_CORE_NUMBER_OF_LEDS 1 +#define ROCCAT_BURST_PRO_NUMBER_OF_LEDS 2 enum { - ROCCAT_BURST_CORE_DIRECT_MODE_VALUE = 0x00, - ROCCAT_BURST_CORE_STATIC_MODE_VALUE = 0x01, - ROCCAT_BURST_CORE_WAVE_MODE_VALUE = 0x0A, - ROCCAT_BURST_CORE_HEARTBEAT_MODE_VALUE = 0x04, - ROCCAT_BURST_CORE_BREATHING_MODE_VALUE = 0x03, - ROCCAT_BURST_CORE_BLINKING_MODE_VALUE = 0x02 + ROCCAT_BURST_DIRECT_MODE_VALUE = 0x00, + ROCCAT_BURST_STATIC_MODE_VALUE = 0x01, + ROCCAT_BURST_WAVE_MODE_VALUE = 0x0A, + ROCCAT_BURST_HEARTBEAT_MODE_VALUE = 0x04, + ROCCAT_BURST_BREATHING_MODE_VALUE = 0x03, + ROCCAT_BURST_BLINKING_MODE_VALUE = 0x02 }; enum { - ROCCAT_BURST_CORE_SPEED_MIN = 0x01, - ROCCAT_BURST_CORE_SPEED_MAX = 0x0B, - ROCCAT_BURST_CORE_BRIGHTNESS_MIN = 0x00, - ROCCAT_BURST_CORE_BRIGHTNESS_MAX = 0xFF + ROCCAT_BURST_SPEED_MIN = 0x01, + ROCCAT_BURST_SPEED_MAX = 0x0B, + ROCCAT_BURST_BRIGHTNESS_MIN = 0x00, + ROCCAT_BURST_BRIGHTNESS_MAX = 0xFF }; -class RoccatBurstCoreController +class RoccatBurstController { public: - RoccatBurstCoreController(hid_device* dev_handle, const hid_device_info& info); - ~RoccatBurstCoreController(); + RoccatBurstController(hid_device* dev_handle, const hid_device_info& info); + ~RoccatBurstController(); std::string GetSerialString(); std::string GetDeviceLocation(); diff --git a/Controllers/RoccatController/RoccatControllerDetect.cpp b/Controllers/RoccatController/RoccatControllerDetect.cpp index 82b9c1f3..a137a79c 100644 --- a/Controllers/RoccatController/RoccatControllerDetect.cpp +++ b/Controllers/RoccatController/RoccatControllerDetect.cpp @@ -7,11 +7,11 @@ \******************************************************************************************/ #include "Detector.h" -#include "RoccatBurstCoreController.h" +#include "RoccatBurstController.h" #include "RoccatKoneAimoController.h" #include "RoccatVulcanAimoController.h" #include "RGBController.h" -#include "RGBController_RoccatBurstCore.h" +#include "RGBController_RoccatBurst.h" #include "RGBController_RoccatHordeAimo.h" #include "RGBController_RoccatKoneAimo.h" #include "RGBController_RoccatVulcanAimo.h" @@ -25,6 +25,7 @@ #define ROCCAT_VULCAN_120_AIMO_PID 0x3098 #define ROCCAT_HORDE_AIMO_PID 0x303E #define ROCCAT_BURST_CORE_PID 0x2DE6 +#define ROCCAT_BURST_PRO_PID 0x2DE1 void DetectRoccatMouseControllers(hid_device_info* info, const std::string& name) { @@ -136,8 +137,21 @@ void DetectRoccatBurstCoreControllers(hid_device_info* info, const std::string& if(dev) { - RoccatBurstCoreController * controller = new RoccatBurstCoreController(dev, *info); - RGBController_RoccatBurstCore * rgb_controller = new RGBController_RoccatBurstCore(controller); + RoccatBurstController * controller = new RoccatBurstController(dev, *info); + RGBController_RoccatBurst * rgb_controller = new RGBController_RoccatBurst(controller, ROCCAT_BURST_CORE_NUMBER_OF_LEDS); + rgb_controller->name = name; + ResourceManager::get()->RegisterRGBController(rgb_controller); + } +} + +void DetectRoccatBurstProControllers(hid_device_info* info, const std::string& name) +{ + hid_device* dev = hid_open_path(info->path); + + if(dev) + { + RoccatBurstController * controller = new RoccatBurstController(dev, *info); + RGBController_RoccatBurst * rgb_controller = new RGBController_RoccatBurst(controller, ROCCAT_BURST_PRO_NUMBER_OF_LEDS); rgb_controller->name = name; ResourceManager::get()->RegisterRGBController(rgb_controller); } @@ -149,3 +163,4 @@ REGISTER_HID_DETECTOR_IP ("Roccat Vulcan 120 Aimo", DetectRoccatKeyboard REGISTER_DYNAMIC_DETECTOR("Roccat Vulcan 120 Aimo Setup", ResetRoccatKeyboardControllersPaths); REGISTER_HID_DETECTOR_IPU("Roccat Horde Aimo", DetectRoccatHordeAimoKeyboardControllers, ROCCAT_VID, ROCCAT_HORDE_AIMO_PID, 1, 0x0B, 0); REGISTER_HID_DETECTOR_IPU("Roccat Burst Core", DetectRoccatBurstCoreControllers, ROCCAT_VID, ROCCAT_BURST_CORE_PID, 3, 0xFF01, 1); +REGISTER_HID_DETECTOR_IPU("Roccat Burst Pro", DetectRoccatBurstProControllers, ROCCAT_VID, ROCCAT_BURST_PRO_PID, 3, 0xFF01, 1); diff --git a/OpenRGB.pro b/OpenRGB.pro index 4f62ace2..929ed2a5 100644 --- a/OpenRGB.pro +++ b/OpenRGB.pro @@ -500,11 +500,11 @@ HEADERS += Controllers/RazerController/RGBController_RazerKraken.h \ Controllers/RedragonController/RedragonM711Controller.h \ Controllers/RedragonController/RGBController_RedragonM711.h \ - Controllers/RoccatController/RGBController_RoccatBurstCore.h \ + Controllers/RoccatController/RGBController_RoccatBurst.h \ Controllers/RoccatController/RGBController_RoccatHordeAimo.h \ Controllers/RoccatController/RGBController_RoccatKoneAimo.h \ Controllers/RoccatController/RGBController_RoccatVulcanAimo.h \ - Controllers/RoccatController/RoccatBurstCoreController.h \ + Controllers/RoccatController/RoccatBurstController.h \ Controllers/RoccatController/RoccatHordeAimoController.h \ Controllers/RoccatController/RoccatKoneAimoController.h \ Controllers/RoccatController/RoccatVulcanAimoController.h \ @@ -1018,11 +1018,11 @@ SOURCES += Controllers/RedragonController/RedragonM711Controller.cpp \ Controllers/RedragonController/RedragonControllerDetect.cpp \ Controllers/RedragonController/RGBController_RedragonM711.cpp \ - Controllers/RoccatController/RGBController_RoccatBurstCore.cpp \ + Controllers/RoccatController/RGBController_RoccatBurst.cpp \ Controllers/RoccatController/RGBController_RoccatHordeAimo.cpp \ Controllers/RoccatController/RGBController_RoccatKoneAimo.cpp \ Controllers/RoccatController/RGBController_RoccatVulcanAimo.cpp \ - Controllers/RoccatController/RoccatBurstCoreController.cpp \ + Controllers/RoccatController/RoccatBurstController.cpp \ Controllers/RoccatController/RoccatHordeAimoController.cpp \ Controllers/RoccatController/RoccatKoneAimoController.cpp \ Controllers/RoccatController/RoccatVulcanAimoController.cpp \