From 2a76201ca4227e350b7985d8b2346db24da2754c Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Thu, 23 Jan 2020 22:23:37 -0600 Subject: [PATCH] Implement a speed table for AMD Wraith Prism to use the values taken from the official software. Interpolation was causing strange issues. --- .../AMDWraithPrismController.cpp | 6 ++-- .../AMDWraithPrismController.h | 32 +++++++++++++++++++ .../RGBController_AMDWraithPrism.cpp | 20 ++++++------ 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp index 3db6e77a..85c96a03 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp @@ -129,7 +129,7 @@ std::string AMDWraithPrismController::GetFirmwareVersionString() void AMDWraithPrismController::SetFanMode(unsigned char mode, unsigned char speed, bool random_color) { current_fan_mode = mode; - current_fan_speed = speed; + current_fan_speed = speed_values_fan_logo[speed][mode]; current_fan_random_color = random_color; } @@ -152,7 +152,7 @@ void AMDWraithPrismController::SetFanColor(unsigned char red, unsigned char gree void AMDWraithPrismController::SetLogoMode(unsigned char mode, unsigned char speed, bool random_color) { current_logo_mode = mode; - current_logo_speed = speed; + current_logo_speed = speed_values_fan_logo[speed][mode]; current_logo_random_color = random_color; } @@ -175,7 +175,7 @@ void AMDWraithPrismController::SetLogoColor(unsigned char red, unsigned char gre void AMDWraithPrismController::SetRingMode(unsigned char mode, unsigned char speed, bool direction, bool random_color) { current_ring_mode = mode; - current_ring_speed = speed; + current_ring_speed = speed_values_ring[speed][mode]; current_ring_direction = direction; current_ring_random_color = random_color; } diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h index 8000f681..a0039600 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h @@ -20,6 +20,13 @@ static const unsigned char max_brightness_fan_logo[] = 0xFF }; +static const unsigned char speed_values_fan_logo[][5] = +{ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, /* Static */ + { 0x96, 0x8C, 0x80, 0x6E, 0x68 }, /* Color Cycle */ + { 0x3C, 0x37, 0x31, 0x2C, 0x26 }, /* Breathing */ +}; + static const unsigned char max_brightness_ring[] = { 0xFF, @@ -52,6 +59,22 @@ static const unsigned char mode_value_ring[] = 0x05 }; +static const unsigned char speed_values_ring[][5] = +{ + { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, /* Static */ + { 0x3C, 0x37, 0x31, 0x2C, 0x26 }, /* Breathing */ + { 0x96, 0x8C, 0x80, 0x6E, 0x68 }, /* Color Cycle */ + { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */ + { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */ + { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */ + { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* */ + { 0x72, 0x68, 0x64, 0x62, 0x61 }, /* Rainbow */ + { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Bounce */ + { 0x77, 0x74, 0x6E, 0x6B, 0x67 }, /* Chase */ + { 0x77, 0x74, 0x6E, 0x6B, 0x67 }, /* Swirl */ + { 0x00, 0x00, 0x00, 0x00, 0x00 }, /* Morse Code */ +}; + enum { AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC = 0x01, /* Fan/Logo Static Mode */ @@ -73,6 +96,15 @@ enum AMD_WRAITH_PRISM_EFFECT_CHANNEL_MORSE = 0x0B, /* Morse code effect channel */ }; +enum +{ + AMD_WRAITH_PRISM_SPEED_SLOWEST = 0x00, /* Slowest speed */ + AMD_WRAITH_PRISM_SPEED_SLOW = 0x01, /* Slow speed */ + AMD_WRAITH_PRISM_SPEED_NORMAL = 0x02, /* Normal speed */ + AMD_WRAITH_PRISM_SPEED_FAST = 0x03, /* Fast speed */ + AMD_WRAITH_PRISM_SPEED_FASTEST = 0x04, /* Fastest speed */ +}; + class AMDWraithPrismController { public: diff --git a/RGBController/RGBController_AMDWraithPrism.cpp b/RGBController/RGBController_AMDWraithPrism.cpp index ff286d5a..d26bcf54 100644 --- a/RGBController/RGBController_AMDWraithPrism.cpp +++ b/RGBController/RGBController_AMDWraithPrism.cpp @@ -18,7 +18,7 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl version = wraith->GetFirmwareVersionString(); mode Static; - Static.name = "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); @@ -27,28 +27,28 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl 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.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + Breathing.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; Breathing.random = false; - Breathing.speed = 0x31; + Breathing.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; 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; + ColorCycle.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + ColorCycle.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + ColorCycle.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; 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; + Rainbow.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + Rainbow.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + Rainbow.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; modes.push_back(Rainbow); led logo_led;