mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-04-04 06:11:07 -04:00
Start adding modes to AMD Wraith Prism driver. Speed and random bit implemented, but it seems to have issues. Speeds way too fast
This commit is contained in:
@@ -126,10 +126,11 @@ std::string AMDWraithPrismController::GetFirmwareVersionString()
|
||||
return(ret_string);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetFanMode(unsigned char mode, unsigned char speed)
|
||||
void AMDWraithPrismController::SetFanMode(unsigned char mode, unsigned char speed, bool random_color)
|
||||
{
|
||||
current_fan_mode = mode;
|
||||
current_fan_speed = speed;
|
||||
current_fan_mode = mode;
|
||||
current_fan_speed = speed;
|
||||
current_fan_random_color = random_color;
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetFanColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
@@ -138,19 +139,21 @@ void AMDWraithPrismController::SetFanColor(unsigned char red, unsigned char gree
|
||||
(
|
||||
AMD_WRAITH_PRISM_EFFECT_CHANNEL_FAN_LED,
|
||||
current_fan_speed,
|
||||
0x00,
|
||||
false,
|
||||
current_fan_random_color,
|
||||
current_fan_mode,
|
||||
0xFF,
|
||||
max_brightness_fan_logo[current_fan_mode],
|
||||
red,
|
||||
green,
|
||||
blue
|
||||
);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetLogoMode(unsigned char mode, unsigned char speed)
|
||||
void AMDWraithPrismController::SetLogoMode(unsigned char mode, unsigned char speed, bool random_color)
|
||||
{
|
||||
current_logo_mode = mode;
|
||||
current_logo_speed = speed;
|
||||
current_logo_mode = mode;
|
||||
current_logo_speed = speed;
|
||||
current_logo_random_color = random_color;
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetLogoColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
@@ -159,35 +162,42 @@ void AMDWraithPrismController::SetLogoColor(unsigned char red, unsigned char gre
|
||||
(
|
||||
AMD_WRAITH_PRISM_EFFECT_CHANNEL_LOGO_LED,
|
||||
current_logo_speed,
|
||||
0x00,
|
||||
false,
|
||||
current_logo_random_color,
|
||||
current_logo_mode,
|
||||
0xFF,
|
||||
max_brightness_fan_logo[current_logo_mode],
|
||||
red,
|
||||
green,
|
||||
blue
|
||||
);
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetRingMode(unsigned char mode, unsigned char speed, bool direction)
|
||||
void AMDWraithPrismController::SetRingMode(unsigned char mode, unsigned char speed, bool direction, bool random_color)
|
||||
{
|
||||
current_ring_mode = mode;
|
||||
current_ring_speed = speed;
|
||||
current_ring_direction = direction;
|
||||
current_ring_mode = mode;
|
||||
current_ring_speed = speed;
|
||||
current_ring_direction = direction;
|
||||
current_ring_random_color = random_color;
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetRingColor(unsigned char red, unsigned char green, unsigned char blue)
|
||||
{
|
||||
SetRingEffectChannel(current_ring_mode);
|
||||
|
||||
SendEffectChannelUpdate
|
||||
(
|
||||
AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC,
|
||||
0xFF,
|
||||
0x00,
|
||||
AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC,
|
||||
0xFF,
|
||||
current_ring_mode,
|
||||
current_ring_speed,
|
||||
current_ring_direction,
|
||||
current_ring_random_color,
|
||||
mode_value_ring[current_ring_mode],
|
||||
max_brightness_ring[current_ring_mode],
|
||||
red,
|
||||
green,
|
||||
blue
|
||||
);
|
||||
|
||||
SendApplyCommand();
|
||||
}
|
||||
|
||||
void AMDWraithPrismController::SetRingEffectChannel(unsigned char channel)
|
||||
@@ -255,7 +265,8 @@ void AMDWraithPrismController::SendEffectChannelUpdate
|
||||
(
|
||||
unsigned char effect_channel,
|
||||
unsigned char speed,
|
||||
unsigned char direction,
|
||||
bool direction,
|
||||
bool random_color,
|
||||
unsigned char mode,
|
||||
unsigned char brightness,
|
||||
unsigned char red,
|
||||
@@ -287,7 +298,7 @@ void AMDWraithPrismController::SendEffectChannelUpdate
|
||||
|
||||
usb_buf[0x04] = effect_channel;
|
||||
usb_buf[0x05] = speed;
|
||||
usb_buf[0x06] = direction ? 0x01 : 0x00;
|
||||
usb_buf[0x06] = (direction ? 0x01 : 0x00) | (random_color ? 0x80 : 0x00);
|
||||
usb_buf[0x07] = mode;
|
||||
|
||||
usb_buf[0x09] = brightness;
|
||||
@@ -334,4 +345,4 @@ void AMDWraithPrismController::SendChannelRemap(unsigned char ring_channel, unsi
|
||||
|
||||
libusb_interrupt_transfer(dev, 0x04, usb_buf, 64, &actual, 0);
|
||||
libusb_interrupt_transfer(dev, 0x83, usb_buf, 64, &actual, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,46 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
static const unsigned char max_brightness_fan_logo[] =
|
||||
{
|
||||
0x00,
|
||||
0xFF,
|
||||
0x7F,
|
||||
0xFF
|
||||
};
|
||||
|
||||
static const unsigned char max_brightness_ring[] =
|
||||
{
|
||||
0xFF,
|
||||
0xFF,
|
||||
0x7F,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF,
|
||||
0xFF
|
||||
};
|
||||
|
||||
static const unsigned char mode_value_ring[] =
|
||||
{
|
||||
0xFF,
|
||||
0x03,
|
||||
0xFF,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
0x05,
|
||||
0xFF,
|
||||
0xC3,
|
||||
0x4A,
|
||||
0x05
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC = 0x01, /* Fan/Logo Static Mode */
|
||||
@@ -30,6 +70,7 @@ enum
|
||||
AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE = 0x08, /* Bounce effect channel */
|
||||
AMD_WRAITH_PRISM_EFFECT_CHANNEL_CHASE = 0x09, /* Chase effect channel */
|
||||
AMD_WRAITH_PRISM_EFFECT_CHANNEL_SWIRL = 0x0A, /* Swirl effect channel */
|
||||
AMD_WRAITH_PRISM_EFFECT_CHANNEL_MORSE = 0x0B, /* Morse code effect channel */
|
||||
};
|
||||
|
||||
class AMDWraithPrismController
|
||||
@@ -45,13 +86,13 @@ public:
|
||||
|
||||
void SetRingEffectChannel(unsigned char channel);
|
||||
|
||||
void SetFanMode(unsigned char mode, unsigned char speed);
|
||||
void SetFanMode(unsigned char mode, unsigned char speed, bool random_color);
|
||||
void SetFanColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
void SetLogoMode(unsigned char mode, unsigned char speed);
|
||||
void SetLogoMode(unsigned char mode, unsigned char speed, bool random_color);
|
||||
void SetLogoColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
void SetRingMode(unsigned char mode, unsigned char speed, bool direction);
|
||||
void SetRingMode(unsigned char mode, unsigned char speed, bool direction, bool random_color);
|
||||
void SetRingColor(unsigned char red, unsigned char green, unsigned char blue);
|
||||
|
||||
private:
|
||||
@@ -60,13 +101,16 @@ private:
|
||||
|
||||
unsigned char current_fan_mode;
|
||||
unsigned char current_fan_speed;
|
||||
bool current_fan_random_color;
|
||||
|
||||
unsigned char current_logo_mode;
|
||||
unsigned char current_logo_speed;
|
||||
bool current_logo_random_color;
|
||||
|
||||
unsigned char current_ring_mode;
|
||||
unsigned char current_ring_speed;
|
||||
bool current_ring_direction;
|
||||
bool current_ring_random_color;
|
||||
|
||||
void SendEnableCommand();
|
||||
|
||||
@@ -76,7 +120,8 @@ private:
|
||||
(
|
||||
unsigned char effect_channel,
|
||||
unsigned char speed,
|
||||
unsigned char direction,
|
||||
bool direction,
|
||||
bool random_color,
|
||||
unsigned char mode,
|
||||
unsigned char brightness,
|
||||
unsigned char red,
|
||||
|
||||
@@ -17,9 +17,39 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl
|
||||
type = DEVICE_TYPE_COOLER;
|
||||
version = wraith->GetFirmwareVersionString();
|
||||
|
||||
mode led_mode;
|
||||
led_mode.name = "Custom";
|
||||
modes.push_back(led_mode);
|
||||
mode Static;
|
||||
Static.name = "Static";
|
||||
Static.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC;
|
||||
Static.flags = MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR;
|
||||
modes.push_back(Static);
|
||||
|
||||
mode Breathing;
|
||||
Breathing.name = "Breathing";
|
||||
Breathing.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING;
|
||||
Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_COLOR | MODE_FLAG_PER_LED_COLOR | MODE_FLAG_RANDOM_COLOR;
|
||||
Breathing.speed_min = 0x3C;
|
||||
Breathing.speed_max = 0x26;
|
||||
Breathing.random = false;
|
||||
Breathing.speed = 0x31;
|
||||
modes.push_back(Breathing);
|
||||
|
||||
mode ColorCycle;
|
||||
ColorCycle.name = "Color Cycle";
|
||||
ColorCycle.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE;
|
||||
ColorCycle.flags = MODE_FLAG_HAS_SPEED;
|
||||
ColorCycle.speed_min = 0x96;
|
||||
ColorCycle.speed_max = 0x68;
|
||||
ColorCycle.speed = 0x80;
|
||||
modes.push_back(ColorCycle);
|
||||
|
||||
mode Rainbow;
|
||||
Rainbow.name = "Rainbow";
|
||||
Rainbow.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW;
|
||||
Rainbow.flags = MODE_FLAG_HAS_SPEED;
|
||||
Rainbow.speed_min = 0x72;
|
||||
Rainbow.speed_max = 0x61;
|
||||
Rainbow.speed = 0x64;
|
||||
modes.push_back(Rainbow);
|
||||
|
||||
led logo_led;
|
||||
logo_led.name = "Logo";
|
||||
@@ -71,9 +101,30 @@ int RGBController_AMDWraithPrism::GetMode()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::SetMode(int /*mode*/)
|
||||
void RGBController_AMDWraithPrism::SetMode(int mode)
|
||||
{
|
||||
wraith->SetRingMode(modes[mode].value, modes[mode].speed, modes[mode].direction, modes[mode].random);
|
||||
|
||||
switch(modes[mode].value)
|
||||
{
|
||||
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE:
|
||||
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW:
|
||||
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[mode].speed, modes[mode].random);
|
||||
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[mode].speed, modes[mode].random);
|
||||
break;
|
||||
|
||||
case AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING:
|
||||
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[mode].speed, modes[mode].random);
|
||||
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[mode].speed, modes[mode].random);
|
||||
break;
|
||||
|
||||
default:
|
||||
wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[mode].speed, modes[mode].random);
|
||||
wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[mode].speed, modes[mode].random);
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_AMDWraithPrism::SetCustomMode()
|
||||
|
||||
Reference in New Issue
Block a user