MSI OPTIX MAG271CQR Monitor support
This commit is contained in:
parent
25d86c7d33
commit
97d5a9e84d
7 changed files with 764 additions and 0 deletions
218
Controllers/MSIOptixController/MSIOptixController.cpp
Normal file
218
Controllers/MSIOptixController/MSIOptixController.cpp
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
/*-----------------------------------------*\
|
||||
| MSIOptixController.cpp |
|
||||
| |
|
||||
| Driver for MSI Optix monitor lighting |
|
||||
| controller |
|
||||
| |
|
||||
| Guimard Morgan (morg) 1/10/2022 |
|
||||
\*-----------------------------------------*/
|
||||
#include "MSIOptixController.h"
|
||||
#include <string.h>
|
||||
|
||||
MSIOptixController::MSIOptixController(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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MSIOptixController::~MSIOptixController()
|
||||
{
|
||||
hid_close(dev);
|
||||
}
|
||||
|
||||
std::string MSIOptixController::GetDeviceLocation()
|
||||
{
|
||||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string MSIOptixController::GetSerialString()
|
||||
{
|
||||
return(serial_number);
|
||||
}
|
||||
|
||||
std::string MSIOptixController::GetFirmwareVersion()
|
||||
{
|
||||
return(version);
|
||||
}
|
||||
|
||||
unsigned char MSIOptixController::GetMysteriousFlag(unsigned char mode_value)
|
||||
{
|
||||
switch(mode_value)
|
||||
{
|
||||
case RAINBOW_MODE_VALUE:
|
||||
case STACK_MODE_VALUE:
|
||||
case BREATHING_MODE_VALUE:
|
||||
case FLASHING_MODE_VALUE:
|
||||
case DOUBLE_FLASHING_MODE_VALUE:
|
||||
case STATIC_MODE_VALUE:
|
||||
case METEOR_MODE_VALUE:
|
||||
case LIGHNING_MODE_VALUE:
|
||||
case PLANETARY_MODE_VALUE:
|
||||
case DOUBLE_METEOR_MODE_VALUE:
|
||||
case ENERGY_MODE_VALUE:
|
||||
case MARQUEE_MODE_VALUE:
|
||||
return MSI_OPTIX_MYSTERIOUS_FLAG;
|
||||
|
||||
default: return 0x00;
|
||||
}
|
||||
}
|
||||
|
||||
void MSIOptixController::SetDirect(std::vector<RGBColor> colors, unsigned char brightness)
|
||||
{
|
||||
unsigned char usb_buf[MSI_OPTIX_REPORT_SIZE];
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = MSI_OPTIC_REPORT_ID;
|
||||
|
||||
unsigned char offset = 0x00;
|
||||
|
||||
usb_buf[offset + 0x01] = DIRECT_MODE_VALUE; // mode
|
||||
usb_buf[offset + 0x02] = 0xff; // color r value
|
||||
usb_buf[offset + 0x03] = 0xff; // color g value
|
||||
usb_buf[offset + 0x04] = 0xff; // color b value
|
||||
usb_buf[offset + 0x05] = 0x00; // speed
|
||||
usb_buf[offset + 0x06] = brightness; // Brightness
|
||||
usb_buf[offset + 0x07] = 0x00; // always 00
|
||||
usb_buf[offset + 0x08] = 0xff; // always ff
|
||||
usb_buf[offset + 0x09] = 0x00; // always 00
|
||||
usb_buf[offset + 0x0A] = MSI_OPTIX_MYSTERIOUS_FLAG; // enigma
|
||||
usb_buf[offset + 0x0B] = 0x00; // always 00
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Duplicate the block - enigma |
|
||||
\*-----------------------------------------*/
|
||||
offset = 0x0B;
|
||||
|
||||
usb_buf[offset + 0x01] = DIRECT_MODE_VALUE; // mode
|
||||
usb_buf[offset + 0x02] = 0xff; // color r value
|
||||
usb_buf[offset + 0x03] = 0xff; // color g value
|
||||
usb_buf[offset + 0x04] = 0xff; // color b value
|
||||
usb_buf[offset + 0x05] = 0x00; // speed
|
||||
usb_buf[offset + 0x06] = brightness; // Brightness
|
||||
usb_buf[offset + 0x07] = 0x00; // always 00
|
||||
usb_buf[offset + 0x08] = 0xff; // always ff
|
||||
usb_buf[offset + 0x09] = 0x00; // always 00
|
||||
usb_buf[offset + 0x0A] = MSI_OPTIX_MYSTERIOUS_FLAG; // enigma
|
||||
usb_buf[offset + 0x0B] = 0x00; // always 00
|
||||
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Colors block position |
|
||||
\*-----------------------------------------*/
|
||||
offset += 0x0B;
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Start at index 25 in the colors block |
|
||||
| multiplied by the 3 channels (rgb) |
|
||||
\*-----------------------------------------*/
|
||||
offset += MSI_OPTIX_DIRECT_COLOR_OFFSET;
|
||||
|
||||
for(unsigned int i = 0; i < MSI_OPTIX_NUMBER_OF_LEDS; i++)
|
||||
{
|
||||
usb_buf[++offset] = RGBGetRValue(colors[i]);
|
||||
usb_buf[++offset] = RGBGetGValue(colors[i]);
|
||||
usb_buf[++offset] = RGBGetBValue(colors[i]);
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, sizeof(usb_buf));
|
||||
}
|
||||
|
||||
void MSIOptixController::SetMode(std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed, unsigned char mode_value, unsigned int mode_flags)
|
||||
{
|
||||
unsigned char red = 0xff;
|
||||
unsigned char grn = 0xff;
|
||||
unsigned char blu = 0xff;
|
||||
|
||||
if(mode_flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
|
||||
{
|
||||
red = RGBGetRValue(colors[0]);
|
||||
grn = RGBGetGValue(colors[0]);
|
||||
blu = RGBGetBValue(colors[0]);
|
||||
}
|
||||
|
||||
unsigned char usb_buf[MSI_OPTIX_REPORT_SIZE];
|
||||
|
||||
memset(usb_buf, 0x00, sizeof(usb_buf));
|
||||
|
||||
usb_buf[0x00] = MSI_OPTIC_REPORT_ID;
|
||||
|
||||
unsigned char offset = 0x00;
|
||||
|
||||
usb_buf[offset + 0x01] = mode_value; // mode
|
||||
usb_buf[offset + 0x02] = red; // color r value
|
||||
usb_buf[offset + 0x03] = grn; // color g value
|
||||
usb_buf[offset + 0x04] = blu; // color b value
|
||||
usb_buf[offset + 0x05] = speed; // speed
|
||||
usb_buf[offset + 0x06] = brightness; // Brightness
|
||||
usb_buf[offset + 0x07] = 0x00; // always 00
|
||||
usb_buf[offset + 0x08] = 0xff; // always ff
|
||||
usb_buf[offset + 0x09] = 0x00; // always 00
|
||||
usb_buf[offset + 0x0A] = GetMysteriousFlag(mode_value); // enigma
|
||||
usb_buf[offset + 0x0B] = 0x00; // always 00
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Duplicate the block - enigma |
|
||||
\*-----------------------------------------*/
|
||||
offset = 0x0B;
|
||||
|
||||
usb_buf[offset + 0x01] = mode_value; // mode
|
||||
usb_buf[offset + 0x02] = red; // color r value
|
||||
usb_buf[offset + 0x03] = grn; // color g value
|
||||
usb_buf[offset + 0x04] = blu; // color b value
|
||||
usb_buf[offset + 0x05] = speed; // speed
|
||||
usb_buf[offset + 0x06] = brightness; // Brightness
|
||||
usb_buf[offset + 0x07] = 0x00; // always 00
|
||||
usb_buf[offset + 0x08] = 0xff; // always ff
|
||||
usb_buf[offset + 0x09] = 0x00; // always 00
|
||||
usb_buf[offset + 0x0A] = GetMysteriousFlag(mode_value); // enigma
|
||||
usb_buf[offset + 0x0B] = 0x00; // always 00
|
||||
|
||||
/*-----------------------------------------*\
|
||||
| Colors block position |
|
||||
\*-----------------------------------------*/
|
||||
offset += 0x0B;
|
||||
|
||||
if(mode_flags & MODE_FLAG_HAS_PER_LED_COLOR)
|
||||
{
|
||||
/*-----------------------------------------*\
|
||||
| Start at index 25 in the colors block |
|
||||
| multiplied by the 3 channels (rgb) |
|
||||
\*-----------------------------------------*/
|
||||
offset += MSI_OPTIX_DIRECT_COLOR_OFFSET;
|
||||
|
||||
for(unsigned int i = 0; i < MSI_OPTIX_NUMBER_OF_LEDS; i++)
|
||||
{
|
||||
usb_buf[++offset] = RGBGetRValue(colors[i]);
|
||||
usb_buf[++offset] = RGBGetGValue(colors[i]);
|
||||
usb_buf[++offset] = RGBGetBValue(colors[i]);
|
||||
}
|
||||
}
|
||||
|
||||
else if(mode_flags & MODE_FLAG_HAS_MODE_SPECIFIC_COLOR)
|
||||
{
|
||||
for(unsigned int i = 0; i < MSI_OPTIX_COLOR_PACKET_SIZE; i++)
|
||||
{
|
||||
usb_buf[++offset] = red;
|
||||
usb_buf[++offset] = grn;
|
||||
usb_buf[++offset] = blu;
|
||||
}
|
||||
}
|
||||
|
||||
hid_send_feature_report(dev, usb_buf, sizeof(usb_buf));
|
||||
}
|
||||
86
Controllers/MSIOptixController/MSIOptixController.h
Normal file
86
Controllers/MSIOptixController/MSIOptixController.h
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
/*-----------------------------------------*\
|
||||
| MSIOptixController.h |
|
||||
| |
|
||||
| Driver for MSI Optix monitor lighting |
|
||||
| controller - header file |
|
||||
| |
|
||||
| Guimard Morgan (morg) 1/10/2022 |
|
||||
\*-----------------------------------------*/
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include <string>
|
||||
#include <hidapi/hidapi.h>
|
||||
|
||||
#define MSI_OPTIX_REPORT_SIZE 168
|
||||
#define MSI_OPTIX_COLOR_PACKET_SIZE 48
|
||||
#define MSI_OPTIX_NUMBER_OF_LEDS 12
|
||||
#define MSI_OPTIX_DIRECT_COLOR_OFFSET 24 * 3;
|
||||
#define MSI_OPTIC_REPORT_ID 0x72
|
||||
#define MSI_OPTIX_DEFAULT_MODE_COLOR ToRGBColor(255,0,0)
|
||||
|
||||
enum
|
||||
{
|
||||
OFF_MODE_VALUE = 0x00,
|
||||
RAINBOW_MODE_VALUE = 0x0f,
|
||||
METEOR_MODE_VALUE = 0x07,
|
||||
STACK_MODE_VALUE = 0x08,
|
||||
BREATHING_MODE_VALUE = 0x02,
|
||||
FLASHING_MODE_VALUE = 0x03,
|
||||
DOUBLE_FLASHING_MODE_VALUE = 0x04,
|
||||
DIRECT_MODE_VALUE = 0x01,
|
||||
STATIC_MODE_VALUE = 0x01,
|
||||
LIGHNING_MODE_VALUE = 0x05,
|
||||
PLANETARY_MODE_VALUE = 0x10,
|
||||
DOUBLE_METEOR_MODE_VALUE = 0x11,
|
||||
ENERGY_MODE_VALUE = 0x12,
|
||||
BLINK_MODE_VALUE = 0x13,
|
||||
CLOCK_MODE_VALUE = 0x14,
|
||||
COLOR_PULSE_MODE_VALUE = 0x15,
|
||||
COLOR_SHIFT_MODE_VALUE = 0x16,
|
||||
COLOR_WAVE_MODE_VALUE = 0x17,
|
||||
MARQUEE_MODE_VALUE = 0x18,
|
||||
RAINBOW_WAVE_MODE_VALUE = 0x1a,
|
||||
VISOR_MODE_VALUE = 0x1b
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MSI_OPTIX_BRIGHTNESS_MIN = 0x00,
|
||||
MSI_OPTIX_BRIGHTNESS_MAX = 0x64
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MSI_OPTIX_SPEED_MIN = 0x00,
|
||||
MSI_OPTIX_SPEED_MAX = 0x02
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MSI_OPTIX_MYSTERIOUS_FLAG = 0x80
|
||||
};
|
||||
|
||||
class MSIOptixController
|
||||
{
|
||||
public:
|
||||
MSIOptixController(hid_device* dev_handle, const hid_device_info& info);
|
||||
~MSIOptixController();
|
||||
|
||||
std::string GetSerialString();
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetFirmwareVersion();
|
||||
|
||||
void SetDirect(std::vector<RGBColor> colors, unsigned char brightness);
|
||||
void SetMode(std::vector<RGBColor> colors, unsigned char brightness, unsigned char speed, unsigned char mode_value, unsigned int mode_flags);
|
||||
|
||||
protected:
|
||||
hid_device* dev;
|
||||
|
||||
private:
|
||||
std::string location;
|
||||
std::string serial_number;
|
||||
std::string version;
|
||||
|
||||
unsigned char GetMysteriousFlag(unsigned char mode_value);
|
||||
};
|
||||
29
Controllers/MSIOptixController/MSIOptixControllerDetect.cpp
Normal file
29
Controllers/MSIOptixController/MSIOptixControllerDetect.cpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "Detector.h"
|
||||
#include "MSIOptixController.h"
|
||||
#include "RGBController.h"
|
||||
#include "RGBController_MSIOptix.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| MSI vendor ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define MSI_VID 0x1462
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Product ID |
|
||||
\*---------------------------------------------------------*/
|
||||
#define MSI_OPTIX_MAG274QRF_PID 0x3FA4
|
||||
|
||||
void DetectMSIOptixControllers(hid_device_info* info, const std::string& name)
|
||||
{
|
||||
hid_device* dev = hid_open_path(info->path);
|
||||
|
||||
if(dev)
|
||||
{
|
||||
MSIOptixController* controller = new MSIOptixController(dev, *info);
|
||||
RGBController_MSIOptix* rgb_controller = new RGBController_MSIOptix(controller);
|
||||
rgb_controller->name = name;
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_HID_DETECTOR_IPU("MSI Optix controller", DetectMSIOptixControllers, MSI_VID, MSI_OPTIX_MAG274QRF_PID, 0, 0xFF00, 1);
|
||||
389
Controllers/MSIOptixController/RGBController_MSIOptix.cpp
Normal file
389
Controllers/MSIOptixController/RGBController_MSIOptix.cpp
Normal file
|
|
@ -0,0 +1,389 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_MSIOptix.cpp |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| MSIOptix USB Driver |
|
||||
| |
|
||||
| Guimard Morgan (morg) 1/10/2022 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#include "RGBController_MSIOptix.h"
|
||||
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
RGBController_MSIOptix::RGBController_MSIOptix(MSIOptixController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
name = "MSI Optix USB Device";
|
||||
vendor = "MSI";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
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 = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Direct.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Direct.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = STATIC_MODE_VALUE;
|
||||
Static.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors_min = 1;
|
||||
Static.colors_max = 1;
|
||||
Static.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Static.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Static.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Static.colors.resize(1);
|
||||
Static.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode OFF;
|
||||
OFF.name = "Off";
|
||||
OFF.value = OFF_MODE_VALUE;
|
||||
OFF.flags = 0;
|
||||
OFF.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(OFF);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = RAINBOW_MODE_VALUE;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Rainbow.color_mode = MODE_COLORS_NONE;
|
||||
Rainbow.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Rainbow.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Rainbow.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Rainbow.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Rainbow.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Rainbow.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
mode Meteor;
|
||||
Meteor.name = "Meteor";
|
||||
Meteor.value = METEOR_MODE_VALUE;
|
||||
Meteor.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Meteor.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Meteor.colors_min = 1;
|
||||
Meteor.colors_max = 1;
|
||||
Meteor.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Meteor.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Meteor.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Meteor.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Meteor.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Meteor.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Meteor.colors.resize(1);
|
||||
Meteor.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Meteor);
|
||||
|
||||
mode Stack;
|
||||
Stack.name = "Stack";
|
||||
Stack.value = STACK_MODE_VALUE;
|
||||
Stack.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Stack.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Stack.colors_min = 1;
|
||||
Stack.colors_max = 1;
|
||||
Stack.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Stack.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Stack.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Stack.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Stack.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Stack.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Stack.colors.resize(1);
|
||||
Stack.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Stack);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = BREATHING_MODE_VALUE;
|
||||
Breathing.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Breathing.color_mode = MODE_COLORS_PER_LED;
|
||||
Breathing.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Breathing.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Breathing.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Breathing.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Breathing.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Breathing.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Breathing.colors.resize(1);
|
||||
Breathing.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Flashing;
|
||||
Flashing.name = "Flashing";
|
||||
Flashing.value = FLASHING_MODE_VALUE;
|
||||
Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flashing.colors_min = 1;
|
||||
Flashing.colors_max = 1;
|
||||
Flashing.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Flashing.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Flashing.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Flashing.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Flashing.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Flashing.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Flashing.colors.resize(1);
|
||||
Flashing.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Flashing);
|
||||
|
||||
mode Double_Flashing;
|
||||
Double_Flashing.name = "Double Flashing";
|
||||
Double_Flashing.value = DOUBLE_FLASHING_MODE_VALUE;
|
||||
Double_Flashing.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Double_Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Double_Flashing.colors_min = 1;
|
||||
Double_Flashing.colors_max = 1;
|
||||
Double_Flashing.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Double_Flashing.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Double_Flashing.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Double_Flashing.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Double_Flashing.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Double_Flashing.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Double_Flashing.colors.resize(1);
|
||||
Double_Flashing.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Double_Flashing);
|
||||
|
||||
mode Lightning;
|
||||
Lightning.name = "Lightning";
|
||||
Lightning.value = LIGHNING_MODE_VALUE;
|
||||
Lightning.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Lightning.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Lightning.colors_min = 1;
|
||||
Lightning.colors_max = 1;
|
||||
Lightning.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Lightning.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Lightning.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Lightning.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Lightning.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Lightning.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Lightning.colors.resize(1);
|
||||
Lightning.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Lightning);
|
||||
|
||||
mode Planetary;
|
||||
Planetary.name = "Planetary";
|
||||
Planetary.value = PLANETARY_MODE_VALUE;
|
||||
Planetary.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Planetary.color_mode = MODE_COLORS_NONE;
|
||||
Planetary.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Planetary.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Planetary.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Planetary.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Planetary.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Planetary.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Planetary);
|
||||
|
||||
mode Double_Meteor;
|
||||
Double_Meteor.name = "Double_Meteor";
|
||||
Double_Meteor.value = DOUBLE_METEOR_MODE_VALUE;
|
||||
Double_Meteor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Double_Meteor.color_mode = MODE_COLORS_NONE;
|
||||
Double_Meteor.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Double_Meteor.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Double_Meteor.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Double_Meteor.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Double_Meteor.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Double_Meteor.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Double_Meteor);
|
||||
|
||||
mode Energy;
|
||||
Energy.name = "Energy";
|
||||
Energy.value = ENERGY_MODE_VALUE;
|
||||
Energy.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Energy.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Energy.colors_min = 1;
|
||||
Energy.colors_max = 1;
|
||||
Energy.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Energy.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Energy.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Energy.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Energy.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Energy.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Energy.colors.resize(1);
|
||||
Energy.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Energy);
|
||||
|
||||
mode Blink;
|
||||
Blink.name = "Blink";
|
||||
Blink.value = BLINK_MODE_VALUE;
|
||||
Blink.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Blink.color_mode = MODE_COLORS_NONE;
|
||||
Blink.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Blink.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Blink.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Blink.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Blink.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Blink.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Blink);
|
||||
|
||||
mode Clock;
|
||||
Clock.name = "Clock";
|
||||
Clock.value = CLOCK_MODE_VALUE;
|
||||
Clock.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Clock.color_mode = MODE_COLORS_NONE;
|
||||
Clock.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Clock.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Clock.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Clock.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Clock.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Clock.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Clock);
|
||||
|
||||
mode Color_Pulse;
|
||||
Color_Pulse.name = "Color Pulse";
|
||||
Color_Pulse.value = COLOR_PULSE_MODE_VALUE;
|
||||
Color_Pulse.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Color_Pulse.color_mode = MODE_COLORS_NONE;
|
||||
Color_Pulse.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Color_Pulse.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Color_Pulse.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Color_Pulse.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Color_Pulse.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Color_Pulse.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Color_Pulse);
|
||||
|
||||
mode Color_Shift;
|
||||
Color_Shift.name = "Color Shift";
|
||||
Color_Shift.value = COLOR_SHIFT_MODE_VALUE;
|
||||
Color_Shift.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Color_Shift.color_mode = MODE_COLORS_NONE;
|
||||
Color_Shift.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Color_Shift.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Color_Shift.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Color_Shift.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Color_Shift.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Color_Shift.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Color_Shift);
|
||||
|
||||
mode Color_wave;
|
||||
Color_wave.name = "Color Wave";
|
||||
Color_wave.value = COLOR_WAVE_MODE_VALUE;
|
||||
Color_wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Color_wave.color_mode = MODE_COLORS_NONE;
|
||||
Color_wave.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Color_wave.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Color_wave.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Color_wave.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Color_wave.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Color_wave.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Color_wave);
|
||||
|
||||
mode Marquee;
|
||||
Marquee.name = "Marquee";
|
||||
Marquee.value = MARQUEE_MODE_VALUE;
|
||||
Marquee.flags = MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Marquee.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Marquee.colors_min = 1;
|
||||
Marquee.colors_max = 1;
|
||||
Marquee.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Marquee.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Marquee.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Marquee.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Marquee.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Marquee.speed = MSI_OPTIX_SPEED_MIN;
|
||||
Marquee.colors.resize(1);
|
||||
Marquee.colors[0] = MSI_OPTIX_DEFAULT_MODE_COLOR;
|
||||
modes.push_back(Marquee);
|
||||
|
||||
mode Rainbow_Wave;
|
||||
Rainbow_Wave.name = "Rainbow Wave";
|
||||
Rainbow_Wave.value = RAINBOW_WAVE_MODE_VALUE;
|
||||
Rainbow_Wave.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Rainbow_Wave.color_mode = MODE_COLORS_NONE;
|
||||
Rainbow_Wave.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Rainbow_Wave.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Rainbow_Wave.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Rainbow_Wave.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Rainbow_Wave.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Rainbow_Wave.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Rainbow_Wave);
|
||||
|
||||
mode Visor;
|
||||
Visor.name = "Visor";
|
||||
Visor.value = VISOR_MODE_VALUE;
|
||||
Visor.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Visor.color_mode = MODE_COLORS_NONE;
|
||||
Visor.brightness_min = MSI_OPTIX_BRIGHTNESS_MIN;
|
||||
Visor.brightness_max = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Visor.brightness = MSI_OPTIX_BRIGHTNESS_MAX;
|
||||
Visor.speed_min = MSI_OPTIX_SPEED_MIN;
|
||||
Visor.speed_max = MSI_OPTIX_SPEED_MAX;
|
||||
Visor.speed = MSI_OPTIX_SPEED_MIN;
|
||||
modes.push_back(Visor);
|
||||
|
||||
SetupZones();
|
||||
}
|
||||
|
||||
RGBController_MSIOptix::~RGBController_MSIOptix()
|
||||
{
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_MSIOptix::SetupZones()
|
||||
{
|
||||
zone new_zone;
|
||||
|
||||
new_zone.name = "Backside";
|
||||
new_zone.type = ZONE_TYPE_LINEAR;
|
||||
new_zone.leds_min = MSI_OPTIX_NUMBER_OF_LEDS;
|
||||
new_zone.leds_max = MSI_OPTIX_NUMBER_OF_LEDS;
|
||||
new_zone.leds_count = MSI_OPTIX_NUMBER_OF_LEDS;
|
||||
new_zone.matrix_map = nullptr;
|
||||
|
||||
zones.emplace_back(new_zone);
|
||||
|
||||
leds.resize(new_zone.leds_count);
|
||||
|
||||
for(unsigned int i = 0; i < MSI_OPTIX_NUMBER_OF_LEDS; i++)
|
||||
{
|
||||
leds[i].name = "LED " + std::to_string(i);
|
||||
}
|
||||
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_MSIOptix::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_MSIOptix::DeviceUpdateLEDs()
|
||||
{
|
||||
UpdateZoneLEDs(0);
|
||||
}
|
||||
|
||||
void RGBController_MSIOptix::UpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
controller->SetDirect(colors, modes[active_mode].brightness);
|
||||
}
|
||||
|
||||
void RGBController_MSIOptix::UpdateSingleLED(int led)
|
||||
{
|
||||
UpdateZoneLEDs(led);
|
||||
}
|
||||
|
||||
void RGBController_MSIOptix::SetCustomMode()
|
||||
{
|
||||
active_mode = 0;
|
||||
}
|
||||
|
||||
void RGBController_MSIOptix::DeviceUpdateMode()
|
||||
{
|
||||
if(modes[active_mode].flags & MODE_FLAG_HAS_PER_LED_COLOR)
|
||||
{
|
||||
controller->SetMode(colors, modes[active_mode].brightness, modes[active_mode].speed, modes[active_mode].value, modes[active_mode].flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
controller->SetMode(modes[active_mode].colors, modes[active_mode].brightness, modes[active_mode].speed, modes[active_mode].value, modes[active_mode].flags);
|
||||
}
|
||||
}
|
||||
31
Controllers/MSIOptixController/RGBController_MSIOptix.h
Normal file
31
Controllers/MSIOptixController/RGBController_MSIOptix.h
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_MSIOptix.h |
|
||||
| |
|
||||
| Generic RGB Interface for OpenRGB |
|
||||
| MISOptix RGB USB Driver |
|
||||
| |
|
||||
| Guimard Morgan (morg) 1/10/2022 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "MSIOptixController.h"
|
||||
|
||||
class RGBController_MSIOptix : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_MSIOptix(MSIOptixController* controller_ptr);
|
||||
~RGBController_MSIOptix();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
void DeviceUpdateMode();
|
||||
void SetCustomMode();
|
||||
|
||||
private:
|
||||
MSIOptixController* controller;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue