Changed Gigabyte Fusion 2 controller
* Removed warnings * Refactored RGBFusion2USBController::SetLEDEffect() to improve readability * Tidied up Mode declarations * Other changes for style and formatting
This commit is contained in:
parent
ca84bad1fc
commit
fbb7d16039
8 changed files with 257 additions and 337 deletions
|
|
@ -11,8 +11,6 @@
|
|||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "GigabyteRGBFusion2USBController.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
/*-------------------------------------------------------------------------*\
|
||||
| Low level RGB value conversion table |
|
||||
|
|
@ -85,7 +83,7 @@ RGBFusion2USBController::~RGBFusion2USBController()
|
|||
\*---------------------------------------------------------*/
|
||||
bool RGBFusion2USBController::RefreshHardwareInfo()
|
||||
{
|
||||
unsigned char buffer[64] = {0};
|
||||
unsigned char buffer[FUSION2_USB_BUFFER_SIZE] = {0};
|
||||
|
||||
SendPacket(0x60, 0x00);
|
||||
buffer[0] = report_id;
|
||||
|
|
@ -140,7 +138,7 @@ bool RGBFusion2USBController::RefreshHardwareInfo()
|
|||
cali_loaded = false;
|
||||
if(product_id == 0x5711)
|
||||
{
|
||||
unsigned char buffer2[64] = {0};
|
||||
unsigned char buffer2[FUSION2_USB_BUFFER_SIZE] = {0};
|
||||
SendPacket(0x61, 0x00);
|
||||
buffer2[0] = report_id;
|
||||
int res2 = hid_get_feature_report(dev, buffer2, sizeof(buffer2));
|
||||
|
|
@ -364,7 +362,7 @@ void RGBFusion2USBController::SetLedCount(unsigned int c0, unsigned int c1, unsi
|
|||
D_LED3_count = new_d3;
|
||||
D_LED4_count = new_d4;
|
||||
|
||||
unsigned char buffer[64] = { 0 };
|
||||
unsigned char buffer[FUSION2_USB_BUFFER_SIZE] = { 0 };
|
||||
buffer[0] = report_id;
|
||||
buffer[1] = 0x34;
|
||||
buffer[2] = (new_d2 << 4) | new_d1;
|
||||
|
|
@ -550,14 +548,12 @@ void RGBFusion2USBController::SetStripColors(unsigned int hdr, RGBColor* colors,
|
|||
|
||||
for(int i = 0; i < leds_in_pkt; i++)
|
||||
{
|
||||
RGBColor color = colors[k];
|
||||
unsigned char red = RGBGetRValue(color);
|
||||
unsigned char grn = RGBGetGValue(color);
|
||||
unsigned char blu = RGBGetBValue(color);
|
||||
RGBColor color = colors[k];
|
||||
uint8_t offset = (i * 3) + 5;
|
||||
|
||||
pkt.buffer[5 + i * 3 + bo_r] = red;
|
||||
pkt.buffer[5 + i * 3 + bo_g] = grn;
|
||||
pkt.buffer[5 + i * 3 + bo_b] = blu;
|
||||
pkt.buffer[offset + bo_r] = RGBGetRValue(color);
|
||||
pkt.buffer[offset + bo_g] = RGBGetGValue(color);
|
||||
pkt.buffer[offset + bo_b] = RGBGetBValue(color);
|
||||
k++;
|
||||
}
|
||||
|
||||
|
|
@ -585,7 +581,7 @@ void RGBFusion2USBController::SetStripColors(unsigned int hdr, RGBColor* colors,
|
|||
| -(15)Gigabyte dflash ranges are 800-2600ms in 200ms steps |
|
||||
| -(3)(15)flash and dflash parameters were combined. |
|
||||
\*---------------------------------------------------------*/
|
||||
void RGBFusion2USBController::SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, unsigned char r, unsigned char g, unsigned char b)
|
||||
void RGBFusion2USBController::SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, uint32_t* color)
|
||||
{
|
||||
PktEffect pkt;
|
||||
pkt.Init(led, report_id, product_id);
|
||||
|
|
@ -599,66 +595,57 @@ void RGBFusion2USBController::SetLEDEffect(int led, int mode, unsigned int speed
|
|||
}
|
||||
pkt.e.max_brightness = brightness;
|
||||
pkt.e.effect_type = mode;
|
||||
pkt.e.color0 = r << 16 | g << 8 | b;
|
||||
pkt.e.effect_param0 = random ? 7 : 0;
|
||||
pkt.e.color0 = RGBToBGRColor(*color);
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case 2:
|
||||
pkt.e.period0 = pkt.e.period1 = (speed <= 6) ? (400 + speed * 100) : (1000 + (speed - 6) * 200);
|
||||
case EFFECT_PULSE:
|
||||
pkt.e.period0 = (speed <= 6) ? (400 + speed * 100) : (1000 + (speed - 6) * 200);
|
||||
pkt.e.period1 = pkt.e.period0;
|
||||
pkt.e.period2 = 200;
|
||||
if(random)
|
||||
{
|
||||
pkt.e.effect_param0 = 7;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
case EFFECT_DFLASH:
|
||||
pkt.e.effect_type = 3;
|
||||
pkt.e.effect_param1 = 1;
|
||||
pkt.e.effect_param2 = 2;
|
||||
case 3:
|
||||
case EFFECT_BLINKING:
|
||||
pkt.e.period0 = 100;
|
||||
pkt.e.period1 = 100;
|
||||
pkt.e.period2 = (speed * 200) + 700;
|
||||
if(random)
|
||||
{
|
||||
pkt.e.effect_param0 = 7;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case EFFECT_COLORCYCLE:
|
||||
pkt.e.period0 = (speed * 100 + 300) + (speed > 8 ? 1300 * (speed - 8) : 0);
|
||||
pkt.e.period1 = pkt.e.period0 -200;
|
||||
pkt.e.effect_param0 = 7;
|
||||
break;
|
||||
case 6:
|
||||
pkt.e.period0 = ((speed + 1)^2 + (speed + 1) + 10) * 5 / 2;
|
||||
case EFFECT_WAVE:
|
||||
pkt.e.period0 = (((speed + 1)^2) + (speed + 1) + 10) * 5 / 2;
|
||||
pkt.e.effect_param0 = 7;
|
||||
pkt.e.effect_param1 = 1;
|
||||
break;
|
||||
case 8:
|
||||
case EFFECT_RANDOM:
|
||||
pkt.e.period0 = 100;
|
||||
pkt.e.effect_param0 = 1;
|
||||
pkt.e.effect_param1 = 5;
|
||||
break;
|
||||
case 9:
|
||||
case EFFECT_WAVE1:
|
||||
pkt.e.period0 = 1200;
|
||||
pkt.e.period1 = 100;
|
||||
pkt.e.period2 = 360;
|
||||
pkt.e.period3 = 1200;
|
||||
break;
|
||||
case 10:
|
||||
case EFFECT_WAVE2:
|
||||
case EFFECT_WAVE4:
|
||||
pkt.e.period0 = 200;
|
||||
pkt.e.effect_param0 = 7;
|
||||
break;
|
||||
case 11:
|
||||
case EFFECT_WAVE3:
|
||||
pkt.e.period0 = 840;
|
||||
pkt.e.period1 = 20;
|
||||
pkt.e.period2 = 200;
|
||||
pkt.e.period3 = 840;
|
||||
break;
|
||||
case 12:
|
||||
pkt.e.period0 = 200;
|
||||
pkt.e.effect_param0 = 7;
|
||||
break;
|
||||
}
|
||||
SendPacket(pkt.buffer);
|
||||
}
|
||||
|
|
@ -684,24 +671,24 @@ bool RGBFusion2USBController::ApplyEffect(bool fast_apply)
|
|||
pkt.a.zone_sel0 = effect_zone_mask;
|
||||
|
||||
effect_zone_mask = 0;
|
||||
return SendPacket(pkt.buffer());
|
||||
return SendPacket(pkt.buffer);
|
||||
}
|
||||
|
||||
bool RGBFusion2USBController::SendPacket(uint8_t a, uint8_t b, uint8_t c)
|
||||
{
|
||||
unsigned char buffer[64] {};
|
||||
unsigned char buffer[FUSION2_USB_BUFFER_SIZE] {};
|
||||
|
||||
buffer[0] = report_id;
|
||||
buffer[1] = a;
|
||||
buffer[2] = b;
|
||||
buffer[3] = c;
|
||||
|
||||
return(SendPacket(buffer) == 64);
|
||||
return(SendPacket(buffer) == FUSION2_USB_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
int RGBFusion2USBController::SendPacket(unsigned char* packet)
|
||||
{
|
||||
return hid_send_feature_report(dev, packet, 64);
|
||||
return hid_send_feature_report(dev, packet, FUSION2_USB_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -722,4 +709,4 @@ void RGBFusion2USBController::ResetController()
|
|||
}
|
||||
}
|
||||
ApplyEffect(true);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,66 +13,65 @@
|
|||
#pragma once
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
#include <hidapi.h>
|
||||
#include <map>
|
||||
#include "RGBController.h"
|
||||
|
||||
#define FUSION2_USB_BUFFER_SIZE 64
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
| Base LED mappings found on all controllers. |
|
||||
\*--------------------------------------------------------*/
|
||||
const uint8_t LED1 = 0;
|
||||
const uint8_t LED2 = 1;
|
||||
const uint8_t LED3 = 2;
|
||||
const uint8_t LED4 = 3;
|
||||
const uint8_t LED5 = 4;
|
||||
const uint8_t LED6 = 5;
|
||||
const uint8_t LED7 = 6;
|
||||
const uint8_t LED8 = 7;
|
||||
const uint8_t LED1 = 0;
|
||||
const uint8_t LED2 = 1;
|
||||
const uint8_t LED3 = 2;
|
||||
const uint8_t LED4 = 3;
|
||||
const uint8_t LED5 = 4;
|
||||
const uint8_t LED6 = 5;
|
||||
const uint8_t LED7 = 6;
|
||||
const uint8_t LED8 = 7;
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
| IT8297/IT5701/IT5702 ARGB Headers |
|
||||
\*--------------------------------------------------------*/
|
||||
const uint8_t HDR_D_LED1 = LED6;
|
||||
const uint8_t HDR_D_LED2 = LED7;
|
||||
const uint8_t HDR_D_LED1_RGB = 0x58;
|
||||
const uint8_t HDR_D_LED2_RGB = 0x59;
|
||||
const uint8_t HDR_D_LED1 = LED6;
|
||||
const uint8_t HDR_D_LED2 = LED7;
|
||||
const uint8_t HDR_D_LED1_RGB = 0x58;
|
||||
const uint8_t HDR_D_LED2_RGB = 0x59;
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
| Additional LED mappings found on IT5711 controllers. |
|
||||
\*--------------------------------------------------------*/
|
||||
const uint8_t LED9 = 8;
|
||||
const uint8_t LED10 = 9;
|
||||
const uint8_t LED11 = 10;
|
||||
const uint8_t LED9 = 8;
|
||||
const uint8_t LED10 = 9;
|
||||
const uint8_t LED11 = 10;
|
||||
|
||||
/*--------------------------------------------------------*\
|
||||
| IT5711 additional ARGB Headers. |
|
||||
\*--------------------------------------------------------*/
|
||||
const uint8_t HDR_D_LED3 = LED8;
|
||||
const uint8_t HDR_D_LED4 = LED9;
|
||||
const uint8_t HDR_D_LED3_RGB = 0x62;
|
||||
const uint8_t HDR_D_LED4_RGB = 0x63;
|
||||
const uint8_t HDR_D_LED3 = LED8;
|
||||
const uint8_t HDR_D_LED4 = LED9;
|
||||
const uint8_t HDR_D_LED3_RGB = 0x62;
|
||||
const uint8_t HDR_D_LED4_RGB = 0x63;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Effects mode list |
|
||||
\*---------------------------------------------------------*/
|
||||
enum EffectType
|
||||
{
|
||||
EFFECT_NONE = 0,
|
||||
EFFECT_STATIC = 1,
|
||||
EFFECT_PULSE = 2,
|
||||
EFFECT_BLINKING = 3,
|
||||
EFFECT_COLORCYCLE = 4,
|
||||
EFFECT_WAVE = 6,
|
||||
EFFECT_RANDOM = 8,
|
||||
EFFECT_WAVE1 = 9,
|
||||
EFFECT_WAVE2 = 10,
|
||||
EFFECT_WAVE3 = 11,
|
||||
EFFECT_WAVE4 = 12,
|
||||
EFFECT_DFLASH = 15,
|
||||
EFFECT_NONE = 0,
|
||||
EFFECT_STATIC = 1,
|
||||
EFFECT_PULSE = 2,
|
||||
EFFECT_BLINKING = 3,
|
||||
EFFECT_COLORCYCLE = 4,
|
||||
EFFECT_WAVE = 6,
|
||||
EFFECT_RANDOM = 8,
|
||||
EFFECT_WAVE1 = 9,
|
||||
EFFECT_WAVE2 = 10,
|
||||
EFFECT_WAVE3 = 11,
|
||||
EFFECT_WAVE4 = 12,
|
||||
EFFECT_DFLASH = 15,
|
||||
// to be continued...
|
||||
};
|
||||
|
||||
|
|
@ -81,7 +80,7 @@ enum EffectType
|
|||
\*---------------------------------------------------------*/
|
||||
enum LEDCount
|
||||
{
|
||||
LEDS_32 = 0,
|
||||
LEDS_32 = 0,
|
||||
LEDS_64,
|
||||
LEDS_256,
|
||||
LEDS_512,
|
||||
|
|
@ -123,31 +122,21 @@ struct EncodedCalibration
|
|||
/*---------------------------------------------------------*\
|
||||
| Packet structure for applying effects |
|
||||
\*---------------------------------------------------------*/
|
||||
struct ApplyEffects
|
||||
union PktEffectApply
|
||||
{
|
||||
uint8_t report_id;
|
||||
uint8_t command_id;
|
||||
uint32_t zone_sel0;
|
||||
uint32_t zone_sel1;
|
||||
uint8_t padding[54];
|
||||
|
||||
ApplyEffects()
|
||||
unsigned char buffer[FUSION2_USB_BUFFER_SIZE];
|
||||
struct apply_data
|
||||
{
|
||||
report_id = 0xCC;
|
||||
command_id = 0x28;
|
||||
zone_sel0 = 0;
|
||||
zone_sel1 = 0;
|
||||
std::memset(padding, 0, sizeof(padding));
|
||||
}
|
||||
};
|
||||
uint8_t report_id = 0xCC;
|
||||
uint8_t command_id = 0x28;
|
||||
uint32_t zone_sel0 = 0;
|
||||
uint32_t zone_sel1 = 0;
|
||||
uint8_t padding[54];
|
||||
} a;
|
||||
|
||||
struct PktEffectApply
|
||||
{
|
||||
ApplyEffects a;
|
||||
|
||||
uint8_t* buffer()
|
||||
PktEffectApply() : a {}
|
||||
{
|
||||
return reinterpret_cast<uint8_t*>(&a);
|
||||
std::memset(a.padding, 0, sizeof(a.padding));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -177,7 +166,7 @@ typedef std::map< std::string, std::string> calibration;
|
|||
\*---------------------------------------------------------*/
|
||||
union PktRGB
|
||||
{
|
||||
unsigned char buffer[64];
|
||||
unsigned char buffer[FUSION2_USB_BUFFER_SIZE];
|
||||
struct RGBData
|
||||
{
|
||||
uint8_t report_id;
|
||||
|
|
@ -231,27 +220,27 @@ union PktRGB
|
|||
\*---------------------------------------------------------*/
|
||||
union PktEffect
|
||||
{
|
||||
unsigned char buffer[64];
|
||||
unsigned char buffer[FUSION2_USB_BUFFER_SIZE];
|
||||
struct Effect
|
||||
{
|
||||
uint8_t report_id;
|
||||
uint8_t header;
|
||||
uint32_t zone0; // RGB Fusion sets it to pow(2, led)
|
||||
uint32_t zone1;
|
||||
uint8_t reserved0;
|
||||
uint8_t effect_type;
|
||||
uint8_t max_brightness;
|
||||
uint8_t min_brightness;
|
||||
uint32_t color0;
|
||||
uint32_t color1;
|
||||
uint16_t period0; // Fade in
|
||||
uint16_t period1; // Fade out
|
||||
uint16_t period2; // Hold
|
||||
uint16_t period3;
|
||||
uint8_t effect_param0;
|
||||
uint8_t effect_param1;
|
||||
uint8_t effect_param2;
|
||||
uint8_t effect_param3;
|
||||
uint8_t report_id = 0;
|
||||
uint8_t header = 0;
|
||||
uint32_t zone0 = 0; // RGB Fusion sets it to pow(2, led)
|
||||
uint32_t zone1 = 0;
|
||||
uint8_t reserved0 = 0;
|
||||
uint8_t effect_type = EFFECT_STATIC;
|
||||
uint8_t max_brightness = 255;
|
||||
uint8_t min_brightness = 0;
|
||||
uint32_t color0 = 0;
|
||||
uint32_t color1 = 0;
|
||||
uint16_t period0 = 0; // Fade in - Rising Timer - Needs to be 0 for "Direct"
|
||||
uint16_t period1 = 0; // Fade out
|
||||
uint16_t period2 = 0; // Hold
|
||||
uint16_t period3 = 0;
|
||||
uint8_t effect_param0 = 0; // ex color count to cycle through (max seems to be 7)
|
||||
uint8_t effect_param1 = 0;
|
||||
uint8_t effect_param2 = 0; // ex flash repeat count
|
||||
uint8_t effect_param3 = 0;
|
||||
uint8_t padding0[30];
|
||||
} e;
|
||||
|
||||
|
|
@ -261,7 +250,7 @@ union PktEffect
|
|||
|
||||
void Init(int led, uint8_t report_id, uint16_t pid)
|
||||
{
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
memset(e.padding0, 0, sizeof(e.padding0));
|
||||
|
||||
e.report_id = report_id;
|
||||
if(led == -1)
|
||||
|
|
@ -284,18 +273,6 @@ union PktEffect
|
|||
e.zone0 = 0;
|
||||
e.header = 0;
|
||||
}
|
||||
e.effect_type = EFFECT_STATIC;
|
||||
e.max_brightness = 255;
|
||||
e.min_brightness = 0;
|
||||
e.color0 = 0;
|
||||
e.period0 = 0; //Rising Timer - Needs to be 0 for "Direct"
|
||||
e.period1 = 0;
|
||||
e.period2 = 0;
|
||||
e.period3 = 0;
|
||||
e.effect_param0 = 0; // ex color count to cycle through (max seems to be 7)
|
||||
e.effect_param1 = 0;
|
||||
e.effect_param2 = 0; // ex flash repeat count
|
||||
e.effect_param3 = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -368,7 +345,7 @@ public:
|
|||
uint16_t GetProductID();
|
||||
uint8_t GetDeviceNum();
|
||||
void SetStripColors(unsigned int hdr, RGBColor * colors, unsigned int num_colors, int single_led = -1);
|
||||
void SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, unsigned char red, unsigned char green, unsigned char blue);
|
||||
void SetLEDEffect(int led, int mode, unsigned int speed, unsigned char brightness, bool random, uint32_t* color);
|
||||
void SetLedCount(unsigned int c0, unsigned int c1, unsigned int c2, unsigned int c3);
|
||||
void SetMode(int mode);
|
||||
bool ApplyEffect(bool batch_commit = false);
|
||||
|
|
@ -415,4 +392,4 @@ private:
|
|||
LEDCount D_LED2_count;
|
||||
LEDCount D_LED3_count;
|
||||
LEDCount D_LED4_count;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
| SPDX-License-Identifier: GPL-2.0-only |
|
||||
\*---------------------------------------------------------*/
|
||||
|
||||
#include <array>
|
||||
#include <sstream>
|
||||
#include "RGBController_GigabyteRGBFusion2USB.h"
|
||||
#include "RGBController_GigabyteRGBFusion2USBBoards.h"
|
||||
#include "RGBController_GigabyteRGBFusion2USBLayouts.h"
|
||||
|
|
@ -48,7 +46,7 @@ static nlohmann::json WriteCalJsonFrom(const EncodedCalibration& src, uint16_t p
|
|||
calib_json["Mainboard"] = src.mainboard;
|
||||
calib_json["Spare0"] = src.spare[0];
|
||||
calib_json["Spare1"] = src.spare[1];
|
||||
|
||||
|
||||
if(pid == 0x5711)
|
||||
{
|
||||
calib_json["Spare2"] = src.spare[2];
|
||||
|
|
@ -165,26 +163,26 @@ static void LoadCustomLayoutFromJson(const nlohmann::json& json_HCL, const FwdLe
|
|||
|
||||
RGBController_RGBFusion2USB::RGBController_RGBFusion2USB(RGBFusion2USBController* controller_ptr, std::string detector)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
name = controller->GetDeviceName();
|
||||
detector_name = detector;
|
||||
vendor = "Gigabyte";
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = controller->GetDeviceDescription();
|
||||
version = controller->GetFWVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerial();
|
||||
pid = controller->GetProductID();
|
||||
device_num = controller->GetDeviceNum();
|
||||
controller = controller_ptr;
|
||||
name = controller->GetDeviceName();
|
||||
detector_name = detector;
|
||||
vendor = "Gigabyte";
|
||||
type = DEVICE_TYPE_MOTHERBOARD;
|
||||
description = controller->GetDeviceDescription();
|
||||
version = controller->GetFWVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerial();
|
||||
pid = controller->GetProductID();
|
||||
device_num = controller->GetDeviceNum();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Direct.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Direct.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Direct.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Direct.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
mode Static;
|
||||
|
|
@ -199,22 +197,21 @@ RGBController_RGBFusion2USB::RGBController_RGBFusion2USB(RGBFusion2USBController
|
|||
Static.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Static.colors.resize(1);
|
||||
modes.push_back(Static);
|
||||
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = EFFECT_PULSE;
|
||||
Breathing.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_MODE_SPECIFIC_COLOR | MODE_FLAG_HAS_RANDOM_COLOR;
|
||||
Breathing.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Breathing.brightness_max = 100; // Set 100 max due to controller quirks
|
||||
Breathing.brightness = 100; // Match default to above
|
||||
Breathing.speed_min = 9;
|
||||
Breathing.speed_max = 0;
|
||||
Breathing.speed = 4;
|
||||
Breathing.brightness_max = 100; // Set 100 max due to controller quirks
|
||||
Breathing.brightness = Breathing.brightness_max;
|
||||
Breathing.speed_min = RGBFUSION2_SPEED_MIN;
|
||||
Breathing.speed_max = RGBFUSION2_SPEED_MAX;
|
||||
Breathing.speed = RGBFUSION2_SPEED_MID;
|
||||
Breathing.colors_min = 1;
|
||||
Breathing.colors_max = 1;
|
||||
Breathing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Breathing.colors.resize(1);
|
||||
Breathing.speed = 2;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode Blinking;
|
||||
|
|
@ -224,14 +221,13 @@ RGBController_RGBFusion2USB::RGBController_RGBFusion2USB(RGBFusion2USBController
|
|||
Blinking.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Blinking.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Blinking.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Blinking.speed_min = 9;
|
||||
Blinking.speed_max = 0;
|
||||
Blinking.speed = 4;
|
||||
Blinking.speed_min = RGBFUSION2_SPEED_MIN;
|
||||
Blinking.speed_max = RGBFUSION2_SPEED_MAX;
|
||||
Blinking.speed = RGBFUSION2_SPEED_MID;
|
||||
Blinking.colors_min = 1;
|
||||
Blinking.colors_max = 1;
|
||||
Blinking.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Blinking.colors.resize(1);
|
||||
Blinking.speed = 2;
|
||||
modes.push_back(Blinking);
|
||||
|
||||
mode ColorCycle;
|
||||
|
|
@ -241,11 +237,10 @@ RGBController_RGBFusion2USB::RGBController_RGBFusion2USB(RGBFusion2USBController
|
|||
ColorCycle.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
ColorCycle.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
ColorCycle.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
ColorCycle.speed_min = 9;
|
||||
ColorCycle.speed_max = 0;
|
||||
ColorCycle.speed = 4;
|
||||
ColorCycle.speed_min = RGBFUSION2_SPEED_MIN;
|
||||
ColorCycle.speed_max = RGBFUSION2_SPEED_MAX;
|
||||
ColorCycle.speed = RGBFUSION2_SPEED_MID;
|
||||
ColorCycle.color_mode = MODE_COLORS_NONE;
|
||||
ColorCycle.speed = 2;
|
||||
modes.push_back(ColorCycle);
|
||||
|
||||
mode Flashing;
|
||||
|
|
@ -255,91 +250,88 @@ RGBController_RGBFusion2USB::RGBController_RGBFusion2USB(RGBFusion2USBController
|
|||
Flashing.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Flashing.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Flashing.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Flashing.speed_min = 9;
|
||||
Flashing.speed_max = 0;
|
||||
Flashing.speed = 4;
|
||||
Flashing.speed_min = RGBFUSION2_SPEED_MIN;
|
||||
Flashing.speed_max = RGBFUSION2_SPEED_MAX;
|
||||
Flashing.speed = RGBFUSION2_SPEED_MID;
|
||||
Flashing.colors_min = 1;
|
||||
Flashing.colors_max = 1;
|
||||
Flashing.color_mode = MODE_COLORS_MODE_SPECIFIC;
|
||||
Flashing.colors.resize(1);
|
||||
Flashing.speed = 2;
|
||||
modes.push_back(Flashing);
|
||||
|
||||
|
||||
mode Wave;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = EFFECT_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Wave.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave.speed_min = 9;
|
||||
Wave.speed_max = 0;
|
||||
Wave.speed = 4;
|
||||
Wave.colors_min = 0;
|
||||
Wave.colors_max = 0;
|
||||
Wave.color_mode = MODE_COLORS_NONE;
|
||||
Wave.name = "Wave";
|
||||
Wave.value = EFFECT_WAVE;
|
||||
Wave.flags = MODE_FLAG_HAS_BRIGHTNESS | MODE_FLAG_HAS_SPEED;
|
||||
Wave.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave.speed_min = RGBFUSION2_SPEED_MIN;
|
||||
Wave.speed_max = RGBFUSION2_SPEED_MAX;
|
||||
Wave.speed = RGBFUSION2_SPEED_MID;
|
||||
Wave.colors_min = 0;
|
||||
Wave.colors_max = 0;
|
||||
Wave.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Wave);
|
||||
|
||||
mode Random;
|
||||
Random.name = "Random";
|
||||
Random.value = EFFECT_RANDOM;
|
||||
Random.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Random.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Random.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Random.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Random.colors_min = 0;
|
||||
Random.colors_max = 0;
|
||||
Random.color_mode = MODE_COLORS_NONE;
|
||||
Random.name = "Random";
|
||||
Random.value = EFFECT_RANDOM;
|
||||
Random.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Random.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Random.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Random.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Random.colors_min = 0;
|
||||
Random.colors_max = 0;
|
||||
Random.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Random);
|
||||
|
||||
|
||||
mode Wave1;
|
||||
Wave1.name = "Wave 1";
|
||||
Wave1.value = EFFECT_WAVE1;
|
||||
Wave1.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave1.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave1.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave1.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave1.colors_min = 0;
|
||||
Wave1.colors_max = 0;
|
||||
Wave1.color_mode = MODE_COLORS_NONE;
|
||||
Wave1.name = "Wave 1";
|
||||
Wave1.value = EFFECT_WAVE1;
|
||||
Wave1.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave1.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave1.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave1.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave1.colors_min = 0;
|
||||
Wave1.colors_max = 0;
|
||||
Wave1.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Wave1);
|
||||
|
||||
mode Wave2;
|
||||
Wave2.name = "Wave 2";
|
||||
Wave2.value = EFFECT_WAVE2;
|
||||
Wave2.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave2.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave2.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave2.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave2.colors_min = 0;
|
||||
Wave2.colors_max = 0;
|
||||
Wave2.color_mode = MODE_COLORS_NONE;
|
||||
Wave2.name = "Wave 2";
|
||||
Wave2.value = EFFECT_WAVE2;
|
||||
Wave2.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave2.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave2.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave2.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave2.colors_min = 0;
|
||||
Wave2.colors_max = 0;
|
||||
Wave2.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Wave2);
|
||||
|
||||
mode Wave3;
|
||||
Wave3.name = "Wave 3";
|
||||
Wave3.value = EFFECT_WAVE3;
|
||||
Wave3.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave3.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave3.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave3.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave3.colors_min = 0;
|
||||
Wave3.colors_max = 0;
|
||||
Wave3.color_mode = MODE_COLORS_NONE;
|
||||
Wave3.name = "Wave 3";
|
||||
Wave3.value = EFFECT_WAVE3;
|
||||
Wave3.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave3.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave3.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave3.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave3.colors_min = 0;
|
||||
Wave3.colors_max = 0;
|
||||
Wave3.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Wave3);
|
||||
|
||||
mode Wave4;
|
||||
Wave4.name = "Wave 4";
|
||||
Wave4.value = EFFECT_WAVE4;
|
||||
Wave4.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave4.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave4.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave4.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave4.colors_min = 0;
|
||||
Wave4.colors_max = 0;
|
||||
Wave4.color_mode = MODE_COLORS_NONE;
|
||||
Wave4.name = "Wave 4";
|
||||
Wave4.value = EFFECT_WAVE4;
|
||||
Wave4.flags = MODE_FLAG_HAS_BRIGHTNESS;
|
||||
Wave4.brightness_min = RGBFUSION2_BRIGHTNESS_MIN;
|
||||
Wave4.brightness_max = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave4.brightness = RGBFUSION2_BRIGHTNESS_MAX;
|
||||
Wave4.colors_min = 0;
|
||||
Wave4.colors_max = 0;
|
||||
Wave4.color_mode = MODE_COLORS_NONE;
|
||||
modes.push_back(Wave4);
|
||||
|
||||
Load_Device_Config();
|
||||
|
|
@ -558,8 +550,8 @@ void RGBController_RGBFusion2USB::Init_Controller()
|
|||
}
|
||||
|
||||
zones[zone_idx].name = zl->first;
|
||||
zones[zone_idx].leds_min = (single_zone) ? LED_count : RGBFusion2_Digital_LEDS_Min;
|
||||
zones[zone_idx].leds_max = (single_zone) ? LED_count : RGBFusion2_Digital_LEDS_Max;
|
||||
zones[zone_idx].leds_min = (single_zone) ? LED_count : RGBFUSION2_DIGITAL_LEDS_MIN;
|
||||
zones[zone_idx].leds_max = (single_zone) ? LED_count : RGBFUSION2_DIGITAL_LEDS_MAX;
|
||||
zones[zone_idx].leds_count = (single_zone) ? LED_count : 0;
|
||||
zones[zone_idx].type = (single_zone) ? ZONE_TYPE_SINGLE : ZONE_TYPE_LINEAR;
|
||||
zones[zone_idx].matrix_map = NULL;
|
||||
|
|
@ -651,8 +643,9 @@ void RGBController_RGBFusion2USB::ResizeZone(int zone, int new_size)
|
|||
|
||||
void RGBController_RGBFusion2USB::DeviceUpdateLEDs()
|
||||
{
|
||||
int mode_value = (modes[active_mode].value);
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
int mode_value = (modes[active_mode].value);
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
uint32_t* color = &null_color;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If Wave 1-4 then use special sequence. |
|
||||
|
|
@ -660,52 +653,40 @@ void RGBController_RGBFusion2USB::DeviceUpdateLEDs()
|
|||
if(mode_value == 6 || (mode_value >= 9 && mode_value <= 12))
|
||||
{
|
||||
controller->SetStripBuiltinEffectState(-1, true);
|
||||
controller->SetLEDEffect(-1, 1, 0, 0xFF, 0, 0, 0, 0);
|
||||
controller->SetLEDEffect(-1, 1, 0, 0xFF, 0, color);
|
||||
controller->ApplyEffect();
|
||||
controller->SetLEDEffect( 2, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, 0, 0, 0);
|
||||
controller->SetLEDEffect( 2, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
controller->ApplyEffect();
|
||||
return;
|
||||
}
|
||||
|
||||
for(int zone_idx = 0; zone_idx < (int)zones.size(); zone_idx++)
|
||||
{
|
||||
mode_value = modes[active_mode].value;
|
||||
if(zones[zone_idx].type == ZONE_TYPE_SINGLE)
|
||||
{
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone_idx].leds_count; led_idx++)
|
||||
{
|
||||
mode_value = modes[active_mode].value;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Motherboard LEDs always use effect mode, so use static for|
|
||||
| direct mode but get colors from zone |
|
||||
\*---------------------------------------------------------*/
|
||||
if(mode_value == 0xFFFF)
|
||||
{
|
||||
red = RGBGetRValue(zones[zone_idx].colors[led_idx]);
|
||||
grn = RGBGetGValue(zones[zone_idx].colors[led_idx]);
|
||||
blu = RGBGetBValue(zones[zone_idx].colors[led_idx]);
|
||||
|
||||
mode_value = EFFECT_STATIC;
|
||||
color = &zones[zone_idx].colors[led_idx];
|
||||
mode_value = EFFECT_STATIC;
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
| If the mode uses mode-specific color, get color from mode |
|
||||
\*---------------------------------------------------------*/
|
||||
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
color = &modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Apply the mode and color to the zone |
|
||||
\*---------------------------------------------------------*/
|
||||
controller->SetLEDEffect(zones[zone_idx].leds[led_idx].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, red, grn, blu);
|
||||
controller->SetLEDEffect(zones[zone_idx].leds[led_idx].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -731,25 +712,19 @@ void RGBController_RGBFusion2USB::DeviceUpdateLEDs()
|
|||
\*---------------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If mode has mode specific color, load color from mode |
|
||||
\*---------------------------------------------------------*/
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
color = &modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Apply hardware effects to LED strips |
|
||||
\*---------------------------------------------------------*/
|
||||
controller->SetStripBuiltinEffectState(hdr, true);
|
||||
controller->SetLEDEffect(hdr, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, red, grn, blu);
|
||||
controller->SetLEDEffect(hdr, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -762,8 +737,9 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone)
|
|||
/*---------------------------------------------------------*\
|
||||
| Get mode parameters |
|
||||
\*---------------------------------------------------------*/
|
||||
int mode_value = (modes[active_mode].value);
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
int mode_value = (modes[active_mode].value);
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
uint32_t* color = &null_color;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If Wave 1-4 then use special sequence. |
|
||||
|
|
@ -771,9 +747,9 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone)
|
|||
if(mode_value == 6 || (mode_value >= 9 && mode_value <= 12))
|
||||
{
|
||||
controller->SetStripBuiltinEffectState(-1, true);
|
||||
controller->SetLEDEffect(-1, 1, 0, 0xFF, 0, 0, 0, 0);
|
||||
controller->SetLEDEffect(-1, 1, 0, 0xFF, 0, color);
|
||||
controller->ApplyEffect();
|
||||
controller->SetLEDEffect( 2, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, 0, 0, 0);
|
||||
controller->SetLEDEffect( 2, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
controller->ApplyEffect();
|
||||
return;
|
||||
}
|
||||
|
|
@ -783,24 +759,16 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone)
|
|||
\*---------------------------------------------------------*/
|
||||
if(zones[zone].type == ZONE_TYPE_SINGLE)
|
||||
{
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
for(std::size_t led_idx = 0; led_idx < zones[zone].leds_count; led_idx++)
|
||||
{
|
||||
|
||||
/*------------------------------------------------------------*\
|
||||
| Motherboard LEDs always use effect mode, so use static for |
|
||||
| direct mode but get colors from zone |
|
||||
\*------------------------------------------------------------*/
|
||||
if(mode_value == 0xFFFF)
|
||||
{
|
||||
red = RGBGetRValue(zones[zone].colors[led_idx]);
|
||||
grn = RGBGetGValue(zones[zone].colors[led_idx]);
|
||||
blu = RGBGetBValue(zones[zone].colors[led_idx]);
|
||||
|
||||
mode_value = EFFECT_STATIC;
|
||||
color = &zones[zone].colors[led_idx];
|
||||
mode_value = EFFECT_STATIC;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -808,15 +776,13 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone)
|
|||
\*---------------------------------------------------------*/
|
||||
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
color = &modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Apply the mode and color to the zone |
|
||||
\*---------------------------------------------------------*/
|
||||
controller->SetLEDEffect(zones[zone].leds[led_idx].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, red, grn, blu);
|
||||
controller->SetLEDEffect(zones[zone].leds[led_idx].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
controller->ApplyEffect();
|
||||
}
|
||||
}
|
||||
|
|
@ -844,25 +810,19 @@ void RGBController_RGBFusion2USB::UpdateZoneLEDs(int zone)
|
|||
\*---------------------------------------------------------*/
|
||||
else
|
||||
{
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If mode has mode specific color, load color from mode |
|
||||
\*---------------------------------------------------------*/
|
||||
if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
color = &modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Apply built-in effects to LED strips |
|
||||
\*---------------------------------------------------------*/
|
||||
controller->SetStripBuiltinEffectState(hdr, true);
|
||||
controller->SetLEDEffect(hdr, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, red, grn, blu);
|
||||
controller->SetLEDEffect(hdr, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
controller->ApplyEffect();
|
||||
}
|
||||
}
|
||||
|
|
@ -874,8 +834,9 @@ void RGBController_RGBFusion2USB::UpdateSingleLED(int led)
|
|||
/*---------------------------------------------------------*\
|
||||
| Get mode parameters |
|
||||
\*---------------------------------------------------------*/
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
int mode_value = (modes[active_mode].value);
|
||||
int mode_value = (modes[active_mode].value);
|
||||
bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM);
|
||||
uint32_t* color = &null_color;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If Wave 1-4 then use special sequence. |
|
||||
|
|
@ -883,9 +844,9 @@ void RGBController_RGBFusion2USB::UpdateSingleLED(int led)
|
|||
if(mode_value == 6 || (mode_value >= 9 && mode_value <= 12))
|
||||
{
|
||||
controller->SetStripBuiltinEffectState(-1, true);
|
||||
controller->SetLEDEffect(-1, 1, 0, 0xFF, 0, 0, 0, 0);
|
||||
controller->SetLEDEffect(-1, 1, 0, 0xFF, 0, color);
|
||||
controller->ApplyEffect();
|
||||
controller->SetLEDEffect( 2, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, 0, 0, 0);
|
||||
controller->SetLEDEffect( 2, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
controller->ApplyEffect();
|
||||
return;
|
||||
}
|
||||
|
|
@ -896,21 +857,14 @@ void RGBController_RGBFusion2USB::UpdateSingleLED(int led)
|
|||
\*---------------------------------------------------------*/
|
||||
if(zones[zone_idx].type == ZONE_TYPE_SINGLE)
|
||||
{
|
||||
unsigned char red = 0;
|
||||
unsigned char grn = 0;
|
||||
unsigned char blu = 0;
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| Motherboard LEDs always use effect mode, so use static for|
|
||||
| direct mode but get colors from zone |
|
||||
\*---------------------------------------------------------*/
|
||||
if(mode_value == 0xFFFF)
|
||||
{
|
||||
red = RGBGetRValue(colors[led]);
|
||||
grn = RGBGetGValue(colors[led]);
|
||||
blu = RGBGetBValue(colors[led]);
|
||||
|
||||
mode_value = EFFECT_STATIC;
|
||||
color = &colors[led];
|
||||
mode_value = EFFECT_STATIC;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
|
|
@ -918,12 +872,10 @@ void RGBController_RGBFusion2USB::UpdateSingleLED(int led)
|
|||
\*---------------------------------------------------------*/
|
||||
else if(modes[active_mode].color_mode == MODE_COLORS_MODE_SPECIFIC)
|
||||
{
|
||||
red = RGBGetRValue(modes[active_mode].colors[0]);
|
||||
grn = RGBGetGValue(modes[active_mode].colors[0]);
|
||||
blu = RGBGetBValue(modes[active_mode].colors[0]);
|
||||
color = &modes[active_mode].colors[0];
|
||||
}
|
||||
|
||||
controller->SetLEDEffect(leds[led].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, red, grn, blu);
|
||||
controller->SetLEDEffect(leds[led].value, mode_value, modes[active_mode].speed, modes[active_mode].brightness, random, color);
|
||||
controller->ApplyEffect();
|
||||
}
|
||||
|
||||
|
|
@ -958,4 +910,4 @@ int RGBController_RGBFusion2USB::GetLED_Zone(int led_idx)
|
|||
| If zone is not found, return -1 |
|
||||
\*---------------------------------------------------------*/
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,16 +14,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "RGBController.h"
|
||||
#include "GigabyteRGBFusion2USBController.h"
|
||||
#include "RGBController_GigabyteRGBFusion2USBBoards.h"
|
||||
#include "RGBController_GigabyteRGBFusion2USBLayouts.h"
|
||||
|
||||
#define RGBFusion2_Digital_LEDS_Min 0;
|
||||
#define RGBFusion2_Digital_LEDS_Max 1024;
|
||||
#define RGBFUSION2_BRIGHTNESS_MIN 0;
|
||||
#define RGBFUSION2_BRIGHTNESS_MAX 255;
|
||||
#define RGBFUSION2_DIGITAL_LEDS_MIN 0
|
||||
#define RGBFUSION2_DIGITAL_LEDS_MAX 1024
|
||||
#define RGBFUSION2_BRIGHTNESS_MIN 0
|
||||
#define RGBFUSION2_BRIGHTNESS_MAX 255
|
||||
#define RGBFUSION2_SPEED_MIN 9
|
||||
#define RGBFUSION2_SPEED_MID 4
|
||||
#define RGBFUSION2_SPEED_MAX 0
|
||||
|
||||
template<typename K, typename V>
|
||||
static std::map<V, K> reverse_map(const std::map<K, V>& map)
|
||||
|
|
@ -60,9 +62,11 @@ private:
|
|||
std::string detector_name;
|
||||
|
||||
RGBFusion2USBController* controller;
|
||||
ZoneLeds layout;
|
||||
uint16_t pid;
|
||||
int device_num;
|
||||
ZoneLeds layout;
|
||||
RGBColor null_color = 0;
|
||||
uint16_t pid;
|
||||
|
||||
void Load_Device_Config();
|
||||
void Init_Controller();
|
||||
int GetLED_Zone(int led_idx);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
\*---------------------------------------------------------*/
|
||||
|
||||
#include "RGBController_GigabyteRGBFusion2USBBoards.h"
|
||||
#include "GigabyteRGBFusion2USBController.h"
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| This is a list of known layouts listed by controller |
|
||||
|
|
@ -312,4 +311,4 @@ const MBName MBName2LayoutLookup5711 =
|
|||
{"Z890M AORUS ELITE WIFI7", "Z890-WIFI7" },
|
||||
{"Z890M AORUS ELITE WIFI7 ICE", "Z890-WIFI7" },
|
||||
{"Z890M GAMING X", "X870I-PRO" },
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using MBName = std::map<std::string, std::string>;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,25 +18,25 @@
|
|||
\*-------------------------------------------------*/
|
||||
const FwdLedHeaders LedLookup =
|
||||
{
|
||||
{"LED1", 0},
|
||||
{"LED2", 1},
|
||||
{"LED3", 2},
|
||||
{"LED4", 3},
|
||||
{"LED5", 4},
|
||||
{"LED6", 5},
|
||||
{"LED7", 6},
|
||||
{"LED8", 7},
|
||||
{"LED9", 8},
|
||||
{"LED10", 9},
|
||||
{"LED11", 10},
|
||||
{"HDR_D_LED1", 5},
|
||||
{"HDR_D_LED2", 6},
|
||||
{"HDR_D_LED3", 7},
|
||||
{"HDR_D_LED4", 8},
|
||||
{"HDR_D_LED1_RGB", 0x58},
|
||||
{"HDR_D_LED2_RGB", 0x59},
|
||||
{"HDR_D_LED3_RGB", 0x62},
|
||||
{"HDR_D_LED4_RGB", 0x63},
|
||||
{"LED1", 0},
|
||||
{"LED2", 1},
|
||||
{"LED3", 2},
|
||||
{"LED4", 3},
|
||||
{"LED5", 4},
|
||||
{"LED6", 5},
|
||||
{"LED7", 6},
|
||||
{"LED8", 7},
|
||||
{"LED9", 8},
|
||||
{"LED10", 9},
|
||||
{"LED11", 10},
|
||||
{"HDR_D_LED1", 5},
|
||||
{"HDR_D_LED2", 6},
|
||||
{"HDR_D_LED3", 7},
|
||||
{"HDR_D_LED4", 8},
|
||||
{"HDR_D_LED1_RGB", 0x58},
|
||||
{"HDR_D_LED2_RGB", 0x59},
|
||||
{"HDR_D_LED3_RGB", 0x62},
|
||||
{"HDR_D_LED4_RGB", 0x63},
|
||||
};
|
||||
|
||||
/*-------------------------------------------------*\
|
||||
|
|
@ -1932,4 +1932,4 @@ const KnownLayout knownLayoutsLookup =
|
|||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue