Add support for Cougar Revenger ST - Closes #2312
This commit is contained in:
parent
0b202fc1ba
commit
56334ed7c5
7 changed files with 720 additions and 0 deletions
|
|
@ -258,6 +258,14 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="0a34", TAG+="uacces
|
|||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b6e", TAG+="uaccess"
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="1b1c", ATTR{idProduct}=="1b62", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Cougar Devices #
|
||||
# #
|
||||
# Devices: #
|
||||
# Cougar Revenger ST #
|
||||
#---------------------------------------------------------------#
|
||||
SUBSYSTEMS=="usb", ATTR{idVendor}=="12cf", ATTR{idProduct}=="0412", TAG+="uaccess"
|
||||
|
||||
#---------------------------------------------------------------#
|
||||
# Creative Devices #
|
||||
# #
|
||||
|
|
|
|||
29
Controllers/CougarController/CougarControllerDetect.cpp
Normal file
29
Controllers/CougarController/CougarControllerDetect.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "Detector.h"
|
||||
#include "CougarRevengerSTController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_CougarRevengerST.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Cougar vendor ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define COUGAR_VID 0x12CF
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Product ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define COUGAR_REVENGER_ST_PID 0x0412
|
||||
|
||||
void DetectCougarRevengerSTControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
CougarRevengerSTController* controller = new CougarRevengerSTController(dev, *info);
|
||||
RGBController_CougarRevengerST* rgb_controller = new RGBController_CougarRevengerST(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("Cougar Revenger ST", DetectCougarRevengerSTControllers, COUGAR_VID, COUGAR_REVENGER_ST_PID, 0, 0x0001, 0x02);
|
||||
208
Controllers/CougarController/CougarRevengerSTController.cpp
Normal file
208
Controllers/CougarController/CougarRevengerSTController.cpp
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
/*-----------------------------------------*\
|
||||
| CougarRevengerSTController.cpp |
|
||||
| |
|
||||
| Driver for Cougar Revenger ST lighting |
|
||||
| controller |
|
||||
| |
|
||||
| Guimard Morgan (morg) 3/17/2022 |
|
||||
\*-----------------------------------------*/
|
||||
#include "CougarRevengerSTController.h"
|
||||
#include <string.h>
|
||||
|
||||
CougarRevengerSTController::CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = info.path;
|
||||
version = "";
|
||||
|
||||
wchar_t serial_string[128];
|
||||
int ret = hid_get_serial_number_string(dev, serial_string, 128);
|
||||
|
||||
if(ret != 0)
|
||||
{
|
||||
serial_number = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring return_wstring = serial_string;
|
||||
serial_number = std::string(return_wstring.begin(), return_wstring.end());
|
||||
}
|
||||
|
||||
ActivateMode(0, DIRECT_MODE_VALUE);
|
||||
ActivateMode(1, DIRECT_MODE_VALUE);
|
||||
ActivateMode(2, DIRECT_MODE_VALUE);
|
||||
}
|
||||
|
||||
CougarRevengerSTController::~CougarRevengerSTController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string CougarRevengerSTController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string CougarRevengerSTController::GetSerialString()
|
||||
{
|
||||
return(serial_number);
|
||||
}
|
||||
|
||||
std::string CougarRevengerSTController::GetFirmwareVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::SetDirect(unsigned char zone, RGBColor color, unsigned char brightness)
|
||||
{
|
||||
const cougar_mode& m = modes_mapping.at(DIRECT_MODE_VALUE);
|
||||
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
usb_buf[0x05] = m.zone_mode_byte[zone];
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Set RGB Values |
|
||||
\*-----------------------------------------*/
|
||||
SendColourPacket(m.zone_rgb_mapping[zone], RGBGetRValue(color), usb_buf);
|
||||
SendColourPacket(m.zone_rgb_mapping[zone] + 1, RGBGetGValue(color), usb_buf);
|
||||
SendColourPacket(m.zone_rgb_mapping[zone] + 2, RGBGetBValue(color), usb_buf);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Set Brightness |
|
||||
\*-----------------------------------------*/
|
||||
usb_buf[0x04] = m.zone_brightness_mapping[zone];
|
||||
usb_buf[0x06] = brightness;
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::SetModeData(unsigned char zone, unsigned char mode_value, std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed)
|
||||
{
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
|
||||
const cougar_mode& m = modes_mapping.at(mode_value);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Define colors |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
|
||||
unsigned char offset = m.zone_rgb_mapping[zone];
|
||||
|
||||
usb_buf[0x05] = m.zone_rgb_byte[zone];
|
||||
|
||||
for(unsigned int i = 0; i < COLORS_SIZE; i++)
|
||||
{
|
||||
if(mode_value == BREATHING_MODE_VALUE && i >= 3 && zone == 2)
|
||||
{
|
||||
usb_buf[0x05] = 0x01;
|
||||
}
|
||||
|
||||
SendColourPacket(offset, RGBGetRValue(colors[i]), usb_buf);
|
||||
SendColourPacket(offset + 1, RGBGetGValue(colors[i]), usb_buf);
|
||||
SendColourPacket(offset + 2, RGBGetBValue(colors[i]), usb_buf);
|
||||
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Define speed |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
usb_buf[0x04] = m.zone_speed_mapping[zone];
|
||||
usb_buf[0x05] = m.zone_speed_byte[zone];
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Dirty hack here: |
|
||||
| The OEM app or firmware seems to be |
|
||||
| broken, at full speed it flashes on |
|
||||
| the bottom zone. Let's adjust a bit the |
|
||||
| value so it's almost consistent with |
|
||||
| the other zones at full speed. |
|
||||
\*-----------------------------------------*/
|
||||
if(mode_value == SWIFT_MODE_VALUE && zone == 0)
|
||||
{
|
||||
usb_buf[0x06] = (speed + 1) * 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
usb_buf[0x06] = speed;
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Define brightness |
|
||||
\*-----------------------------------------*/
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
|
||||
usb_buf[0x05] = m.zone_brightness_byte[zone];
|
||||
usb_buf[0x06] = brightness;
|
||||
|
||||
offset = m.zone_brightness_mapping[zone];
|
||||
|
||||
for(unsigned int i = 0; i < COLORS_SIZE; i++)
|
||||
{
|
||||
if(mode_value == BREATHING_MODE_VALUE && i >= 4 && zone == 2)
|
||||
{
|
||||
usb_buf[0x05] = 0x01;
|
||||
}
|
||||
|
||||
usb_buf[0x04] = offset;
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
Apply();
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::SendColourPacket(unsigned char address, unsigned char value, unsigned char *buffer)
|
||||
{
|
||||
buffer[0x04] = address;
|
||||
buffer[0x06] = value;
|
||||
|
||||
hid_send_feature_report(dev, buffer, PACKET_DATA_LENGTH);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::ActivateMode(unsigned char zone, unsigned char mode_value)
|
||||
{
|
||||
const cougar_mode& m = modes_mapping.at(mode_value);
|
||||
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = ACTION_SET;
|
||||
usb_buf[0x04] = m.zone_mode_mapping[zone]; // zone dependent?
|
||||
usb_buf[0x05] = m.zone_mode_byte[zone];
|
||||
usb_buf[0x06] = mode_value;
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
}
|
||||
|
||||
void CougarRevengerSTController::Apply()
|
||||
{
|
||||
unsigned char usb_buf[PACKET_DATA_LENGTH];
|
||||
memset(usb_buf, 0x00, PACKET_DATA_LENGTH);
|
||||
|
||||
usb_buf[0x01] = PACKET_START;
|
||||
usb_buf[0x02] = 0x03;
|
||||
usb_buf[0x03] = 0x03;
|
||||
usb_buf[0x04] = 0x03;
|
||||
|
||||
hid_send_feature_report(dev,usb_buf, PACKET_DATA_LENGTH);
|
||||
}
|
||||
247
Controllers/CougarController/CougarRevengerSTController.h
Normal file
247
Controllers/CougarController/CougarRevengerSTController.h
Normal file
|
|
@ -0,0 +1,247 @@
|
|||
/*-----------------------------------------*\
|
||||
| CougarRevengerSTController.h |
|
||||
| |
|
||||
| Driver for Cougar Revenger ST lighting |
|
||||
| controller - header file |
|
||||
| |
|
||||
| Guimard Morgan (morg) 3/17/2022 |
|
||||
\*-----------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define PACKET_DATA_LENGTH 9
|
||||
|
||||
enum
|
||||
{
|
||||
PACKET_START = 0xC4,
|
||||
ACTION_SET = 0x0F
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MIN_BRIGHTNESS = 0x00,
|
||||
MAX_BRIGHTNESS = 0xFF,
|
||||
MIN_SPEED_SWIFT = 0x2F,
|
||||
MIN_SPEED = 0x0F,
|
||||
MAX_SPEED = 0x00,
|
||||
COLORS_SIZE = 0x07
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
OFF_MODE_VALUE = 0x00,
|
||||
DIRECT_MODE_VALUE = 0x01,
|
||||
BREATHING_MODE_VALUE = 0x02,
|
||||
FLOW_MODE_VALUE = 0x03,
|
||||
SWIFT_MODE_VALUE = 0x04,
|
||||
FLOW_LEFT_MODE_VALUE = 0x09,
|
||||
FLOW_RIGHT_MODE_VALUE = 0x0B
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char zone_mode_mapping[3];
|
||||
unsigned char zone_mode_byte[3];
|
||||
unsigned char zone_rgb_mapping[3];
|
||||
unsigned char zone_rgb_byte[3];
|
||||
unsigned char zone_brightness_mapping[3];
|
||||
unsigned char zone_brightness_byte[3];
|
||||
unsigned char zone_speed_mapping[3];
|
||||
unsigned char zone_speed_byte[3];
|
||||
} cougar_mode;
|
||||
|
||||
const cougar_mode DIRECT_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x79, 0x57, 0xE8
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x78, 0x56, 0xE7
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode OFF_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x00, 0x00, 0x00
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode BREATHING_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x85, 0x63, 0xF4
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x84, 0x62, 0xF3
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0x7C, 0x5A, 0xEB
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode SWIFT_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x55, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0xB0, 0x8E, 0x1F
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAF, 0x8D, 0x1E
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAD, 0x8B, 0x1C
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
}
|
||||
};
|
||||
|
||||
const cougar_mode FLOW_MODE =
|
||||
{
|
||||
{
|
||||
0x77, 0x00, 0xE6
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x00
|
||||
},
|
||||
{
|
||||
0xB0, 0x00, 0x1F
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAF, 0x00, 0x1E
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
},
|
||||
{
|
||||
0xAD, 0x00, 0x1C
|
||||
},
|
||||
{
|
||||
0x01, 0x00, 0x01
|
||||
}
|
||||
};
|
||||
|
||||
static const std::map<unsigned char, cougar_mode> modes_mapping =
|
||||
{
|
||||
{
|
||||
DIRECT_MODE_VALUE,
|
||||
DIRECT_MODE
|
||||
},
|
||||
{
|
||||
OFF_MODE_VALUE,
|
||||
OFF_MODE
|
||||
},
|
||||
{
|
||||
BREATHING_MODE_VALUE,
|
||||
BREATHING_MODE
|
||||
},
|
||||
{
|
||||
SWIFT_MODE_VALUE,
|
||||
SWIFT_MODE
|
||||
},
|
||||
{
|
||||
FLOW_LEFT_MODE_VALUE,
|
||||
FLOW_MODE
|
||||
},
|
||||
{
|
||||
FLOW_RIGHT_MODE_VALUE,
|
||||
FLOW_MODE
|
||||
}
|
||||
};
|
||||
|
||||
class CougarRevengerSTController
|
||||
{
|
||||
public:
|
||||
CougarRevengerSTController(hid_device* dev_handle, const hid_device_info& info);
|
||||
~CougarRevengerSTController();
|
||||
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetFirmwareVersion();
|
||||
|
||||
void ActivateMode(unsigned char zone, unsigned char mode_value);
|
||||
void SetDirect(unsigned char zone, RGBColor color, unsigned char brightness);
|
||||
void SetModeData(unsigned char zone, unsigned char mode_value, std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed);
|
||||
|
||||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
std::string version;
|
||||
|
||||
void Apply();
|
||||
void SendColourPacket(unsigned char address, unsigned char value, unsigned char * buffer);
|
||||
};
|
||||
192
Controllers/CougarController/RGBController_CougarRevengerST.cpp
Normal file
192
Controllers/CougarController/RGBController_CougarRevengerST.cpp
Normal file
|
|
@ -0,0 +1,192 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CougarRevengerST.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Cougar Revenger ST USB Driver |
|
||||
| |
|
||||
| Guimard Morgan (morg) 3/17/2022 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_CougarRevengerST.h"
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
RGBController_CougarRevengerST::RGBController_CougarRevengerST(CougarRevengerSTController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Cougar Revenger ST USB Device";
|
||||
vendor = "Cougar";
|
||||
type = DEVICE_TYPE_MOUSE;
|
||||
description = name;
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = DIRECT_MODE_VALUE;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.brightness_min = MIN_BRIGHTNESS;
|
||||
Direct.brightness_max = MAX_BRIGHTNESS;
|
||||
Direct.brightness = MAX_BRIGHTNESS;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Off;
|
||||
Off.name = "Off";
|
||||
Off.value = OFF_MODE_VALUE;
|
||||
Off.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Off.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Off);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = BREATHING_MODE_VALUE;
|
||||
Breathing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.brightness = MAX_BRIGHTNESS;
|
||||
Breathing.brightness_min = MIN_BRIGHTNESS;
|
||||
Breathing.brightness_max = MAX_BRIGHTNESS;
|
||||
Breathing.speed = MAX_SPEED;
|
||||
Breathing.speed_min = MIN_SPEED;
|
||||
Breathing.speed_max = MAX_SPEED;
|
||||
Breathing.colors_min = COLORS_SIZE;
|
||||
Breathing.colors_max = COLORS_SIZE;
|
||||
Breathing.colors.resize(COLORS_SIZE);
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Swift;
|
||||
Swift.name = "Swift";
|
||||
Swift.value = SWIFT_MODE_VALUE;
|
||||
Swift.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Swift.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Swift.brightness = MAX_BRIGHTNESS;
|
||||
Swift.brightness_min = MIN_BRIGHTNESS;
|
||||
Swift.brightness_max = MAX_BRIGHTNESS;
|
||||
Swift.speed = MAX_SPEED;
|
||||
Swift.speed_min = MIN_SPEED_SWIFT;
|
||||
Swift.speed_max = MAX_SPEED;
|
||||
Swift.colors_min = COLORS_SIZE;
|
||||
Swift.colors_max = COLORS_SIZE;
|
||||
Swift.colors.resize(COLORS_SIZE);
|
||||
modes.push_back(Swift);
|
||||
|
||||
mode Flow;
|
||||
Flow.name = "Flow";
|
||||
Flow.value = FLOW_MODE_VALUE;
|
||||
Flow.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_DIRECTION_LR;
|
||||
Flow.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flow.brightness = MAX_BRIGHTNESS;
|
||||
Flow.brightness_min = MIN_BRIGHTNESS;
|
||||
Flow.brightness_max = MAX_BRIGHTNESS;
|
||||
Flow.speed = MAX_SPEED;
|
||||
Flow.speed_min = MIN_SPEED;
|
||||
Flow.speed_max = MAX_SPEED;
|
||||
Flow.colors_min = COLORS_SIZE;
|
||||
Flow.colors_max = COLORS_SIZE;
|
||||
Flow.direction = MODE_DIRECTION_LEFT;
|
||||
Flow.colors.resize(COLORS_SIZE);
|
||||
modes.push_back(Flow);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_CougarRevengerST::~RGBController_CougarRevengerST()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Bottom";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = 1;
|
||||
new_zone.leds_max = 1;
|
||||
new_zone.leds_count = 1;
|
||||
new_zone.matrix_map = nullptr;
|
||||
zones.push_back(new_zone);
|
||||
|
||||
new_zone.name = "Mouse wheel";
|
||||
zones.push_back(new_zone);
|
||||
|
||||
new_zone.name = "Logo";
|
||||
zones.push_back(new_zone);
|
||||
|
||||
leds.resize(zones.size());
|
||||
|
||||
for(unsigned int i = 0; i < leds.size(); i++)
|
||||
{
|
||||
leds[i].name = "LED " + std::to_string(i+1);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::DeviceUpdateLEDs()
|
||||
{
|
||||
for(unsigned int i = 0; i < colors.size(); i++)
|
||||
{
|
||||
UpdateZoneLEDs(i);
|
||||
}
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::UpdateZoneLEDs(int zone)
|
||||
{
|
||||
controller->SetDirect(zone, colors[zone], modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_CougarRevengerST::DeviceUpdateMode()
|
||||
{
|
||||
switch(modes[active_mode].value)
|
||||
{
|
||||
case DIRECT_MODE_VALUE:
|
||||
case OFF_MODE_VALUE:
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
controller->ActivateMode(zone_idx, modes[active_mode].value);
|
||||
}
|
||||
break;
|
||||
case BREATHING_MODE_VALUE:
|
||||
case SWIFT_MODE_VALUE:
|
||||
for(unsigned int zone_idx = 0; zone_idx < zones.size(); zone_idx++)
|
||||
{
|
||||
controller->ActivateMode(zone_idx, modes[active_mode].value);
|
||||
controller->SetModeData(zone_idx, modes[active_mode].value, modes[active_mode].colors, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
}
|
||||
break;
|
||||
|
||||
case FLOW_MODE_VALUE:
|
||||
|
||||
unsigned char mode_value = modes[active_mode].direction == MODE_DIRECTION_LEFT ? FLOW_LEFT_MODE_VALUE : FLOW_RIGHT_MODE_VALUE;
|
||||
|
||||
controller->ActivateMode(0, mode_value);
|
||||
controller->ActivateMode(1, OFF_MODE_VALUE);
|
||||
controller->ActivateMode(2, mode_value);
|
||||
|
||||
controller->SetModeData(0, mode_value, modes[active_mode].colors, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
controller->SetModeData(2, mode_value, modes[active_mode].colors, modes[active_mode].brightness, modes[active_mode].speed);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_CougarRevengerST.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| Cougar Revenger ST USB Driver |
|
||||
| |
|
||||
| Guimard Morgan (morg) 3/17/2022 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "CougarRevengerSTController.h"
|
||||
|
||||
class RGBController_CougarRevengerST : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_CougarRevengerST(CougarRevengerSTController* controller_ptr);
|
||||
~RGBController_CougarRevengerST();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
void DeviceUpdateMode();
|
||||
void SetCustomMode();
|
||||
|
||||
private:
|
||||
CougarRevengerSTController* controller;
|
||||
};
|
||||
|
|
@ -289,6 +289,8 @@ HEADERS +=
|
|||
Controllers/CorsairVengeanceProController/RGBController_CorsairVengeancePro.h \
|
||||
Controllers/CorsairWirelessController/CorsairWirelessController.h \
|
||||
Controllers/CorsairWirelessController/RGBController_CorsairWireless.h \
|
||||
Controllers/CougarController/CougarRevengerSTController.h \
|
||||
Controllers/CougarController/RGBController_CougarRevengerST.h \
|
||||
Controllers/CreativeController/CreativeSoundBlasterXG6Controller.h \
|
||||
Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.h \
|
||||
Controllers/CrucialController/CrucialController.h \
|
||||
|
|
@ -698,6 +700,9 @@ SOURCES +=
|
|||
Controllers/CorsairWirelessController/CorsairWirelessController.cpp \
|
||||
Controllers/CorsairWirelessController/CorsairWirelessControllerDetect.cpp \
|
||||
Controllers/CorsairWirelessController/RGBController_CorsairWireless.cpp \
|
||||
Controllers/CougarController/CougarRevengerSTController.cpp \
|
||||
Controllers/CougarController/CougarControllerDetect.cpp \
|
||||
Controllers/CougarController/RGBController_CougarRevengerST.cpp \
|
||||
Controllers/CreativeController/CreativeSoundBlasterXG6Controller.cpp \
|
||||
Controllers/CreativeController/CreativeControllerDetect.cpp \
|
||||
Controllers/CreativeController/RGBController_CreativeSoundBlasterXG6.cpp \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue