diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp index 9bb042f7..a8f4c279 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.cpp @@ -19,17 +19,20 @@ AMDWraithPrismController::AMDWraithPrismController(hid_device* dev_handle, const strcpy(device_name, "AMD Wraith Prism"); - current_fan_mode = AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC; - current_fan_speed = 0xFF; - current_fan_random_color = false; + current_fan_mode = AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC; + current_fan_speed = 0xFF; + current_fan_random_color = false; + current_fan_brightness = 0xFF; - current_logo_mode = AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC; - current_logo_speed = 0xFF; - current_logo_random_color = false; + current_logo_mode = AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC; + current_logo_speed = 0xFF; + current_logo_random_color = false; + current_logo_brightness = 0xFF; - current_ring_mode = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC; - current_ring_speed = 0xFF; - current_ring_direction = false; + current_ring_mode = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC; + current_ring_speed = 0xFF; + current_ring_direction = false; + current_ring_brightness = 0xFF; SendEnableCommand(); } @@ -147,10 +150,11 @@ std::string AMDWraithPrismController::GetFirmwareVersionString() return(ret_string); } -void AMDWraithPrismController::SetFanMode(unsigned char mode, unsigned char speed, bool random_color) +void AMDWraithPrismController::SetFanMode(unsigned char mode, unsigned char speed, unsigned char brightness, bool random_color) { current_fan_mode = mode; current_fan_speed = speed_values_fan_logo[mode][speed]; + current_fan_brightness = brightness; current_fan_random_color = random_color; } @@ -163,17 +167,18 @@ void AMDWraithPrismController::SetFanColor(unsigned char red, unsigned char gree false, current_fan_random_color, current_fan_mode, - max_brightness_fan_logo[current_fan_mode], + current_fan_brightness, red, green, blue ); } -void AMDWraithPrismController::SetLogoMode(unsigned char mode, unsigned char speed, bool random_color) +void AMDWraithPrismController::SetLogoMode(unsigned char mode, unsigned char speed, unsigned char brightness, bool random_color) { current_logo_mode = mode; current_logo_speed = speed_values_fan_logo[mode][speed]; + current_logo_brightness = brightness; current_logo_random_color = random_color; } @@ -186,18 +191,19 @@ void AMDWraithPrismController::SetLogoColor(unsigned char red, unsigned char gre false, current_logo_random_color, current_logo_mode, - max_brightness_fan_logo[current_logo_mode], + current_logo_brightness, red, green, blue ); } -void AMDWraithPrismController::SetRingMode(unsigned char mode, unsigned char speed, bool direction, bool random_color) +void AMDWraithPrismController::SetRingMode(unsigned char mode, unsigned char speed, unsigned char brightness, bool direction, bool random_color) { current_ring_mode = mode; current_ring_speed = speed_values_ring[mode][speed]; current_ring_direction = direction; + current_ring_brightness = brightness; current_ring_random_color = random_color; } @@ -212,7 +218,7 @@ void AMDWraithPrismController::SetRingColor(unsigned char red, unsigned char gre current_ring_direction, current_ring_random_color, mode_value_ring[current_ring_mode], - max_brightness_ring[current_ring_mode], + current_ring_brightness, red, green, blue diff --git a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h index 5aef416f..59a2555a 100644 --- a/Controllers/AMDWraithPrismController/AMDWraithPrismController.h +++ b/Controllers/AMDWraithPrismController/AMDWraithPrismController.h @@ -12,13 +12,8 @@ #pragma once -static const unsigned char max_brightness_fan_logo[] = -{ - 0x00, - 0xFF, - 0x7F, - 0xFF -}; +#define AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX 0xFF +#define AMD_WRAITH_PRISM_FAN_BRIGHTNESS_CYCLE_MAX 0x7F static const unsigned char speed_values_fan_logo[][5] = { @@ -28,22 +23,6 @@ static const unsigned char speed_values_fan_logo[][5] = { 0x3C, 0x37, 0x31, 0x2C, 0x26 }, /* Breathing */ }; -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, @@ -121,13 +100,13 @@ public: void SetRingEffectChannel(unsigned char channel); - void SetFanMode(unsigned char mode, unsigned char speed, bool random_color); + void SetFanMode(unsigned char mode, unsigned char speed, unsigned char brightness, bool random_color); void SetFanColor(unsigned char red, unsigned char green, unsigned char blue); - void SetLogoMode(unsigned char mode, unsigned char speed, bool random_color); + void SetLogoMode(unsigned char mode, unsigned char speed, unsigned char brightness, bool random_color); void SetLogoColor(unsigned char red, unsigned char green, unsigned char blue); - void SetRingMode(unsigned char mode, unsigned char speed, bool direction, bool random_color); + void SetRingMode(unsigned char mode, unsigned char speed, unsigned char brightness, bool direction, bool random_color); void SetRingColor(unsigned char red, unsigned char green, unsigned char blue); private: @@ -137,14 +116,17 @@ private: unsigned char current_fan_mode; unsigned char current_fan_speed; + unsigned char current_fan_brightness; bool current_fan_random_color; unsigned char current_logo_mode; unsigned char current_logo_speed; + unsigned char current_logo_brightness; bool current_logo_random_color; unsigned char current_ring_mode; unsigned char current_ring_speed; + unsigned char current_ring_brightness; bool current_ring_direction; bool current_ring_random_color; diff --git a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp index 6ecb4f4a..75ae6af2 100644 --- a/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp +++ b/Controllers/AMDWraithPrismController/RGBController_AMDWraithPrism.cpp @@ -26,70 +26,91 @@ RGBController_AMDWraithPrism::RGBController_AMDWraithPrism(AMDWraithPrismControl serial = "";//wraith->GetSerialString(); mode Direct; - Direct.name = "Direct"; - Direct.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC; - Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR; - Direct.color_mode = MODE_COLORS_PER_LED; + Direct.name = "Direct"; + Direct.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_STATIC; + Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_BRIGHTNESS; + Direct.brightness_min = 0; + Direct.brightness_max = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Direct.brightness = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Direct.color_mode = MODE_COLORS_PER_LED; modes.push_back(Direct); mode Breathing; - Breathing.name = "Breathing"; - Breathing.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING; - Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR; - Breathing.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; - Breathing.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; - Breathing.color_mode = MODE_COLORS_PER_LED; - Breathing.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; + Breathing.name = "Breathing"; + Breathing.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING; + Breathing.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS; + Breathing.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + Breathing.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + Breathing.brightness_min = 0; + Breathing.brightness_max = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Breathing.brightness = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Breathing.color_mode = MODE_COLORS_PER_LED; + 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 = AMD_WRAITH_PRISM_SPEED_SLOWEST; - ColorCycle.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; - ColorCycle.color_mode = MODE_COLORS_NONE; - ColorCycle.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; + ColorCycle.name = "Color Cycle"; + ColorCycle.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE; + ColorCycle.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS; + ColorCycle.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + ColorCycle.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + ColorCycle.brightness_min = 0; + ColorCycle.brightness_max = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_CYCLE_MAX; + ColorCycle.brightness = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_CYCLE_MAX; + ColorCycle.color_mode = MODE_COLORS_NONE; + 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 = AMD_WRAITH_PRISM_SPEED_SLOWEST; - Rainbow.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; - Rainbow.color_mode = MODE_COLORS_NONE; - Rainbow.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; + Rainbow.name = "Rainbow"; + Rainbow.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW; + Rainbow.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS; + Rainbow.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + Rainbow.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + Rainbow.brightness_min = 0; + Rainbow.brightness_max = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Rainbow.brightness = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; //The Ring zone can not get brighter but Logo / Fan can + Rainbow.color_mode = MODE_COLORS_NONE; + Rainbow.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; modes.push_back(Rainbow); mode Bounce; - Bounce.name = "Bounce"; - Bounce.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE; - Bounce.flags = MODE_FLAG_HAS_SPEED; - Bounce.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; - Bounce.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; - Bounce.color_mode = MODE_COLORS_NONE; - Bounce.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; + Bounce.name = "Bounce"; + Bounce.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE; + Bounce.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_BRIGHTNESS; + Bounce.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + Bounce.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + Bounce.brightness_min = 0; + Bounce.brightness_max = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Bounce.brightness = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; //The Ring zone can not get brighter but Logo / Fan can + Bounce.color_mode = MODE_COLORS_NONE; + Bounce.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; modes.push_back(Bounce); mode Chase; - Chase.name = "Chase"; - Chase.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_CHASE; - Chase.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR; - Chase.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; - Chase.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; - Chase.color_mode = MODE_COLORS_PER_LED; - Chase.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; + Chase.name = "Chase"; + Chase.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_CHASE; + Chase.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS; + Chase.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + Chase.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + Chase.brightness_min = 0; + Chase.brightness_max = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Chase.brightness = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Chase.color_mode = MODE_COLORS_PER_LED; + Chase.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; modes.push_back(Chase); mode Swirl; - Swirl.name = "Swirl"; - Swirl.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_SWIRL; - Swirl.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR; - Swirl.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; - Swirl.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; - Swirl.color_mode = MODE_COLORS_PER_LED; - Swirl.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; + Swirl.name = "Swirl"; + Swirl.value = AMD_WRAITH_PRISM_EFFECT_CHANNEL_SWIRL; + Swirl.flags = MODE_FLAG_HAS_SPEED | MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_HAS_RANDOM_COLOR | MODE_FLAG_HAS_BRIGHTNESS; + Swirl.speed_min = AMD_WRAITH_PRISM_SPEED_SLOWEST; + Swirl.speed_max = AMD_WRAITH_PRISM_SPEED_FASTEST; + Swirl.brightness_min = 0; + Swirl.brightness_max = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Swirl.brightness = AMD_WRAITH_PRISM_FAN_BRIGHTNESS_DEFAULT_MAX; + Swirl.color_mode = MODE_COLORS_PER_LED; + Swirl.speed = AMD_WRAITH_PRISM_SPEED_NORMAL; modes.push_back(Swirl); SetupZones(); @@ -210,32 +231,36 @@ void RGBController_AMDWraithPrism::DeviceUpdateMode() { bool random = (modes[active_mode].color_mode == MODE_COLORS_RANDOM); - wraith->SetRingMode(modes[active_mode].value, modes[active_mode].speed, modes[active_mode].direction, random); + wraith->SetRingMode(modes[active_mode].value, modes[active_mode].speed, modes[active_mode].brightness, modes[active_mode].direction, random); switch(modes[active_mode].value) { case AMD_WRAITH_PRISM_EFFECT_CHANNEL_COLOR_CYCLE: + wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].brightness, random); + wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].brightness, random); + break; + case AMD_WRAITH_PRISM_EFFECT_CHANNEL_RAINBOW: case AMD_WRAITH_PRISM_EFFECT_CHANNEL_BOUNCE: - wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random); - wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random); + wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, (modes[active_mode].brightness >> 1), random); + wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, (modes[active_mode].brightness >> 1), random); break; case AMD_WRAITH_PRISM_EFFECT_CHANNEL_BREATHING: - wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, random); - wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, random); + wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, modes[active_mode].brightness, random); + wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_BREATHING, modes[active_mode].speed, modes[active_mode].brightness, random); break; default: if(random) { - wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random); - wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, random); + wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].brightness, random); + wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_COLOR_CYCLE, modes[active_mode].speed, modes[active_mode].brightness, random); } else { - wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, random); - wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, random); + wraith->SetFanMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, modes[active_mode].brightness, random); + wraith->SetLogoMode(AMD_WRAITH_PRISM_FAN_LOGO_MODE_STATIC, modes[active_mode].speed, modes[active_mode].brightness, random); } break; }